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

Skip to content

Revert 'Fix false Build Scheduled notification'#26517

Merged
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
MarkEWaite:fix-multibranch-pipeline-run-fails-from-parent
Mar 28, 2026
Merged

Revert 'Fix false Build Scheduled notification'#26517
MarkEWaite merged 1 commit into
jenkinsci:masterfrom
MarkEWaite:fix-multibranch-pipeline-run-fails-from-parent

Conversation

@MarkEWaite
Copy link
Copy Markdown
Contributor

@MarkEWaite MarkEWaite commented Mar 24, 2026

Revert 'Fix false Build Scheduled notification'

This reverts commit a7d3225.

Fixes #26516

Multibranch scan no longer starts from "run" button of the parent of multibranch folder. It starts as expected with Jenkins 2.546 and earlier. It starts as expected from the "Scan Multibranch Pipeline Now" button inside the folder.

I've asked @LakshyaBagani if she has time to investigate a fix, since it would be much better to fix it than to revert the fix.

This pull request is intentionally draft so that we do not merge it until @LakshyaBagani has responded.

Testing done

Confirmed the bug is visible in my weekly LTS configuration and in a separate verification test of Jenkins 2.555 (the next LTS baseline).

Confirmed that the issue is fixed when I revert pull request:

No automated test has been created. It seems reasonable that a RealJenkinsRule test could be created based on the contents of the zip file that is included in the bug report.

Screenshots (UI changes only)

Before

Screenshot -before

After

Screenshot -after

Proposed changelog entries

  • Fix multibranch Pipeline scan from parent folder (regression).

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

@mawinter69

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.

…nch is disabled"

Reported as issue:

* jenkinsci#26516

This reverts commit a7d3225.
@MarkEWaite MarkEWaite added the bug For changelog: Minor bug. Will be listed after features label Mar 24, 2026
Copilot AI review requested due to automatic review settings March 24, 2026 16:15
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

Reverts the UI-side success criteria for “Build now” POST requests to restore pre-#26117 behavior, addressing a regression where some successful triggers (notably multibranch scans started from a parent folder “Run” button) were shown as failed.

Changes:

  • Change build-trigger success detection from rsp.status === 201 back to rsp.ok in two frontend handlers.
  • Restore success notifications for non-201 successful responses (including cases where the server responds with redirects that fetch follows).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/src/main/resources/lib/hudson/project/configurable/configurable.js Reverts build-now notification logic to treat any ok response as success.
core/src/main/resources/hudson/views/BuildButtonColumn/icon.js Same revert for the view “Run” button build trigger handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

headers: crumb.wrap({}),
}).then((rsp) => {
if (rsp.status === 201) {
if (rsp.ok) {
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Switching to rsp.ok will treat requests as successful even when the POST did not actually schedule anything but responded with a redirect that fetch follows (e.g., ParameterizedJobMixIn#doBuild redirects to . when schedule2(...).getItem() is null). In that case the final response is typically 200, so rsp.ok becomes true and the UI will show a success notification incorrectly. Consider using a success condition that cannot be satisfied by the “redirect to job page” failure path (for example, require 201 Created, and/or treat a followed redirect as success only when it ends up on a queue item URL), or adjust the server-side endpoint(s) to return a non-2xx error when scheduling fails.

Suggested change
if (rsp.ok) {
const isQueueItemUrl = typeof rsp.url === "string" && rsp.url.indexOf("/queue/item/") !== -1;
const successCondition = rsp.status === 201 || isQueueItemUrl;
if (successCondition) {

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code review comment is correct, but necessary to accept that behavior in order to not regress functionality.

headers: crumb.wrap({}),
}).then((rsp) => {
if (rsp.status === 201) {
if (rsp.ok) {
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Using rsp.ok here can reintroduce false “Build Scheduled” notifications when the build is refused and the server responds with a redirect that fetch follows (e.g., ParameterizedJobMixIn#doBuild redirects to . when scheduling returns null). The final 200 response will make rsp.ok true, so users can be told the build was scheduled when it wasn’t. Consider keeping an explicit success criterion (such as 201 Created), or otherwise distinguishing success redirects (queue item) from “fallback” redirects back to the job page.

Suggested change
if (rsp.ok) {
if (rsp.status === 201) {

Copilot uses AI. Check for mistakes.
@MarkEWaite MarkEWaite added regression-fix Pull request that fixes a regression in one of the previous Jenkins releases work-in-progress The PR is under active development, not ready to the final review labels Mar 24, 2026
@MarkEWaite MarkEWaite marked this pull request as ready for review March 27, 2026 20:49
@MarkEWaite
Copy link
Copy Markdown
Contributor Author

@LakshyaBagani I think we should merge this pull request so that we are confident that the issue will be fixed in the next weekly release and can be backported to the next Jenkins LTS. You should continue your work to implement your fix, but I think it is best that we let you do that without the time pressure of the upcoming weekly release.

@MarkEWaite MarkEWaite removed the work-in-progress The PR is under active development, not ready to the final review label Mar 27, 2026
@timja
Copy link
Copy Markdown
Member

timja commented Mar 27, 2026

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@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 Mar 27, 2026
@MarkEWaite MarkEWaite merged commit fe52140 into jenkinsci:master Mar 28, 2026
25 checks passed
@MarkEWaite MarkEWaite deleted the fix-multibranch-pipeline-run-fails-from-parent branch March 28, 2026 18:13
shalinisudarsan pushed a commit to shalinisudarsan/jenkins that referenced this pull request Mar 30, 2026
Revert "Fix false 'Build Scheduled' notification when parent multibranch is disabled"

Reported as issue:

* jenkinsci#26516

This reverts commit a7d3225.

(cherry picked from commit fe52140)
shalinisudarsan pushed a commit to shalinisudarsan/jenkins that referenced this pull request Mar 30, 2026
Revert "Fix false 'Build Scheduled' notification when parent multibranch is disabled"

Reported as issue:

* jenkinsci#26516

This reverts commit a7d3225.

(cherry picked from commit fe52140)
@MarkEWaite MarkEWaite mentioned this pull request Mar 30, 2026
6 tasks
MarkEWaite added a commit to shalinisudarsan/jenkins that referenced this pull request Mar 30, 2026
Revert "Fix false 'Build Scheduled' notification when parent multibranch is disabled"

Reported as issue:

* jenkinsci#26516

This reverts commit a7d3225.

(cherry picked from commit fe52140)
MarkEWaite added a commit to shalinisudarsan/jenkins that referenced this pull request Mar 31, 2026
Revert "Fix false 'Build Scheduled' notification when parent multibranch is disabled"

Reported as issue:

* jenkinsci#26516

This reverts commit a7d3225.

(cherry picked from commit fe52140)
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 regression-fix Pull request that fixes a regression in one of the previous Jenkins releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multibranch scan no longer starts from "run" button of the parent of multibranch folder

3 participants