Hide build buttons in Multibranch branch/PR jobs when the Multibranch or organization folder is disabled#26131
Conversation
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
MarkEWaite
left a comment
There was a problem hiding this comment.
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
|
@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:
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. |
|
The problem is that in the test a Multibranch project is created that has no sources. Due to that it is considered not buildable. |
|
This fix the test https://github.com/jenkinsci/jobcacher-plugin/pull/495/changes Tested with Is a release needed to satisfy the bom? |
Yes. |
| * @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>> |
There was a problem hiding this comment.
hmm sorry for that.
Isn't spotless detecting such things? Or checkstyle?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
(mostly because of all the PRs we have open and the effort to migrate them, do-able of course)
… or organization folder is disabled (jenkinsci#26131)
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 Nowbutton 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:


main branch job without
Build NowbuttonMultibranch Job Enabled:

Multibranch project in a Disabled org:

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.