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

WorkflowJob not reliably started from ReverseBuildTrigger after restart

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            fbelzunc Félix Belzunce Arcos created issue -
            fbelzunc Félix Belzunce Arcos made changes -
            Field Original Value New Value
            Assignee Félix Belzunce Arcos [ fbelzunc ] Tomas Westling [ t_westling ]
            fbelzunc Félix Belzunce Arcos made changes -
            Labels pipeline
            jglick Jesse Glick made changes -
            Labels pipeline workflow
            jglick Jesse Glick made changes -
            Assignee Tomas Westling [ t_westling ] Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            jglick 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.

            Show
            jglick 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 .
            jglick Jesse Glick made changes -
            Component/s cloudbees-folder-plugin [ 18137 ]
            Component/s build-failure-analyzer-plugin [ 17224 ]
            jglick Jesse Glick made changes -
            Summary Pipeline projects are sometimes not triggered when using Build after other projects are built -> Projects to watch WorkflowJob not reliably started from ReverseBuildTrigger after restart
            Hide
            jglick 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.

            Show
            jglick 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.
            jglick Jesse Glick made changes -
            Component/s core [ 15593 ]
            Component/s cloudbees-folder-plugin [ 18137 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 2207 (Web Link)" [ 14152 ]
            jglick Jesse Glick made changes -
            Labels workflow lts-candidate workflow
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-plugin PR 374 (Web Link)" [ 14153 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java
            http://jenkins-ci.org/commit/workflow-plugin/d2e726274b919aa3492d195dc75bf39711df7c2b
            Log:
            JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java http://jenkins-ci.org/commit/workflow-plugin/d2e726274b919aa3492d195dc75bf39711df7c2b Log: JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java
            http://jenkins-ci.org/commit/workflow-plugin/ccac19edb8caeb4ab300fc5cce536f4410a85e45
            Log:
            Merge pull request #374 from jglick/ReverseBuildTrigger-JENKINS-33971

            JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/4b72d5eb9dee...ccac19edb8ca

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java http://jenkins-ci.org/commit/workflow-plugin/ccac19edb8caeb4ab300fc5cce536f4410a85e45 Log: Merge pull request #374 from jglick/ReverseBuildTrigger- JENKINS-33971 JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug Compare: https://github.com/jenkinsci/workflow-plugin/compare/4b72d5eb9dee...ccac19edb8ca
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            http://jenkins-ci.org/commit/jenkins/1618270f6ced8d2760c3df632ea783fa73096af2
            Log:
            [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being reliably calculated during Jenkins startup.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java http://jenkins-ci.org/commit/jenkins/1618270f6ced8d2760c3df632ea783fa73096af2 Log: [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being reliably calculated during Jenkins startup.
            scm_issue_link SCM/JIRA link daemon made changes -
            Status In Progress [ 3 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            http://jenkins-ci.org/commit/jenkins/14d36c7dcd79ae0f37304b958f4c55cd190d3344
            Log:
            Merge pull request #2207 from jglick/ReverseBuildTrigger-JENKINS-33971

            JENKINS-33971 ReverseBuildTrigger.upstream2Trigger cache fix

            Compare: https://github.com/jenkinsci/jenkins/compare/be8833cc6b0d...14d36c7dcd79

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java http://jenkins-ci.org/commit/jenkins/14d36c7dcd79ae0f37304b958f4c55cd190d3344 Log: Merge pull request #2207 from jglick/ReverseBuildTrigger- JENKINS-33971 JENKINS-33971 ReverseBuildTrigger.upstream2Trigger cache fix Compare: https://github.com/jenkinsci/jenkins/compare/be8833cc6b0d...14d36c7dcd79
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #4539
            [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being (Revision 1618270f6ced8d2760c3df632ea783fa73096af2)

            Result = SUCCESS
            Jesse Glick : 1618270f6ced8d2760c3df632ea783fa73096af2
            Files :

            • core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #4539 [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being (Revision 1618270f6ced8d2760c3df632ea783fa73096af2) Result = SUCCESS Jesse Glick : 1618270f6ced8d2760c3df632ea783fa73096af2 Files : core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/9b098c6ef36e90433466ca0b40f8f5a689ffa74b
            Log:
            JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug.
            Originally-Committed-As: d2e726274b919aa3492d195dc75bf39711df7c2b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: job/src/test/java/org/jenkinsci/plugins/workflow/ReverseBuildTriggerTest.java http://jenkins-ci.org/commit/workflow-job-plugin/9b098c6ef36e90433466ca0b40f8f5a689ffa74b Log: JENKINS-33971 Integration test for ReverseBuildTrigger.upstream2Trigger bug. Originally-Committed-As: d2e726274b919aa3492d195dc75bf39711df7c2b
            olivergondza Oliver Gondža made changes -
            Labels lts-candidate workflow 1.651.2-fixed workflow
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java
            http://jenkins-ci.org/commit/jenkins/28bc2ba67a29f879ee7b840b46f383281dd1fe8a
            Log:
            [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being reliably calculated during Jenkins startup.
            (cherry picked from commit 1618270f6ced8d2760c3df632ea783fa73096af2)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/jenkins/triggers/ReverseBuildTrigger.java http://jenkins-ci.org/commit/jenkins/28bc2ba67a29f879ee7b840b46f383281dd1fe8a Log: [FIXED JENKINS-33971] ReverseBuildTrigger.upstream2Trigger was not being reliably calculated during Jenkins startup. (cherry picked from commit 1618270f6ced8d2760c3df632ea783fa73096af2)
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 169982 ] JNJira + In-Review [ 198754 ]
            abayer Andrew Bayer made changes -
            Labels 1.651.2-fixed workflow 1.651.2-fixed pipeline workflow
            abayer Andrew Bayer made changes -
            Labels 1.651.2-fixed pipeline workflow 1.651.2-fixed pipeline
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-36612 [ JENKINS-36612 ]

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: