Skip to content

Hide build buttons in Multibranch branch/PR jobs when the Multibranch or organization folder is disabled#26131

Merged
timja merged 3 commits intojenkinsci:masterfrom
mawinter69:buildable
Jan 17, 2026
Merged

Hide build buttons in Multibranch branch/PR jobs when the Multibranch or organization folder is disabled#26131
timja merged 3 commits intojenkinsci:masterfrom
mawinter69:buildable

Conversation

@mawinter69
Copy link
Contributor

@mawinter69 mawinter69 commented Jan 16, 2026

When disabling a Multibranch project the branch/PR jobs still show the build button in the sidepanel and in the folder view the Build button column allows to start a build.

By adding the isBuildable to the BuildableItem interface we can now detect in Jobs if the parent is disabled. This will then hide the build button in the sidepanel and the column in the view.

Fixes #16678

Testing done

Created a multibranch job that has one branch and one PR
disabled Multibranch project -> the jobs for the branch and PR no longer show the Build Now button in the sidepanel and in the view the Build Button column has no button anymore.

Did the same for an Organization folder

Screenshots (UI changes only)

Before

After

Multibranch Job disabled:
image
main branch job without Build Nowbutton
image

Multibranch Job Enabled:
image

Multibranch project in a Disabled org:
image

Proposed changelog entries

  • Hide build buttons in Multibranch branch/PR jobs when the Multibranch or organization folder is disabled

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.

When disabling a Multibranch project the branch/PR jobs still show the
build button in the sidepanel and in the folder view the Build button
column allows to start a build.

By adding the isBuildable to the BuildableItem interface we can now
detect in Jobs if the parent is disabled. This will then hide the build
button in the sidepanel and the column in the view.

fixes jenkinsci#16678
@comment-ops-bot comment-ops-bot bot added the bug For changelog: Minor bug. Will be listed after features label Jan 16, 2026
@mawinter69 mawinter69 changed the title Add isBuildable to BuildableItem interface Hide build buttons in Multibranch branch/PR jobs when the Multibranch or organization folder is disabled Jan 16, 2026
@mawinter69 mawinter69 marked this pull request as ready for review January 16, 2026 14:42
Copy link
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.

Tested interactively and confirmed that a job within a folder is unaffected by the change and a job in a multibranch Pipeline is affected by the change. Much appreciated!

This PR is now ready for merge. We will merge it after approximately 24 hours 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 Jan 16, 2026
@timja timja merged commit 396e6e9 into jenkinsci:master Jan 17, 2026
18 checks passed
@MarkEWaite
Copy link
Contributor

@mawinter69 and @jonesbusy, this change needs your help. It is failing a test in the jobcacher plugin. You can duplicate the failure from the jobcacher plugin repository with the command:

mvn -Djenkins.version=2.547-rc37898.a_7d32255b_687 -Dtest=ArbitraryFileCachePipelineTest#testDefaultBranchCaching verify

The test appears to create a multibranch project and then press the "Run" button on the multibranch project. Previously, that action would pass, though I believe it was a no-op. Now that action seems to fail or at least it returns null in an unexpected location.

@mawinter69
Copy link
Contributor Author

The problem is that in the test a Multibranch project is created that has no sources. Due to that it is considered not buildable.

@jonesbusy
Copy link
Contributor

This fix the test https://github.com/jenkinsci/jobcacher-plugin/pull/495/changes

Tested with mvn -Djenkins.version=2.547-rc37898.a_7d32255b_687 -Dtest=ArbitraryFileCachePipelineTest#testDefaultBranchCaching verify

Is a release needed to satisfy the bom?

@MarkEWaite
Copy link
Contributor

Is a release needed to satisfy the bom?

Yes.

@jonesbusy
Copy link
Contributor

Released on https://github.com/jenkinsci/jobcacher-plugin/releases/tag/816.vb_582c458726f

* @author Kohsuke Kawaguchi
*/
public abstract class Build<P extends Project<P, B>, B extends Build<P, B>>
public abstract class Build<P extends Project<P, B>, B extends Build<P, B>>
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm sorry for that.
Isn't spotless detecting such things? Or checkstyle?

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't spotless detecting such things? Or checkstyle?

The spotless configuration on Jenkins core is much less rigorous than the spotless configuration for plugins. It doesn't detect or correct that type of change.

Copy link
Member

Choose a reason for hiding this comment

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

(mostly because of all the PRs we have open and the effort to migrate them, do-able of course)

meetgoti07 pushed a commit to meetgoti07/jenkins that referenced this pull request Jan 29, 2026
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-75417] Scheduling build under disabled Multibranch folder says "Build Scheduled" while it is not scheduled

6 participants