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

anchore plugin fails on matrix jobs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins 2.249.3 (running this in docker with the jenkins/blueocean image ID e543fdb352b0)
      Anchore Container Image Scanner Plugin 1.0.22
    • Similar Issues:

      Description

      I have jenkins working fine with the anchore scanner plugin for both freestyle jobs and pipelines.

       

      I created a multi-configuration project and the plugin is able to contact the anchore API as expected and queue the image, the image is scanned and we get a pass/fail evaluation back, and then the build fails when it gets to "Archiving artificats"

      I think this is due to the fact that the matrix builds have a comma that separates the "coordinates" (I'm not sure what the terminology is here).

       

      First, I noticed that if I only use one axis in the matrix, everything works.

       

      EG simple reproducer:

      1. create new multiconfiguration project.
      2. add axis, call it AXIS1 and add values "alpha" and "beta"
      3. add build step, "execute shell" with the following shell instruction:
        echo "docker.io/alpine:latest" > anchore_images
      4. add build step, anchore container image scanner, leave everything as default
      5. build now, everything works.

      now, go back and configure the job again to add a 2nd axis.

      1. add axis called "AXIS2" with value "red" (really only need one value in each axis)
      2. build now, everything fails.
      3. console output:

      2020-11-17T18:09:49.611 INFO AnchoreWorker Anchore Container Image Scanner Plugin step result - PASS
      2020-11-17T18:09:49.612 INFO AnchoreWorker Querying vulnerability listing for docker.io/alpine:latest
      Archiving artifacts
      ‘AnchoreReport.alpha’ doesn’t match anything
      2020-11-17T18:09:49.672 ERROR AnchoreWorker Failed to setup build results due to an unexpected error
      hudson.AbortException: No artifacts found that match the file pattern "AnchoreReport.alpha,red_2/". Configuration error?
      at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:280)
      at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:91)
      at com.anchore.jenkins.plugins.anchore.BuildWorker.setupBuildReports(BuildWorker.java:740)
      at com.anchore.jenkins.plugins.anchore.AnchoreBuilder.perform(AnchoreBuilder.java:255)
      at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:112)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.Build$BuildExecution.build(Build.java:206)
      at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      at hudson.model.Run.execute(Run.java:1894)
      at hudson.matrix.MatrixRun.run(MatrixRun.java:153)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      2020-11-17T18:09:49.672 ERROR AnchorePlugin Failing Anchore Container Image Scanner Plugin step due to errors in plugin execution
      hudson.AbortException: Failed to setup build results due to an unexpected error. Please refer to above logs for more information
      at com.anchore.jenkins.plugins.anchore.BuildWorker.setupBuildReports(BuildWorker.java:761)
      at com.anchore.jenkins.plugins.anchore.AnchoreBuilder.perform(AnchoreBuilder.java:255)
      at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:112)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.Build$BuildExecution.build(Build.java:206)
      at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      at hudson.model.Run.execute(Run.java:1894)
      at hudson.matrix.MatrixRun.run(MatrixRun.java:153)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      2020-11-17T18:09:49.673 INFO AnchorePlugin Completed Anchore Container Image Scanner step
      ERROR: Failed to setup build results due to an unexpected error. Please refer to above logs for more information
      Finished: FAILURE
       
      for the first build, with a single axis, the AnchoreReport is archived in /var/jenkins_home/jobs/matrix-repro1/configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1 (and likewise for "beta")
       
      bash-5.0$ cd /var/jenkins_home/jobs/matrix-repro1
      bash-5.0$ find . -print | grep AnchoreReport
      ./configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1
      ./configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1/anchore_gates.json
      ./configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1/anchoreengine-api-response-vulnerabilities-1.json
      ./configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1/anchoreengine-api-response-evaluation-1.json
      ./configurations/axis-AXIS1/alpha/builds/1/archive/AnchoreReport.alpha_1/anchore_security.json
      ./configurations/axis-AXIS1/beta/builds/1/archive/AnchoreReport.beta_1
      ./configurations/axis-AXIS1/beta/builds/1/archive/AnchoreReport.beta_1/anchore_gates.json
      ./configurations/axis-AXIS1/beta/builds/1/archive/AnchoreReport.beta_1/anchoreengine-api-response-evaluation-1.json
      ./configurations/axis-AXIS1/beta/builds/1/archive/AnchoreReport.beta_1/anchoreengine-api-response-vulnerabilities-1.json
      ./configurations/axis-AXIS1/beta/builds/1/archive/AnchoreReport.beta_1/anchore_security.json
       
      for the second build with two axes, I look in /var/jenkins_home/jobs/matrix-repro1/configurations/axis-AXIS1/alpha/axis-AXIS2/red/builds/2 but there's no "archive" directory there which is where I would expect the report to be stored.

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            swathigangisetty Swathi Gangisetty
            Reporter:
            pvn_anchore Paul Novarese
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: