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

Warnings Next Generation: Links not created for SpotBugs

    XMLWordPrintable

Details

    Description

      I have two Jobs using Warnings Next Generation Plugin for code analysis purposes. Both use the following analysis tools:

      • Checkstyle
      • CPD
      • PMD
      • SpotBugs

      The project is built with maven using the corresponding plugins for the tools.

      One of the Jobs is analyzing the master branch of a Git repository, the other one analyzes ticket branches and compares the result against the first job using a quality gate. As I need to send a mail to the author of the last git commit of the ticket branch, I had to switch to a pipeline job for the second job, while the first is still a classic jenkins job configured through the ui.

      Now I have noticed that for SpotBugs the links to the issues in the code is not set, while it is working for the first job for creating the baseline. I made second version for the first job using a pipeline job and can reproduce the same problem, so it seems that:

      • The problem is not related with the comparism between the two jobs.
      • The problem occurs only with pipeline jobs.

      There is nothing special with the recordIssues-statement IMO:

      recordIssues(
                  aggregatingResults: true, enabledForFailure: true, ignoreQualityGate: true, sourceCodeEncoding: 'UTF-8', sourceDirectory: 'src/main/java',
                  tools: [
                      checkStyle(pattern: 'target/checkstyle-result.xml', reportEncoding: 'UTF-8'),
                      mavenConsole(),
                      java(),
                      cpd(pattern: 'target/cpd.xml', reportEncoding: 'UTF-8'),
                      pmdParser(pattern: 'target/pmd.xml', reportEncoding: 'UTF-8'),
                      spotBugs(pattern: 'target/spotbugsXml.xml', reportEncoding: 'UTF-8', useRankAsPriority: true)
                  ]
              )
      

      In the logs of the alternative version of job one, I can see that the files are found to be not in the workspace anymore, yet they are there and there is nothing special about them.

      As of the other tools, their links all work correctly in both jobs. That is, if I use sed commands to relativize the paths to the issues in their resulting files as otherwise they are not recognized as being in the workspace. However, there is no such command for SpotBugs as the links seemed to work at first sight.

      BTW: the plugin should provide a way to relativize the paths for the other tools in future. The tools use absolute paths, there's nothing the users could do about it. Having to trick with sed commands feels nasty, the plugin should be able to deal with that.

      Attachments

        Activity

          drulli Ulli Hafner added a comment -

          Ah, ok. Normally there should be some errors as in https://ci.jenkins.io/job/Plugins/job/warnings-ng-plugin/job/master/860/checkstyle/info/. Seems that this part is missing for your job

          drulli Ulli Hafner added a comment - Ah, ok. Normally there should be some errors as in https://ci.jenkins.io/job/Plugins/job/warnings-ng-plugin/job/master/860/checkstyle/info/ . Seems that this part is missing for your job
          drulli Ulli Hafner added a comment -

          Sorry, forget about the fingerprinting problem: SpotBugs creates Fingerprints on its own so I'm simply skipping that part.

          So we actually have only the problem about the wrong detection of the path due to links.

          drulli Ulli Hafner added a comment - Sorry, forget about the fingerprinting problem: SpotBugs creates Fingerprints on its own so I'm simply skipping that part. So we actually have only the problem about the wrong detection of the path due to links.

          We have the same problem with a freestyle job, links are not clickable, probably due to a symlink from /var/lib/jenkins to /home/jenkins, leading to this

          [SpotBugs] -> 0 copied, 1852 not in workspace, 0 not-found, 0 with I/O error
          

          As a workaround, we currently set the workspace directory for the job to /home/jenkins/jobs/... essentially bypassing the default value /var/lib/jenkins/jobs/...

          capf Carsten Pfeiffer added a comment - We have the same problem with a freestyle job, links are not clickable, probably due to a symlink from /var/lib/jenkins to /home/jenkins, leading to this [SpotBugs] -> 0 copied, 1852 not in workspace, 0 not-found, 0 with I/O error As a workaround, we currently set the workspace directory for the job to /home/jenkins/jobs/... essentially bypassing the default value /var/lib/jenkins/jobs/...
          drulli Ulli Hafner added a comment -

          Another workaround would be to set the actual source directory prefix in parameter sourceDirectories.

          drulli Ulli Hafner added a comment - Another workaround would be to set the actual source directory prefix in parameter sourceDirectories .
          drulli Ulli Hafner added a comment -

          Should work by specifying the source code folder.

          drulli Ulli Hafner added a comment - Should work by specifying the source code folder.

          People

            drulli Ulli Hafner
            thedentist Daniel Kepes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: