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

GitSCM sets core.hooksPath to null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • git-plugin
    • None

      Issue

      Impacts: Windows and MacOS agents

      After `checkout scmGit(...)`, the local git config has its core.hooksPath set to a null value.

      • Windows: `nul:`
      • Mac: `/dev/null`

       

      Context

      When updating our jenkins instance, we encountered push operations failing on missing LFS objects. This is because `checkout scmGit()` sets the `core.hooksPath` to a null value. Any downstream git operations will fail. Any jobs that execute on the updated agent will be impacted.

      Because the hooksPath is set to null, post-commit scripts are not executed. This prevents LFS objects from being pushed to the LFS server after a commit command is made.

       

      I'd expect that the local git config file would not be altered in any way when using `checkout scmGit()`. This was not occurring on our previous version of jenkins.

       

      Example Error:
      ```

      git push --set-upstream origin testing/lfs-object-test-branch

      remote: error: GH008: Your push referenced at least 2 unknown Git LFS objects:

      remote: 51656cb5f28a18516c818680274d77a4def5af5a8e6523571b0c4f263b935cc9

      remote: 5e22164b0fcab5cbf5a2da096503ef5967b6a973ac5e7badd296dd23792812e9 

      remote: Try to push them with 'git lfs push --all'. {{ }}
      ```

       

      Snippet

      ```

      bat "git config --list --show-origin" 

      // core.hooksPaths is not defined

      def scmVars = checkout scmGit(  branches: [[name: "refs/heads/testing/lfs-object-test-branch"]],
                                      extensions: [
                                          submodule(parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: true),
                                          pruneTags(true),
                                          pruneStaleBranch(),
                                          cleanBeforeCheckout(deleteUntrackedNestedRepositories: true),
                                          [$class: 'GitSCMStatusChecksExtension', skip: true, skipProgressUpdates: true],
                                          lfs()],
                                      userRemoteConfigs: [[url: repo, credentialsId: '

      {YOUR_GIT_CREDENTIALS_ID}

      ']])
      bat "git config --list --show-origin"

      // crore.hooksPaths is set to `nul:` or `/dev/null` depending on platform.
      ```

            Unassigned Unassigned
            vizionz Julius
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: