[JIRA] (JENKINS-62198) Warnings Next Generation: Links not created for SpotBugs

129 views
Skip to first unread message

d.kepes@web.de (JIRA)

unread,
May 7, 2020, 3:25:03 AM5/7/20
to jenkinsc...@googlegroups.com
Daniel Kepes created an issue
 
Jenkins / Bug JENKINS-62198
Warnings Next Generation: Links not created for SpotBugs
Issue Type: Bug Bug
Assignee: Ulli Hafner
Components: warnings-ng-plugin
Created: 2020-05-07 07:24
Environment: Jenkins ver. 2.223, Warnings Next Generation Plugin 8.1.0
Labels: plugins jenkins pipeline
Priority: Minor Minor
Reporter: Daniel Kepes

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.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

ullrich.hafner@gmail.com (JIRA)

unread,
May 7, 2020, 3:46:03 AM5/7/20
to jenkinsc...@googlegroups.com
Ulli Hafner commented on Bug JENKINS-62198
 
Re: Warnings Next Generation: Links not created for SpotBugs

The plugin is reporting errors in the console log (or in the view http://localhost:8080/job/[job-name]/[build-number]/spotbugs/info/). What is shown there?

ullrich.hafner@gmail.com (JIRA)

unread,
May 7, 2020, 3:48:02 AM5/7/20
to jenkinsc...@googlegroups.com

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.

The plugin automatically creates relative paths, there is nothing you should care about. What exactly is not working with the other tools?

d.kepes@web.de (JIRA)

unread,
May 7, 2020, 4:14:02 AM5/7/20
to jenkinsc...@googlegroups.com

As of SpotBugs, the log gives the following information:

[SpotBugs] Searching for all files in '[PATH_TO_JENKINS]/jobs/KR1-ScnDrv-NG-Codeanalyse_Tmp/workspace' that match the pattern 'target/spotbugsXml.xml'
[SpotBugs] -> found 1 file
[SpotBugs] Successfully parsed file [PATH_TO_JENKINS]/jobs/KR1-ScnDrv-NG-Codeanalyse_Tmp/workspace/target/spotbugsXml.xml
[SpotBugs] -> found 21 issues (skipped 0 duplicates)
[SpotBugs] Post processing issues on 'Master' with source code encoding 'UTF-8'
[SpotBugs] Creating SCM blamer to obtain author and commit information for affected files
[SpotBugs] Creating SCM miner to obtain statistics for affected repository files
[SpotBugs] Resolving file names for all issues in source directory '[PATH_TO_JENKINS]/jobs/KR1-ScnDrv-NG-Codeanalyse_Tmp/workspace/src/main/java'
[SpotBugs] -> resolved paths in source directory (6 found, 0 not found)
[SpotBugs] Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)
[SpotBugs] -> all issues already have a valid module name
[SpotBugs] Resolving package names (or namespaces) by parsing the affected files
[SpotBugs] -> all affected files already have a valid package name
[SpotBugs] No filter has been set, publishing all 21 issues
[SpotBugs] Creating fingerprints for all affected code blocks to track issues over different builds
[SpotBugs] -> created fingerprints for 0 issues (skipped 21 issues)
[SpotBugs] Copying affected files to Jenkins' build folder '[PATH_TO_JENKINS]/jobs/KR1-ScnDrv-NG-Codeanalyse_Tmp/builds/5/files-with-issues'
[SpotBugs] -> 0 copied, 21 not in workspace, 0 not-found, 0 with I/O error

I have censored the path to the jenkins home, there doesn't seem to be anything wrong with it anyways. So, there doesn't seem to be anything wrong to me until the last line where it states that there were no files copied, but 21 were outside the workspace. But I can go through the workspace from jenkins and the files are there.

Using your URL pattern, I get rerouted to the builds home. Nothing special there, just a summary about the git revision, the analysis tools used and a link to the warnings report.

Regarding the other bugs, the problems were similar, the logs also stated that the files would not be in the workspace. But as I figured out that those tools use absolute paths in contrast to spotbugs (which gives only the packages and class names), I tested around with relative paths and then I got the links working.

Maybe a short hint to avoid misunderstandings: I get the report about the warnings and all the warnings / issues are there but when I am on the lowest level and try to look at the code, there is only the name of the file and the linenumber of the issue, without a link I could follow.

Reply all
Reply to author
Forward
0 new messages