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

Project checkout fails (ERROR: Could not determine exact tip revision of master)

    XMLWordPrintable

Details

    Description

      Our Jenkins started failing projects at the beginning of the year, our workaround was to limit the following plugin versions

      workflow-multibranch 2.9
      workflow-aggregator 2.4

      It is working since this limitation, but we would like to use the latest plugin versions

       

      The Error was

      ERROR: Could not determine exact tip revision of master; falling back to nondeterministic checkout
      [...]
      Checking out Revision cec453d87cd2717fd4a392e2813b45d1c929b706 (origin/master)
      [...]
      Caught: hudson.AbortException: Could not determine exact tip revision of master
      [...]
      Caught: hudson.AbortException: Could not determine exact tip revision of master
      [...]
      ERROR: Could not determine exact tip revision of master

      -JENKINS-40862- Seems to be similar but was closed as "Incomplete"

      Attachments

        Issue Links

          Activity

            sag47 Sam Gleske added a comment -

            I would like to point out that this plugin is attempting to resolve the tip of my "jervis_simple" branch (as it should because I am building the jervis_simple branch) but for some reason is flailing about with the tip of master branch.

            Started by user Sam Gleske
            Running in Durability level: MAX_SURVIVABILITY
            Loading library Jervis Global Library@master
            Attempting to resolve master from remote references...
             > git --version # timeout=10
            using GIT_ASKPASS to set credentials GitHub user and personal access token used by multibranch pipeline jobs for the GitHub API
             > git ls-remote -h -t https://github.com/samrocketman/jervis.git # timeout=10
            Found match: refs/heads/master revision a82c0668ab31f0c992d26575e415971648c5c185
             > git rev-parse --is-inside-work-tree # timeout=10
            Fetching changes from the remote Git repository
             > git config remote.origin.url https://github.com/samrocketman/jervis.git # timeout=10
            Fetching without tags
            Fetching upstream changes from https://github.com/samrocketman/jervis.git
             > git --version # timeout=10
            using GIT_ASKPASS to set credentials GitHub user and personal access token used by multibranch pipeline jobs for the GitHub API
             > git fetch --no-tags --progress https://github.com/samrocketman/jervis.git +refs/heads/*:refs/remotes/origin/*
            Checking out Revision a82c0668ab31f0c992d26575e415971648c5c185 (master)
             > git config core.sparsecheckout # timeout=10
             > git checkout -f a82c0668ab31f0c992d26575e415971648c5c185
            Commit message: "bump to snapshot"
             > git rev-list --no-walk a82c0668ab31f0c992d26575e415971648c5c185 # timeout=10
            [Pipeline] End of Pipeline
            ERROR: Could not determine exact tip revision of jervis_simple
            Finished: FAILURE
            
            sag47 Sam Gleske added a comment - I would like to point out that this plugin is attempting to resolve the tip of my "jervis_simple" branch (as it should because I am building the jervis_simple branch) but for some reason is flailing about with the tip of master branch. Started by user Sam Gleske Running in Durability level: MAX_SURVIVABILITY Loading library Jervis Global Library@master Attempting to resolve master from remote references... > git --version # timeout=10 using GIT_ASKPASS to set credentials GitHub user and personal access token used by multibranch pipeline jobs for the GitHub API > git ls-remote -h -t https://github.com/samrocketman/jervis.git # timeout=10 Found match: refs/heads/master revision a82c0668ab31f0c992d26575e415971648c5c185 > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/samrocketman/jervis.git # timeout=10 Fetching without tags Fetching upstream changes from https://github.com/samrocketman/jervis.git > git --version # timeout=10 using GIT_ASKPASS to set credentials GitHub user and personal access token used by multibranch pipeline jobs for the GitHub API > git fetch --no-tags --progress https://github.com/samrocketman/jervis.git +refs/heads/*:refs/remotes/origin/* Checking out Revision a82c0668ab31f0c992d26575e415971648c5c185 (master) > git config core.sparsecheckout # timeout=10 > git checkout -f a82c0668ab31f0c992d26575e415971648c5c185 Commit message: "bump to snapshot" > git rev-list --no-walk a82c0668ab31f0c992d26575e415971648c5c185 # timeout=10 [Pipeline] End of Pipeline ERROR: Could not determine exact tip revision of jervis_simple Finished: FAILURE

            This looks to be the exact situation of the second case I describe in https://issues.jenkins-ci.org/browse/JENKINS-48571?focusedCommentId=329111&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-329111

            Namely the Job DSL plugin is being used to configure a branch source that has a null id. You must provide an ID: https://github.com/samrocketman/jervis/blob/b25af324cce229255fd34c9070f32da4d0d8b393/jobs/jenkins_job_multibranch_pipeline.groovy#L38-L52

            Change

                                github {
                                    //github
                                    credentialsId 'github-user-and-token'
                                    repoOwner project_folder
                                    repository project_name
                                    //behaviors not supported by job dsl
            
                                    //additional behaviors
                                    traits {
                                        headWildcardFilterWithPR {
                                            includes "${JERVIS_BRANCH}"
                                            excludes ''
                                        }
                                    }
                                }
            

            to

                                github {
                                    //github
                                    id 'anything-does-not-matter-as-only-one-source-configured'
                                    credentialsId 'github-user-and-token'
                                    repoOwner project_folder
                                    repository project_name
                                    //behaviors not supported by job dsl
            
                                    //additional behaviors
                                    traits {
                                        headWildcardFilterWithPR {
                                            includes "${JERVIS_BRANCH}"
                                            excludes ''
                                        }
                                    }
                                }
            

            And the problem should go away.

            sag47 can you confirm the above?

            stephenconnolly Stephen Connolly added a comment - This looks to be the exact situation of the second case I describe in https://issues.jenkins-ci.org/browse/JENKINS-48571?focusedCommentId=329111&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-329111 Namely the Job DSL plugin is being used to configure a branch source that has a null id. You must provide an ID: https://github.com/samrocketman/jervis/blob/b25af324cce229255fd34c9070f32da4d0d8b393/jobs/jenkins_job_multibranch_pipeline.groovy#L38-L52 Change github { //github credentialsId 'github-user-and-token' repoOwner project_folder repository project_name //behaviors not supported by job dsl //additional behaviors traits { headWildcardFilterWithPR { includes "${JERVIS_BRANCH}" excludes '' } } } to github { //github id 'anything-does-not-matter-as-only-one-source-configured' credentialsId 'github-user-and-token' repoOwner project_folder repository project_name //behaviors not supported by job dsl //additional behaviors traits { headWildcardFilterWithPR { includes "${JERVIS_BRANCH}" excludes '' } } } And the problem should go away. sag47 can you confirm the above?
            sag47 Sam Gleske added a comment -

            Thanks for the pointer, I will make the change to test.  I'm glad my projects are open source so you are able to inspect it and give me pointers stephenconnolly.  I will report back my results.

            sag47 Sam Gleske added a comment - Thanks for the pointer, I will make the change to test.  I'm glad my projects are open source so you are able to inspect it and give me pointers stephenconnolly .  I will report back my results.
            sag47 Sam Gleske added a comment -

            stephenconnolly your suggestion appears to have fixed the issue.

            Fixed by https://github.com/samrocketman/jervis/commit/e4cd6324ff22c3593d7e6feab88dff79e516e14b

            I'll do some more testing but it now appears to work reliably.

            Required

            After making the change from stephenconnolly's suggestion I had to click "Scan Repository Now".  The problem continued to be broken until I scanned the repository for branches.

            Results (the fixed flow)

            The following flow is how I reproduced reliably and confirmed the fix.

            1. Bootstrapped Jenkins with vagrant
            2. Generated a multibranch pipeline for samrocketman/jervis project.
            3. Clicked "Scan repository Now" so branches would be detected.
            4. Clicked "Build now" on the jervis_simple branch.  This always succeeded the first time.
            5. Log into Jenkins and restart it.  /etc/init.d/jenkins stop; /etc/init.d/jenkins start
            6. Visit the jervis job and click "Build now" (the ERROR used to occur here every time with this flow; clicking build repeatedly and restarting Jenkins did not help and caused the same failure every time)

            After the fix, step 6 above now always works and I no longer encounter the error.  I will test further to be absolutely sure it's fixed.  Thanks Stephen!

            sag47 Sam Gleske added a comment - stephenconnolly your suggestion appears to have fixed the issue. Fixed by https://github.com/samrocketman/jervis/commit/e4cd6324ff22c3593d7e6feab88dff79e516e14b I'll do some more testing but it now appears to work reliably. Required After making the change from stephenconnolly 's suggestion I had to click "Scan Repository Now".  The problem continued to be broken until I scanned the repository for branches. Results (the fixed flow) The following flow is how I reproduced reliably and confirmed the fix. Bootstrapped Jenkins with vagrant Generated a multibranch pipeline for samrocketman/jervis project. Clicked "Scan repository Now" so branches would be detected. Clicked "Build now" on the jervis_simple branch.  This always succeeded the first time. Log into Jenkins and restart it.  /etc/init.d/jenkins stop; /etc/init.d/jenkins start Visit the jervis job and click "Build now" (the ERROR used to occur here every time with this flow; clicking build repeatedly and restarting Jenkins did not help and caused the same failure every time) After the fix, step 6 above now always works and I no longer encounter the error.  I will test further to be absolutely sure it's fixed.  Thanks Stephen!
            michaelneale Michael Neale added a comment -

            great - I might close this as a duplicate, but sag47's comment above is handy! thanks

            michaelneale Michael Neale added a comment - great - I might close this as a duplicate, but sag47 's comment above is handy! thanks

            People

              Unassigned Unassigned
              gsteinmetz Georg Steinmetz
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: