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

checkout scm on the agent does not respect git 'Discover other refs' in multibranch pipeline

XMLWordPrintable

      I'm trying to use the git plugin to detect pull requests from my git repository which is located in Azure DevOps

      I'm using the following configuration in Multibranch Pipeline

      it seems that the initial git clone is actually works on the jenkins controller

      Started by user
      Replayed #11
       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to https://dev.azure.com/<account>/<project>/_git/<repo>
       > git config remote.origin.url https://dev.azure.com/<account>/<project>/_git/<repo> # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
       > git --version # 'git version 2.11.0'
       > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress -- origin +refs/heads/*:refs/remotes/origin/* +refs/pull/*/merge:refs/remotes/origin/pull/*/merge # timeout=10
       > git rev-parse refs/pull/74/merge^{commit} # timeout=10
      ERROR: Could not determine exact tip revision of pull/74/merge; falling back to nondeterministic checkout
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] Start of Pipeline
      [Pipeline] library
      Loading library pipeline-library@master
      Attempting to resolve master from remote references...
       > git --version # timeout=10
       > git --version # 'git version 2.11.0'
      using GIT_ASKPASS to set credentials 
       > git ls-remote -h -- https://user@dev.azure.com/<account>/<project>/_git/<repo> # timeout=10
      Found match: refs/heads/master revision eeeacb692d0fc5e23c0c5ba66123fdbf95bbac0d
      The recommended git tool is: NONE
      using credential jenkins-token
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://user@dev.azure.com/<account>/<project>/_git/<repo> # timeout=10
      Fetching without tags
      Fetching upstream changes from https://user@dev.azure.com/<account>/<project>/_git/<repo>
       > git --version # timeout=10
       > git --version # 'git version 2.11.0'
      using GIT_ASKPASS to set credentials 
       > git fetch --no-tags --progress -- https://user@dev.azure.com/<account>/<project>/_git/<repo> +refs/heads/*:refs/remotes/origin/* # timeout=10
      Checking out Revision eeeacb692d0fc5e23c0c5ba66123fdbf95bbac0d (master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f eeeacb692d0fc5e23c0c5ba66123fdbf95bbac0d # timeout=10
      Commit message: "align to pipeline"
       > git rev-list --no-walk eeeacb692d0fc5e23c0c5ba66123fdbf95bbac0d # timeout=10
      

      also in my local PC I can perform git checkout to this PR

      git checkout pull/74/merge
      # output:
      Branch 'pull/74/merge' set up to track remote branch 'pull/74/merge' from 'origin'.
      Switched to a new branch 'pull/74/merge'

       

      But When the jenkins is trying  to perform checkout scm on a different agent (node)

      stage('Generate') {
          node ('linux') {
              checkout scm
          }
      

      or 

      pipeline {
          agent { 
              label 'linux'
          }
          stages {
              stage('Initialize') { 
                steps {
                  checkout scm

      note: in declarative pipeline the jenkins will try automtically to perform checkout scm on the agent node and it will failed too.

      it's getting the following error:

       > git rev-parse --is-inside-work-tree # timeout=10
      Setting origin to https://dev.azure.com/<account>/<project>/_git/<repo>
       > git config remote.origin.url https://dev.azure.com/<account>/<project>/_git/<repo> # timeout=10
      Fetching origin...
      Fetching upstream changes from origin
       > git --version # timeout=10
       > git --version # 'git version 2.11.0'
       > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials 
       > git fetch --tags --progress -- origin +refs/heads/*:refs/remotes/origin/* +refs/pull/*/merge:refs/remotes/origin/pull/*/merge # timeout=10
       > git rev-parse refs/pull/74/merge^{commit} # timeout=10
      [Pipeline] }
      [Pipeline] // script
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // timeout
      [Pipeline] }
      19:08:21  
      [Pipeline] // ansiColor
      [Pipeline] }
      [Pipeline] // timestamps
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: Could not determine exact tip revision of pull/74/merge
      Finished: FAILURE
      

      why the step checkout SCM is not respecting the git Discover other refs?

      another way to workaround this? 

       

            Unassigned Unassigned
            dordor dor s
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: