-
-
Notifications
You must be signed in to change notification settings - Fork 115
Add SaveAllJobsAction to save all jobs in folder after copy #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add SaveAllJobsAction to save all jobs in folder after copy #541
Conversation
| import org.kohsuke.stapler.StaplerResponse2; | ||
| import org.kohsuke.stapler.verb.POST; | ||
|
|
||
| import com.cloudbees.hudson.plugins.folder.SaveAllJobsAction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gratuitous import
| items.remove(item.getName()); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gratuitous whitespace
SaveAllJobsAction Feature – Demonstration & Usage:This PR implements SaveAllJobsAction (for JENKINS-20003), which lets users conveniently save all jobs in a folder. You can save all jobs inside a folder in three convenient ways: 2.Within the folder sidebar: 3.From the dashboard (home): These options provide flexible access and ensure no job changes are lost. Technical details & Code highlights:
Let me know if further screenshots or information would be helpful. |
|
I don't think this is such a good idea since it will show up on all folder types including those where it makes no sense, such as calculated folders like MultiBranch et al. |
|
Thanks for the valuable feedback! I agree that showing the "Save All Jobs" action on every folder type could lead to confusion, especially for calculated folders like MultiBranch. Please let me know if you have any suggestions on the best way to detect and filter folder types. |
|
This does not seem like a good UX. I think it would be better to step back and study the original reason for disabling a job when it was copied, which is in core I think, an ancient part of |
jtnord
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem like a good UX. I think it would be better to step back and study the original reason for disabling a job when it was copied, which is in core I think, an ancient part of
HudsonJenkins. Is this still relevant today? There is no such behavior when using configuration-as-code, for example. If people really want to do that I think it would be preferable for them to disable the original, then copy, then reënable the original. https://issues.jenkins.io/browse/JENKINS-27735 has some related ideas.
Note I tried copying a folder with a job (FreeStyle) in it and the job in the copied folder was not marked as disabled in the UI. Its not buildable, but it was enabled. As such I agree with jglick that the UX is just confusing, adding this action does not improve matters and makes things more confusing (why would you need to save all jobs recursively via the UI as Jenkins saves things when you make changes, and this action would imply wrongly things can get out of sync without feedback).
irrespective of the UX, there is also no permission checks (you may be able to see a job but not save it, or you may not even able to see jobs in a folder!), and the action is suspectable to CSRF checks as it is not restricted to HTTP POST.
|
Thank you for the feedback and for highlighting the diverse needs of Jenkins users. This would preserve backward compatibility for existing behavior, while giving flexibility to users who prefer automatic saving without manual actions. |
|
System properties are not great either. On what basis would an “administrator” make such a decision? I am more inclined to just delete this weird enable-after-save behavior. |



Summary
This PR introduces a SaveAllJobsAction that allows saving all jobs in a folder after copying, improving usability and preventing unsaved job issues.
Implementation
Testing
mvn clean testpasses with no failuresFixes JENKINS-20003