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

Autofavouriting breaks first build of a new job/branch

    Details

    • Epic Link:
    • Similar Issues:

      Description

      When a new branch is discovered by multibranch, it fails due to a missing commit (which is actually there in github). Re-running the build subsequently fixes this.

      The stack trace should be informative (this is from the job: https://ci.blueocean.io/job/blueocean/job/bug%252FJENKINS-39627-buttonbarlayout/1/console):

      GitHub has been notified of this commit’s build result
      
      hudson.plugins.git.GitException: org.eclipse.jgit.errors.MissingObjectException: Missing commit afbbb05dc881da89e63c5901e94f333deaeaf020
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl$4.includes(JGitAPIImpl.java:1020)
      	at io.jenkins.blueocean.autofavorite.FavoritingScmListener.onCheckout(FavoritingScmListener.java:58)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:123)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:83)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:73)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
      	at hudson.security.ACL.impersonate(ACL.java:213)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing commit afbbb05dc881da89e63c5901e94f333deaeaf020
      	at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:159)
      	at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes(RevWalk.java:903)
      	at org.eclipse.jgit.revwalk.RevCommit.parseHeaders(RevCommit.java:155)
      	at org.eclipse.jgit.revwalk.RevWalk.markStart(RevWalk.java:293)
      	at org.jenkinsci.plugins.gitclient.JGitAPIImpl$4.includes(JGitAPIImpl.java:1016)
      	... 12 more
      Finished: FAILURE
      

      Yay for dogfooding for picking this up

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Dumay
            Path:
            src/main/java/io/jenkins/blueocean/autofavorite/FavoritingScmListener.java
            http://jenkins-ci.org/commit/blueocean-autofavorite-plugin/57cd6bdbf44fcc8175ec64b512b7457f44c69b80
            Log:
            JENKINS-39704 retry fetching the changeset when the repository appears inconsistent

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Dumay Path: src/main/java/io/jenkins/blueocean/autofavorite/FavoritingScmListener.java http://jenkins-ci.org/commit/blueocean-autofavorite-plugin/57cd6bdbf44fcc8175ec64b512b7457f44c69b80 Log: JENKINS-39704 retry fetching the changeset when the repository appears inconsistent
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James William Dumay
            Path:
            src/main/java/io/jenkins/blueocean/autofavorite/FavoritingScmListener.java
            http://jenkins-ci.org/commit/blueocean-autofavorite-plugin/15db351ef5948cd9e9f7bb65e14b4a1e6d7b913f
            Log:
            JENKINS-39704 retry fetching the changeset when the repository appears inconsistent (#2)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James William Dumay Path: src/main/java/io/jenkins/blueocean/autofavorite/FavoritingScmListener.java http://jenkins-ci.org/commit/blueocean-autofavorite-plugin/15db351ef5948cd9e9f7bb65e14b4a1e6d7b913f Log: JENKINS-39704 retry fetching the changeset when the repository appears inconsistent (#2)
            Hide
            jamesdumay James Dumay added a comment -

            Released 0.3 that attempts to fix this.

            Show
            jamesdumay James Dumay added a comment - Released 0.3 that attempts to fix this.
            Hide
            riusaqua sergey zavadski added a comment - - edited

            Still  happening when new branch is built in multibranch pipeline

             

            this is what in the bottom of my blue ocean dashboard:

            1.3.5 · Core 2.99 · b09ca18 · 11th December 2017 10:11 PM

             

            After initial build fails succeeding builds run as usual

             

            let me know if you need anything else

             

            exception stack trace:

             

            java.lang.NullPointerException at io.jenkins.blueocean.autofavorite.FavoritingScmListener.onCheckout(FavoritingScmListener.java:109) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:127) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:274) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE

            Show
            riusaqua sergey zavadski added a comment - - edited Still  happening when new branch is built in multibranch pipeline   this is what in the bottom of my blue ocean dashboard: 1.3.5 · Core 2.99 · b09ca18 · 11th December 2017 10:11 PM   After initial build fails succeeding builds run as usual   let me know if you need anything else   exception stack trace:   java.lang.NullPointerException at io.jenkins.blueocean.autofavorite.FavoritingScmListener.onCheckout(FavoritingScmListener.java:109) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:127) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:274) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
            Hide
            riusaqua sergey zavadski added a comment -

            Is there a workaround for this?

            This issue renders blue ocean, that is otherwise awesome, completely useless, as any new  pull request build fails (we are using multibranchworkflow project as a top level folder)

             

            Show
            riusaqua sergey zavadski added a comment - Is there a workaround for this? This issue renders blue ocean, that is otherwise awesome, completely useless, as any new  pull request build fails (we are using multibranchworkflow project as a top level folder)  
            Hide
            jamesdumay James Dumay added a comment -

            sergey zavadski does it actually fail the first run? This code is incredibly defensive - you should receive logging warnings but never a failed run. What version of the plugin are you on?

            Show
            jamesdumay James Dumay added a comment - sergey zavadski does it actually fail the first run? This code is incredibly defensive - you should receive logging warnings but never a failed run. What version of the plugin are you on?
            Hide
            riusaqua sergey zavadski added a comment -

            yes, it fails every first build of a  branch   it has not seen (in a multibranch pipeline project with github  as scm), with the exception trace that has been posted above

            this is what in the bottom of my blue ocean dashboard:

            1.3.5 · Core 2.99 · b09ca18 · 11th December 2017 10:11 PM

            let me know if you need anything else

            Show
            riusaqua sergey zavadski added a comment - yes, it fails every first build of a  branch   it has not seen (in a multibranch pipeline project with github  as scm), with the exception trace that has been posted above this is what in the bottom of my blue ocean dashboard: 1.3.5 · Core 2.99 · b09ca18 · 11th December 2017 10:11 PM let me know if you need anything else
            Hide
            riusaqua sergey zavadski added a comment -

            Is there any workaround for this? Perhaps some groovy script that can be executed through script console to disable this feature?

            Show
            riusaqua sergey zavadski added a comment - Is there any workaround for this? Perhaps some groovy script that can be executed through script console to disable this feature?
            Hide
            riusaqua sergey zavadski added a comment -

            I see this in autofavoriting code:

            {{ // If the user has disabled auto-favoriting then we should bail out}}
            {{ if (!FavoritingUserProperty.from(author).isAutofavoriteEnabled()) {}}
            {{ return;}}
            {{ }}}

            How do I disable autofavoriting? I see no configuration options in Jenkins configuration UI

            Show
            riusaqua sergey zavadski added a comment - I see this in autofavoriting code: {{ // If the user has disabled auto-favoriting then we should bail out}} {{ if (!FavoritingUserProperty.from(author).isAutofavoriteEnabled()) {}} {{ return;}} {{ }}} How do I disable autofavoriting? I see no configuration options in Jenkins configuration UI
            Hide
            michaelneale Michael Neale added a comment -

            sergey zavadski -DBLUEOCEAN_FEATURE_AUTOFAVORITE_ENABLED=false  will disable it when you start up (if you have the latest autofav plugin installed - which you may not)

            Show
            michaelneale Michael Neale added a comment - sergey zavadski   -DBLUEOCEAN_FEATURE_AUTOFAVORITE_ENABLED=false   will disable it when you start up (if you have the latest autofav plugin installed - which you may not)
            Hide
            michaelneale Michael Neale added a comment -

            fixed in latest version 

            Show
            michaelneale Michael Neale added a comment - fixed in latest version 
            Hide
            riusaqua sergey zavadski added a comment -

            Thanks, fix confirmed

            Show
            riusaqua sergey zavadski added a comment - Thanks, fix confirmed
            Hide
            riusaqua sergey zavadski added a comment -

            FYI:  after adding this flag to startup options autoscrolling of shell output in pipeline steps stopped working. It is not as critical as the initial issue though

            Show
            riusaqua sergey zavadski added a comment - FYI:  after adding this flag to startup options autoscrolling of shell output in pipeline steps stopped working. It is not as critical as the initial issue though
            Hide
            michaelneale Michael Neale added a comment -

            sergey zavadski that wouldn't be related at all other than by coincidence with some other glitch. 

            Show
            michaelneale Michael Neale added a comment - sergey zavadski that wouldn't be related at all other than by coincidence with some other glitch. 

              People

              • Assignee:
                jamesdumay James Dumay
                Reporter:
                michaelneale Michael Neale
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: