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

WorkflowJob not reliably started from ReverseBuildTrigger after restart

      Pipeline projects are sometimes not triggered when using Build after other projects are built -> Projects to watch under a restart.

      To re-produce the issue, you need to create three projects:

      • test-a: simple freestyle project without anything
      • test-b: pipeline-project with Build after other projects are built -> Projects to watch: test-a
      • test-c: simple freestyle project with Build after other projects are built -> Projects to watch: test-a

      Then, without the build-failure-analyzer plugin installed build several times test-a and you see that test-b and test-c are correctly triggered. Restart the instance several times and re-test - everything works.

      Now, install build-failure-analyzer plugin - latest release or previous ones as I can re-produce with several ones - restart the instance and build test-a, now test-b might not be triggered. If it is triggered, restart the instance and build test-a until test-b doesn't get triggered.

      I did the effort of change on the code all AbstractBuild per Run and AbstractProject per Job on the buildAnalizer plugin, but the problem is still reproducible.

          [JENKINS-33971] WorkflowJob not reliably started from ReverseBuildTrigger after restart

          Félix Belzunce Arcos created issue -
          Félix Belzunce Arcos made changes -
          Assignee Original: Félix Belzunce Arcos [ fbelzunc ] New: Tomas Westling [ t_westling ]
          Félix Belzunce Arcos made changes -
          Labels New: pipeline
          Jesse Glick made changes -
          Labels Original: pipeline New: workflow
          Jesse Glick made changes -
          Assignee Original: Tomas Westling [ t_westling ] New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jesse Glick added a comment -

          Do not know yet what the contribution of build-failure-analyzer might be—perhaps merely timing—but a debugger confirms that AbstractFolder.getItem(String), from ReverseBuildTrigger.start, is returning null for a valid item name (the upstream test-a) because at this point during startup, items is still null.

          "Loading job JENKINS-33971-ReverseBuildTrigger/a"
          	at com.cloudbees.hudson.plugins.folder.AbstractFolder.getItem(AbstractFolder.java:573)
          	at com.cloudbees.hudson.plugins.folder.AbstractFolder.getItem(AbstractFolder.java:112)
          	at jenkins.model.Jenkins.getItem(Jenkins.java:2532)
          	at jenkins.model.Jenkins.getItem(Jenkins.java:2555)
          	at hudson.model.Items.fromNameList(Items.java:191)
          	at jenkins.triggers.ReverseBuildTrigger.start(ReverseBuildTrigger.java:154)
          	at jenkins.triggers.ReverseBuildTrigger.start(ReverseBuildTrigger.java:85)
          	at org.jenkinsci.plugins.workflow.job.WorkflowJob.onLoad(WorkflowJob.java:139)
          	at hudson.model.Items.load(Items.java:327)
          	at hudson.model.ItemGroupMixIn.loadChildren(ItemGroupMixIn.java:113)
          	at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:271)
          	at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
          	at hudson.model.Items.load(Items.java:327)
          	at jenkins.model.Jenkins$18.run(Jenkins.java:2807)
          	at …
          

          Freestyle projects do not show the bug simply because they are not using upstream2Trigger.

          Jesse Glick added a comment - Do not know yet what the contribution of build-failure-analyzer might be—perhaps merely timing—but a debugger confirms that AbstractFolder.getItem(String) , from ReverseBuildTrigger.start , is returning null for a valid item name (the upstream test-a ) because at this point during startup, items is still null. "Loading job JENKINS-33971-ReverseBuildTrigger/a" at com.cloudbees.hudson.plugins.folder.AbstractFolder.getItem(AbstractFolder.java:573) at com.cloudbees.hudson.plugins.folder.AbstractFolder.getItem(AbstractFolder.java:112) at jenkins.model.Jenkins.getItem(Jenkins.java:2532) at jenkins.model.Jenkins.getItem(Jenkins.java:2555) at hudson.model.Items.fromNameList(Items.java:191) at jenkins.triggers.ReverseBuildTrigger.start(ReverseBuildTrigger.java:154) at jenkins.triggers.ReverseBuildTrigger.start(ReverseBuildTrigger.java:85) at org.jenkinsci.plugins.workflow.job.WorkflowJob.onLoad(WorkflowJob.java:139) at hudson.model.Items.load(Items.java:327) at hudson.model.ItemGroupMixIn.loadChildren(ItemGroupMixIn.java:113) at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:271) at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104) at hudson.model.Items.load(Items.java:327) at jenkins.model.Jenkins$18.run(Jenkins.java:2807) at … Freestyle projects do not show the bug simply because they are not using upstream2Trigger .
          Jesse Glick made changes -
          Component/s New: cloudbees-folder-plugin [ 18137 ]
          Component/s Original: build-failure-analyzer-plugin [ 17224 ]
          Jesse Glick made changes -
          Summary Original: Pipeline projects are sometimes not triggered when using Build after other projects are built -> Projects to watch New: WorkflowJob not reliably started from ReverseBuildTrigger after restart

          Jesse Glick added a comment -

          Hmm, but then I could also reproduce at root level (no folders), so it seems Jenkins.getItem(String) can suffer from the same issue.

          Jesse Glick added a comment - Hmm, but then I could also reproduce at root level (no folders), so it seems Jenkins.getItem(String) can suffer from the same issue.
          Jesse Glick made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: cloudbees-folder-plugin [ 18137 ]

            jglick Jesse Glick
            fbelzunc Félix Belzunce Arcos
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: