Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix link to polling log of upstream build caused by an SCM trigger after a Jenkins restart#26291

Merged
timja merged 1 commit into
jenkinsci:masterfrom
mawinter69:issue-21106
Feb 18, 2026
Merged

Fix link to polling log of upstream build caused by an SCM trigger after a Jenkins restart#26291
timja merged 1 commit into
jenkinsci:masterfrom
mawinter69:issue-21106

Conversation

@mawinter69
Copy link
Copy Markdown
Contributor

@mawinter69 mawinter69 commented Feb 9, 2026

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. The onLoad(Job, job, int buildNumber) was then actually never called.
The fix should not reintroduce the issue from #23334, as the DeeplyNestedUpstreamCause will 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:

  1. Create a job downstream that does nothing
  2. Create a job upstream, that uses Git SCM with any small github project
  3. add a post build step that triggers a build of downstream
  4. configured Poll SCM to run every minute
  5. wait for the upstream and downstream jobs to have run
  6. The downstream build now has a working link in it's SCMTrigger cause
  7. Restart Jenkins and visit the downstream build
  8. The downstream build still has a working link in it's SCMTrigger cause

Before the fix step 8 returned a broken link.

Screenshots (UI changes only)

Before

After

Proposed changelog entries

  • Fix link to polling log of upstream build caused by an SCM trigger after a Jenkins restart

Proposed changelog category

/label bug

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

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.
@comment-ops-bot comment-ops-bot Bot added the bug For changelog: Minor bug. Will be listed after features label Feb 9, 2026
@mawinter69 mawinter69 marked this pull request as ready for review February 9, 2026 22:21
@MarkEWaite MarkEWaite requested a review from Copilot February 11, 2026 01:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to UpstreamCause to 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.

Copy link
Copy Markdown
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@comment-ops-bot comment-ops-bot Bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Feb 13, 2026
Copy link
Copy Markdown

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@timja timja enabled auto-merge February 18, 2026 14:14
@timja timja disabled auto-merge February 18, 2026 14:17
@timja timja merged commit da0ab1c into jenkinsci:master Feb 18, 2026
24 checks passed
meetgoti07 pushed a commit to meetgoti07/jenkins that referenced this pull request Mar 14, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-28350] Link to polling log for builds started by upstream doesn't work

5 participants