-
Bug
-
Resolution: Fixed
-
Minor
-
None
The following DSL code works:
post { always { script { echo 'Scanning workspace for open tasks ...' def openTaskIssues = scanForIssues(defaultScanForIssues << [tool: taskScanner( ignoreCase: true, includePattern: '**/*.gradle, **/*.java, **/*.groovy', lowTags: 'TODO', normalTags: 'FIXME' )]) config.publishIssues.issues << openTaskIssues } } }
using:
- Analysis Model API 7.0.3 and 7.0.4
- Forensics API 0.6.1
- Git Forensics 0.6.0
- Warnings Next Generation 7.3.0
After upgrading to:
- Analysis Model API 8.0.1
- Forensics API 0.7.0
- Git Forensics 0.7.0
- Warnings Next Generation 8.1.0
It is not working anymore. Instead it logs something like
[Open Tasks Scanner] [-ERROR-] Errors while extracting author and commit information from Git:
[Open Tasks Scanner] [-ERROR-] - no blame results for file 'jenkins_pipeline_library_ci/gradle/publish.gradle'
Surrounding the scanForIssues step with
dir(env.STR_WORKSPACE) {
makes it more worse. Then it throws something like
00:02:59.384 [Open Tasks Scanner] [-ERROR-] Errors while extracting author and commit information from Git: 00:02:59.384 [Open Tasks Scanner] [-ERROR-] - error running git blame on 'gradle/publish.gradle' with revision 'AnyObjectId[9280f8d73f91574cc91c660d1d941fe2fc024d7c]' 00:02:59.384 [Open Tasks Scanner] [-ERROR-] org.eclipse.jgit.errors.MissingObjectException: Missing unknown 9280f8d73f91574cc91c660d1d941fe2fc024d7c 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:168) 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:236) 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.blame.BlameGenerator.push(BlameGenerator.java:448) 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.api.BlameCommand.call(BlameCommand.java:211) 00:02:59.384 [Open Tasks Scanner] [-ERROR-] [wrapped] org.eclipse.jgit.api.errors.JGitInternalException: Missing unknown 9280f8d73f91574cc91c660d1d941fe2fc024d7c 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.api.BlameCommand.call(BlameCommand.java:217) 00:02:59.384 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.blame.GitBlamer$BlameRunner.run(GitBlamer.java:255) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.blame.GitBlamer$BlameCallback.run(GitBlamer.java:171) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.blame.GitBlamer$BlameCallback.invoke(GitBlamer.java:134) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.blame.GitBlamer$BlameCallback.invoke(GitBlamer.java:104) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:81) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.blame.GitBlamer.blame(GitBlamer.java:85) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.blame(IssuesScanner.java:285) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:276) 00:02:59.385 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:238) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at hudson.FilePath.act(FilePath.java:1075) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at hudson.FilePath.act(FilePath.java:1058) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner.postProcessReport(IssuesScanner.java:114) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:104) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:189) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:149) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 00:02:59.386 [Open Tasks Scanner] [-ERROR-] at java.lang.Thread.run(Thread.java:748) ... 00:02:59.389 [Open Tasks Scanner] [-ERROR-] Can't analyze history of file gradle/publish.gradle 00:02:59.389 [Open Tasks Scanner] [-ERROR-] org.eclipse.jgit.api.errors.NoHeadException: No HEAD exists and no explicit starting revision was specified 00:02:59.389 [Open Tasks Scanner] [-ERROR-] at org.eclipse.jgit.api.LogCommand.call(LogCommand.java:164) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner$RepositoryStatisticsCallback.analyzeHistory(GitRepositoryMiner.java:126) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner$RepositoryStatisticsCallback.lambda$analyze$0(GitRepositoryMiner.java:115) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner$RepositoryStatisticsCallback.analyze(GitRepositoryMiner.java:116) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner$RepositoryStatisticsCallback.invoke(GitRepositoryMiner.java:95) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner$RepositoryStatisticsCallback.invoke(GitRepositoryMiner.java:69) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:81) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.forensics.git.miner.GitRepositoryMiner.mine(GitRepositoryMiner.java:56) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.mineRepository(IssuesScanner.java:299) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:277) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:238) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at hudson.FilePath.act(FilePath.java:1075) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at hudson.FilePath.act(FilePath.java:1058) 00:02:59.390 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner.postProcessReport(IssuesScanner.java:114) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:104) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:189) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at io.jenkins.plugins.analysis.core.steps.ScanForIssuesStep$Execution.run(ScanForIssuesStep.java:149) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 00:02:59.391 [Open Tasks Scanner] [-ERROR-] at java.lang.Thread.run(Thread.java:748)
For me it looks like that you have changed from absolute path to relative path calculation:
00:02:59.394 [Open Tasks Scanner] Scanning all 41 files for open tasks 00:02:59.394 [Open Tasks Scanner] Found a total of 16 open tasks 00:02:59.394 [Open Tasks Scanner] -> FIXME: 6 open tasks 00:02:59.394 [Open Tasks Scanner] -> TODO: 10 open tasks 00:02:59.394 [Open Tasks Scanner] Post processing issues on 'Master' with source code encoding 'UTF-8' 00:02:59.395 [Open Tasks Scanner] Creating SCM blamer to obtain author and commit information for affected files 00:02:59.395 [Open Tasks Scanner] -> Git blamer successfully created in working tree '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] Creating SCM miner to obtain statistics for affected repository files 00:02:59.395 [Open Tasks Scanner] -> Git miner successfully created in working tree '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] Resolving file names for all issues in source directory '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] -> resolved paths in source directory (5 found, 0 not found) 00:02:59.395 [Open Tasks Scanner] Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files) 00:02:59.395 [Open Tasks Scanner] -> resolved module names for 16 issues 00:02:59.395 [Open Tasks Scanner] Resolving package names (or namespaces) by parsing the affected files 00:02:59.395 [Open Tasks Scanner] -> resolved package names of 5 affected files 00:02:59.395 [Open Tasks Scanner] Applying 2 filters on the set of 16 issues (9 issues have been removed, 7 issues will be published) 00:02:59.395 [Open Tasks Scanner] Creating fingerprints for all affected code blocks to track issues over different builds 00:02:59.395 [Open Tasks Scanner] -> created fingerprints for 7 issues (skipped 0 issues) 00:02:59.395 [Open Tasks Scanner] Invoking Git blamer to create author and commit information for 3 affected files 00:02:59.395 [Open Tasks Scanner] GIT_COMMIT env = 'HEAD' 00:02:59.395 [Open Tasks Scanner] Git commit ID = '9280f8d73f91574cc91c660d1d941fe2fc024d7c' 00:02:59.395 [Open Tasks Scanner] Git working tree = '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] -> blamed authors of issues in 0 files 00:02:59.395 [Open Tasks Scanner] Blaming of authors took 1 seconds 00:02:59.395 [Open Tasks Scanner] Analyzing the commit log of the Git repository '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] Invoking Git miner to create statistics for all available files 00:02:59.395 [Open Tasks Scanner] Git working tree = '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci/jenkins_pipeline_library_ci' 00:02:59.395 [Open Tasks Scanner] -> created statistics for 3 files 00:02:59.395 [Open Tasks Scanner] -> created report for 3 files in 1 seconds 00:02:59.396 [Open Tasks Scanner] Copying affected files to Jenkins' build folder '/var/lib/jenkins/jobs/ACI/jobs/jenkins-pipe.g5vivq.e-library-ci/branches/develop/builds/206/files-with-issues' 00:02:59.396 [Open Tasks Scanner] -> 3 copied, 0 not in workspace, 0 not-found, 0 with I/O error
The path for git blame is correct but for git log is not, see:
"[Open Tasks Scanner] Git working tree = '/var/lib/jenkins/workspace/kins_pipeline_library_ci_develop/jenkins_pipeline_library_ci/jenkins_pipeline_library_ci'"
The strange thing is it works perfectly fine for scripted pipelines with both plugin version 7.x and 8.x:
stage('Analyse Code') { when(['SUCCESS', 'UNSTABLE'].contains(currentBuild.currentResult)) { dir(env.STR_WORKSPACE) { catchError(stageResult: 'FAILURE') { // do somthing here } //post: always logInfo { 'Scanning workspace for open tasks ...' } def openTaskIssues = scanForIssues(defaultScanForIssues << [tool: taskScanner( ignoreCase: true, includePattern: '**/*.gradle, **/*.java, **/*.groovy', lowTags: 'TODO', normalTags: 'FIXME' )]) config.publishIssues.issues << openTaskIssues } } }
- relates to
-
JENKINS-64280 Add a subdirectory option to find the root folder of the SCM
- Resolved