Fix link to polling log of upstream build caused by an SCM trigger after a Jenkins restart#26291
Conversation
fixes jenkinsci#21106 When a run was caused by an upstream change that itself was triggered by an SCMTriggerCause, the link on the run to the pollingLog was lost after a Jenkins restart The root cause of the problem is the fix for jenkinsci#23334 which removed the `onLoad(Run build)` from the upstream cause which effectively prevents loading of upstream causes.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the link to the polling log for builds started by an upstream SCM trigger was broken after a Jenkins restart. The issue was introduced by a previous fix for JENKINS-24161 that removed the onLoad(Run) method from UpstreamCause, which prevented the initialization of nested causes during deserialization.
Changes:
- Re-adds
onLoad(Run)method toUpstreamCauseto ensure nested causes are properly initialized after restart - Adds a test with test data that validates the fix by loading a downstream build with an upstream cause containing an SCM trigger cause
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/hudson/model/Cause.java | Adds onLoad(Run) override to UpstreamCause that delegates to existing onLoad(Job, int) method |
| test/src/test/java/hudson/model/CauseTest.java | Adds test method upstreamCauseOnLoad that verifies SCMTriggerCause is properly loaded when nested in UpstreamCause |
| test/src/test/resources/hudson/model/CauseTest/jobs/upstream/config.xml | Test data: upstream job configuration |
| test/src/test/resources/hudson/model/CauseTest/jobs/upstream/builds/1/build.xml | Test data: upstream build #1 with SCMTriggerCause |
| test/src/test/resources/hudson/model/CauseTest/jobs/downstream/config.xml | Test data: downstream job configuration |
| test/src/test/resources/hudson/model/CauseTest/jobs/downstream/builds/1/build.xml | Test data: downstream build #1 with UpstreamCause containing SCMTriggerCause |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MarkEWaite
left a comment
There was a problem hiding this comment.
Thanks. Confirmed that I can duplicate the issue before the fix and that the change fixes the issue.
This PR is now ready for merge. We will merge it after the security release if there is no negative feedback.
/label ready-for-merge
Pull request: * jenkinsci/jenkins#26313 Includes Jenkins core pull requests: * jenkinsci/jenkins#26312 * jenkinsci/jenkins#26311 * jenkinsci/jenkins#26310 * jenkinsci/jenkins#26307 * jenkinsci/jenkins#26305 * jenkinsci/jenkins#26304 * jenkinsci/jenkins#26303 * jenkinsci/jenkins#26302 * jenkinsci/jenkins#26301 * jenkinsci/jenkins#26298 * jenkinsci/jenkins#26295 * jenkinsci/jenkins#26294 * jenkinsci/jenkins#26293 * jenkinsci/jenkins#26291 * jenkinsci/jenkins#26240 * jenkinsci/jenkins#26190 * jenkinsci/jenkins#26188 * jenkinsci/jenkins#26149
Pull request: * jenkinsci/jenkins#26313 Includes Jenkins core pull requests: * jenkinsci/jenkins#26312 * jenkinsci/jenkins#26311 * jenkinsci/jenkins#26310 * jenkinsci/jenkins#26307 * jenkinsci/jenkins#26305 * jenkinsci/jenkins#26304 * jenkinsci/jenkins#26303 * jenkinsci/jenkins#26302 * jenkinsci/jenkins#26301 * jenkinsci/jenkins#26298 * jenkinsci/jenkins#26295 * jenkinsci/jenkins#26294 * jenkinsci/jenkins#26293 * jenkinsci/jenkins#26291 * jenkinsci/jenkins#26240 * jenkinsci/jenkins#26190 * jenkinsci/jenkins#26188 * jenkinsci/jenkins#26149
…ter a Jenkins restart (jenkinsci#26291) Fix link to polling log of upstream changes after restart fixes jenkinsci#21106 When a run was caused by an upstream change that itself was triggered by an SCMTriggerCause, the link on the run to the pollingLog was lost after a Jenkins restart The root cause of the problem is the fix for jenkinsci#23334 which removed the `onLoad(Run build)` from the upstream cause which effectively prevents loading of upstream causes.
fixes #21106
When a run was caused by an upstream change that itself was triggered by an SCMTriggerCause, the link on the run to the pollingLog of the upstream build was lost after a Jenkins restart.
The root cause of the problem is the fix for #23334 which removed the
onLoad(Run build)from the upstream cause which effectively prevents loading of upstream causes after a restart. TheonLoad(Job, job, int buildNumber)was then actually never called.The fix should not reintroduce the issue from #23334, as the
DeeplyNestedUpstreamCausewill at one point jump in and prevent further loading of more builds.Testing done
Added a test that fails without the fix and succeeds afterwards.
Also verified manually:
downstreamthat does nothingupstream, that uses Git SCM with any small github projectupstreamanddownstreamjobs to have runBefore the fix step 8 returned a broken link.
Screenshots (UI changes only)
Before
After
Proposed changelog entries
Proposed changelog category
/label bug
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.