Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39422

Anchore plugin fails if input image is specified with a string containing a '/'

XMLWordPrintable

      The anchore plugin reads input images from a file that is setup as an input pre-req before the anchore plugin runs - currently the plugin works with either imageIds or a string (repo/tag), but there is a bug that is triggering when an image is specified using a repo/tag string that contains a '/' character. See below for output when this occurs:

      2016-11-01 21:30:33,900 DEBUG analyzer.py _init_ analyzer initialization: begin
      2016-11-01 21:30:33,901 DEBUG analyzer.py _init_ init input processed, loading input images: [u'jenk_anchoretest/meh']
      Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/anchore/anchore_utils.py", line 957, in image_context_add
      newimage = anchore_image.AnchoreImage(i, anchore_datadir, docker_cli=docker_cli, allimages=allimages, dockerfile=dockerfile, tmpdirroot=tmproot, usertype=usertype, anchore_db=anchore_db, docker_images=docker_images)
      File "/usr/lib/python2.7/site-packages/anchore/anchore_image.py", line 102, in _init_
      if dockerfile and (os.stat(dockerfile).st_size <= 0 or not os.path.exists(dockerfile) or not os.path.isfile(dockerfile)):
      OSError: [Errno 2] No such file or directory: '/root/anchore.jenkinsplugin_227/dfile.jenk_anchoretest/meh'
      2016-11-01 21:30:33,909 ERROR common.py anchore_print_err failed to run analyzer
      Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/anchore/cli/analyzer.py", line 304, in analyze
      success = analyzer.Analyzer(anchore_config=anchore_config, imagelist=inlist, allimages=allimages, force=force, args=args).run()
      File "/usr/lib/python2.7/site-packages/anchore/analyzer.py", line 52, in _init_
      self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=contexts['docker_cli'], dockerfile=self.dockerfile, anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], docker_images=contexts['docker_images'], usertype=usertype, must_load_all=True)
      File "/usr/lib/python2.7/site-packages/anchore/anchore_utils.py", line 963, in image_context_add
      raise Exception(errorstr)
      Exception: Could not load/initialize all input images.
      Image: jenk_anchoretest/meh
      Info:
      [anchore][info] Done Running Anchore Analyzer: exitcode=1

      There is a current known workaround is to use the imageId which will allow the plugin to proceed.

            nurmi Daniel Nurmi
            nurmi Daniel Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: