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

Autofavouriting breaks first build of a new job/branch

      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

          [JENKINS-39704] Autofavouriting breaks first build of a new job/branch

          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)

           

          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)  

          James Dumay added a comment -

          riusaqua 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?

          James Dumay added a comment - riusaqua 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?

          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

          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

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

          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?

          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

          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

          Michael Neale added a comment -

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

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

          Michael Neale added a comment -

          fixed in latest version 

          Michael Neale added a comment - fixed in latest version 

          Thanks, fix confirmed

          sergey zavadski added a comment - Thanks, fix confirmed

          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

          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

          Michael Neale added a comment -

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

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

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

              Created:
              Updated:
              Resolved: