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

Jenkins multibranch pipeline's "Fetching origin" obtains outdated Jenkinsfile

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None

      We are observing a issue never encountered before when setting up a new multibranch pipeline and pointing it to git repository and Jenkinsfile within that.

      Everything looks fine at first, the master branch is found and listed and the project successfully builds. But at a closer look, the Jenkinsfile gets retrieved from a very outdated revision, almost 2 years old.

      16:38:24  Setting origin to https://example.com/bitbucket/scm/myproj/myrepo.git
      16:38:24  Fetching origin...
      16:38:33  Obtained tools/jenkins/Jenkinsfile from f10313a3d583e2a3e640e51cee42b259f456d919
      

      The revision 'f10313a3d583e2a3e640e51cee42b259f456d919' that gets logged here in fact exists. But why did Jenkins return this old revision and not the latest one? And what exactly is Jenkins doing when "Fetching origin"?

      Our version of Jenkins is 2.249.1 and we use Git plugin version 4.4.4

      Regards
      Dominik

          [JENKINS-67920] Jenkins multibranch pipeline's "Fetching origin" obtains outdated Jenkinsfile

          Mark Waite added a comment -

          Asking a behavior question in an issue report will not get as many responses as if you were to ask the question in a more broadly read forum like the Jenkins community forum or the Jenkins user mailing list.

          Asking a behavior question with a Jenkins version released 18 months ago and a git plugin version released 18 months ago will get less attention than if you confirm that the same problem can be seen with current releases.

          Some questions that may help you guide your search for an answer:

          • Is there a tag in the repository at that specific version?
          • Is there a job configuration that is referring to that commit?
          • Is there a Pipeline shared library that might be altering the behavior?
          • If you create a copy of the multibranch job, does the copy behave in the same way?
          • Does the same behavior happen on multiple branches or only on one branch?
          • Does the same behavior happen with the current release of Jenkins and the current release of the git plugin?

          Mark Waite added a comment - Asking a behavior question in an issue report will not get as many responses as if you were to ask the question in a more broadly read forum like the Jenkins community forum or the Jenkins user mailing list. Asking a behavior question with a Jenkins version released 18 months ago and a git plugin version released 18 months ago will get less attention than if you confirm that the same problem can be seen with current releases. Some questions that may help you guide your search for an answer: Is there a tag in the repository at that specific version? Is there a job configuration that is referring to that commit? Is there a Pipeline shared library that might be altering the behavior? If you create a copy of the multibranch job, does the copy behave in the same way? Does the same behavior happen on multiple branches or only on one branch? Does the same behavior happen with the current release of Jenkins and the current release of the git plugin?

          Hi markewaite

          Thanks a lot for taking your time to answer in so much detail even though I may have picked the wrong channel of communication. Before I try reproducing the issue in a more up-to-date Jenkins, here are the answers to your questions:

          • Is there a tag in the repository at that specific version? -> no, its actually a commit
          • Is there a job configuration that is referring to that commit? -> no, just pom.xml updates
          • Is there a Pipeline shared library that might be altering the behavior? -> all other pipelines using same lib, but all other jobs work fine
          • If you create a copy of the multibranch job, does the copy behave in the same way? -> yes, did it and failed too
          • Does the same behavior happen on multiple branches or only on one branch? -> with another branch the same, error a little different:
          13:20:00 Setting origin to https://example.com/bitbucket/scm/myproj/myrepo.git
          13:20:00 Fetching origin...
          13:20:05 ERROR: Could not determine exact tip revision of feature/ABC-123; falling back to nondeterministic checkout
          

          Best regards
          Dominik

          Dominik Kaspar added a comment - Hi markewaite Thanks a lot for taking your time to answer in so much detail even though I may have picked the wrong channel of communication. Before I try reproducing the issue in a more up-to-date Jenkins, here are the answers to your questions: Is there a tag in the repository at that specific version?  -> no, its actually a commit Is there a job configuration that is referring to that commit? - > no, just pom.xml updates Is there a Pipeline shared library that might be altering the behavior?  -> all other pipelines using same lib, but all other jobs work fine If you create a copy of the multibranch job, does the copy behave in the same way? - > yes, did it and failed too Does the same behavior happen on multiple branches or only on one branch?  -> with another branch the same, error a little different: 13:20:00 Setting origin to https://example.com/bitbucket/scm/myproj/myrepo.git 13:20:00 Fetching origin... 13:20:05 ERROR: Could not determine exact tip revision of feature/ABC-123; falling back to nondeterministic checkout Best regards Dominik

          I have now created a copy of our multibranch pipeline on a identical fresh Jenkins installation (also Jenkins 2.249.1 and Git plugin 4.4.4). And interestingly, the problem doesn't exist there. The very latest state of the Jenkinsfile is obtained after "Fetching origin". 

          Dominik Kaspar added a comment - I have now created a copy of our multibranch pipeline on a identical fresh Jenkins installation (also Jenkins 2.249.1 and Git plugin 4.4.4). And interestingly, the problem doesn't exist there. The very latest state of the Jenkinsfile is obtained after "Fetching origin". 

          After deleting all git-<hash> directories in $JENKINS_HOME/caches/, the issue disappeared...

          Dominik Kaspar added a comment - After deleting all git-<hash> directories in $JENKINS_HOME/caches/ , the issue disappeared...

            Unassigned Unassigned
            dokaspar Dominik Kaspar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: