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

java.lang.NullPointerException for Trivy scan of podman image

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • analysis-model
    • None

       

      Jenkinsfile snippet:

          stage('Scan image'){
            steps {
              dir(env.DIRECTORY) {
                sh ' trivy fs --exit-code 0 --no-progress --format json --output results.json  tmp_dir'
                recordIssues(
                  tools: [trivy(pattern: 'results.json', reportEncoding: 'UTF-8')]
                )
              }
            }
          }
      

      Produced file: (the image indeed doesn't have any issues detected)

      cat results.json
      {
        "SchemaVersion": 2,
        "ArtifactName": "/tmp/tmp.1F2RFo3ny4",
        "ArtifactType": "filesystem",
        "Metadata": {
          "ImageConfig": {
            "architecture": "",
            "created": "0001-01-01T00:00:00Z",
            "os": "",
            "rootfs": {
              "type": "",
              "diff_ids": null
            },
            "config": {}
          }
        }
      }
      

      Console output:

      [Pipeline] End of Pipeline
      java.lang.NullPointerException
      	at edu.hm.hafner.analysis.parser.TrivyParser.parseResults(TrivyParser.java:49)
      	at edu.hm.hafner.analysis.parser.TrivyParser.parseJsonObject(TrivyParser.java:37)
      	at edu.hm.hafner.analysis.parser.JsonIssueParser.parse(JsonIssueParser.java:33)
      	at edu.hm.hafner.analysis.IssueParser.parseFile(IssueParser.java:48)
      	at io.jenkins.plugins.analysis.core.model.FilesScanner.aggregateIssuesOfFile(FilesScanner.java:105)
      	at io.jenkins.plugins.analysis.core.model.FilesScanner.scanFiles(FilesScanner.java:89)
      	at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:72)
      	at io.jenkins.plugins.analysis.core.model.FilesScanner.invoke(FilesScanner.java:30)
      	at hudson.FilePath.act(FilePath.java:1171)
      	at hudson.FilePath.act(FilePath.java:1154)
      	at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scanInWorkspace(ReportScanningTool.java:164)
      	at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:145)
      	at io.jenkins.plugins.analysis.core.model.ReportScanningTool.scan(ReportScanningTool.java:129)
      	at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:95)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.scanWithTool(IssuesRecorder.java:765)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:728)
      	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:697)
      	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1109)
      	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1067)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Finished: FAILURE
      

       

      Jenkins version: 2.323

      Warnings Next Generation Plugin: 9.9.0

            drulli Ulli Hafner
            cosbug Constantin Bugneac
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: