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

git blame fails for out-of-tree builds

    Details

    • Similar Issues:

      Description

      My pipeline checks out the source code in a separate folder by settings the option 

      skipDefaultCheckout()
      

      and then manually checking out the source into ${ws}/src in the first step via

      stage('Prepare') {
        steps {
          dir('src') {
            checkout scm
          }
        }
      }
      

      Doxygen is then later build in ${ws}/build/doxygen using

      stage('Doxygen') {
        steps {
          dir('build/doxygen') {
            bat '@ninja doxygen' // outputs log into doxygen/doxygen.log
          }
          recordIssues(aggregatingResults: true, enabledForFailure: true, tools: [ doxygen(name: 'Doxygen', pattern: 'build/doxygen/doxygen/doxygen.log') ] )
        }
      }
      

      Warnings the counted correctly but git blame fails with

      [2019-04-27T12:26:27.192Z] [Doxygen] Successfully parsed file C:\workspace\workspace\doxygen0aa3610e\build\doxygen\doxygen\doxygen.log
      [2019-04-27T12:26:27.192Z] [Doxygen] -> found 39 issues (skipped 0 duplicates)
      [2019-04-27T12:26:27.573Z] [Doxygen] [-ERROR-] Can't determine head commit using 'git rev-parse'. Skipping blame.
      [2019-04-27T12:26:27.573Z] [Doxygen] [-ERROR-] hudson.plugins.git.GitException: Command "git rev-parse "HEAD^{commit}"" returned status code 128:
      [2019-04-27T12:26:27.573Z] stdout:
      [2019-04-27T12:26:27.573Z] stderr: fatal: not a git repository (or any of the parent directories): .git
      

      I also reported this in gitter on 27.4 and was asked to create this bug report here.

        Attachments

          Issue Links

            Activity

            Hide
            drulli Ulli Hafner added a comment -

            You need to execute the warnings step within the dir('src') block. Otherwise the warnings plugin has no information about the storage of your source files.

            Show
            drulli Ulli Hafner added a comment - You need to execute the warnings step within the dir('src') block. Otherwise the warnings plugin has no information about the storage of your source files.

              People

              • Assignee:
                drulli Ulli Hafner
                Reporter:
                twam Tobias Müller
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: