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

determining blame via git fails with out-off-tree builds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • warnings-ng-plugin
    • None
    • Jenkins ver. 2.150.1
      Warnings Next Generation Plugin 1.0.1

      My pipeline uses the standard checkout scm to fetch sources from git with

      options {
        checkoutToSubdirectory('code')
      }
      

      The build step uses a directory called 'build98' to generate its output:

      steps {
        script {
          dir(builder98.workingDir) {
            sh 'VERBOSE=true' + builder98.command + 'build98'
          }
        }
      }
      always {
        script {
          issuesBuild98 = scanForIssues(
            tool: [
              $class: 'Gcc4',
              pattern: "build98/build.ninja.log"
            ]
          )
        }
      }
      

      However, the build fails producing the following stack trace:

      Searching for all files in '/home/jenkins/workspace/my-project' that match the pattern 'build98/build.ninja.log'
      -> found 1 file
      Successfully parsed file /home/jenkins/workspace/my-project/build98/build.ninja.log
      -> found 3 issues (skipped 0 duplicates)
      [ERROR] Can't determine head commit using 'git rev-parse'. Skipping blame.
      [ERROR] hudson.plugins.git.GitException: Command "git rev-parse HEAD^{commit}" returned status code 128:t repository (or any of the parent directories): .git[ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2038)
      [ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)
      [ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
      [ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1634)
      [ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1646)
      [ERROR] 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:831)
      [ERROR] 	at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
      [ERROR] 	at io.jenkins.plugins.analysis.core.scm.GitBlamer.blame(GitBlamer.java:64)
      [ERROR] 	at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:137)
      [ERROR] 	at io.jenkins.plugins.analysis.core.steps.IssuesScanner$ReportPostProcessor.invoke(IssuesScanner.java:105)
      [ERROR] 	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3086)
      [ERROR] 	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      [ERROR] 	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      [ERROR] 	at hudson.remoting.Request$2.run(Request.java:369)
      [ERROR] 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      [ERROR] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      [ERROR] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      [ERROR] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      [ERROR] 	at java.lang.Thread.run(Thread.java:748)
      Post processing issues on 'vulkanbraeu-docker-dc47f0d96d1c' with encoding 'UTF-8'
      Resolving absolute file names for all issues
      -> 0 resolved, 0 unresolved, 1 already resolved
      Copying affected files to Jenkins' build folder /var/lib/jenkins/builds/my-project/40
      -> 1 copied, 0 not in workspace, 0 not-found, 0 with I/O error
      Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)
      -> resolved module names for 3 issues
      Resolving package names (or namespaces) by parsing the affected files
      -> resolved package names of 1 affected files
      No filter has been set, publishing all 3 issues
      Creating fingerprints for all affected code blocks to track issues over different builds
      -> created fingerprints for 3 issues
      Invoking Git blamer to create author and commit information for all affected files
      GIT_COMMIT env = 'HEAD'
      Git working tree = '/home/jenkins/workspace/my-project'
      ...
      ERROR: script returned exit code 254
      Finished: FAILURE
      

      As a workaround, I'm currently running the 'scanForIssues' step from within the source folder after putting a symbolic link to the build tree there, in order for the plugin to be able to find the log file.

            drulli Ulli Hafner
            kracher Holger Berg
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: