-
Improvement
-
Resolution: Fixed
-
Major
In the CloudBees Folder plugin, RelocateAction implements TransientProjectActionFactory to add the link to various project types letting them be moved into other folders, and TransientFolderActionFactory for subfolders. Would make sense to have a generic TransientActionFactory for other Actionable subtypes (maybe only AbstractItem), which would allow miscellaneous items (especially when a TopLevelItem) to get actions like Relocate as well.
- is blocking
-
JENKINS-20990 Folder integration
-
- Resolved
-
- relates to
-
JENKINS-59468 addAction, replaceAction doesn't work on AbstractProject
-
- In Review
-
[JENKINS-18224] TransientActionFactory
Unfortunately the antipattern of Actionable returning a mutable collection from getActions, coupled with questionable and inconsistent behaviors of its subtypes, has made it seemingly impossible to compatibly change how Actionable.getActions works. The same is true of nonfinal Actionable subtypes like AbstractItem which do not themselves currently override Actionable methods.
The only compatible course is to introduce a new method which would include entries from a TransientActionFactory, though then lots of code would need to be updated to call it: basically anything which calls getActions and treats the result as read-only.
(And User and View are not Actionable despite having comparable methods and transient factories! So they cannot use any new facility.)
Code changed in jenkins
User: Jesse Glick
Path:
core/src/main/java/hudson/matrix/DefaultMatrixExecutionStrategyImpl.java
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/Actionable.java
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Job.java
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/TransientBuildActionFactory.java
core/src/main/java/hudson/model/TransientComputerActionFactory.java
core/src/main/java/hudson/model/TransientProjectActionFactory.java
core/src/main/java/hudson/model/queue/WorkUnitContext.java
core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
core/src/main/java/jenkins/model/TransientActionFactory.java
core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
core/src/main/resources/hudson/model/AbstractBuild/index.jelly
core/src/main/resources/hudson/model/AbstractProject/main.jelly
core/src/main/resources/lib/hudson/actions.jelly
core/src/main/resources/lib/hudson/project/projectActionFloatingBox.jelly
test/src/test/java/jenkins/model/TransientActionFactoryTest.java
http://jenkins-ci.org/commit/jenkins/f1a751f79dfbb975e4c436fd0967323e1ae7b8c6
Log:
[FIXED JENKINS-18224] Introduced TransientActionFactory.
Code changed in jenkins
User: Jesse Glick
Path:
core/src/main/java/hudson/cli/SetBuildParameterCommand.java
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/Actionable.java
core/src/main/java/hudson/model/CauseAction.java
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/labels/LabelAtom.java
core/src/main/java/hudson/tasks/Fingerprinter.java
core/src/main/java/hudson/triggers/SCMTrigger.java
test/src/test/java/hudson/model/UserTest.java
http://jenkins-ci.org/commit/jenkins/a22e9feaaef30b89621ae9ca3f33f862ae99f4c7
Log:
JENKINS-18224 Introduced Actionable.replaceAction, allowing getActions() to be deprecated except for subclasses.
Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/model/Actionable.java
core/src/main/java/jenkins/model/TransientActionFactory.java
http://jenkins-ci.org/commit/jenkins/6eb191964b415d7f0a025847d5444db922d6fe49
Log:
JENKINS-18224 Preparing to merge #1059.
Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/cli/SetBuildParameterCommand.java
core/src/main/java/hudson/matrix/DefaultMatrixExecutionStrategyImpl.java
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/Actionable.java
core/src/main/java/hudson/model/CauseAction.java
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Job.java
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/TransientBuildActionFactory.java
core/src/main/java/hudson/model/TransientComputerActionFactory.java
core/src/main/java/hudson/model/TransientProjectActionFactory.java
core/src/main/java/hudson/model/labels/LabelAtom.java
core/src/main/java/hudson/model/queue/WorkUnitContext.java
core/src/main/java/hudson/tasks/Fingerprinter.java
core/src/main/java/hudson/triggers/SCMTrigger.java
core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
core/src/main/java/jenkins/model/TransientActionFactory.java
core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
core/src/main/resources/hudson/model/AbstractBuild/index.jelly
core/src/main/resources/hudson/model/AbstractProject/main.jelly
core/src/main/resources/lib/hudson/actions.jelly
core/src/main/resources/lib/hudson/project/projectActionFloatingBox.jelly
core/src/test/java/hudson/model/ActionableTest.java
test/src/test/java/hudson/model/UserTest.java
test/src/test/java/jenkins/model/TransientActionFactoryTest.java
http://jenkins-ci.org/commit/jenkins/0f7b144fd32544a872075d58300a53b9abcca5f4
Log:
Merge pull request #1059 from jglick/TransientActionFactory-JENKINS-18224
JENKINS-18224 TransientActionFactory
Compare: https://github.com/jenkinsci/jenkins/compare/e998c2a670fb...0f7b144fd325
Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/com/cloudbees/hudson/plugins/folder/Folder.java
src/main/java/com/cloudbees/hudson/plugins/folder/TransientFolderActionFactory.java
src/main/java/com/cloudbees/hudson/plugins/folder/relocate/RelocateAction.java
src/main/resources/com/cloudbees/hudson/plugins/folder/Folder/configure.jelly
src/test/java/com/cloudbees/hudson/plugins/folder/FolderTest.java
http://jenkins-ci.org/commit/cloudbees-folder-plugin/c006194cec064331b273050177d67c883b6e6d27
Log:
Taking advantage of APIs available with newer Jenkins cores.
· JENKINS-18224 TransientActionFactory simplifies adding the Move action and makes it available more broadly.
Can therefore deprecate TransientFolderActionFactory.
· Expanding the search index to look for jobs in subfolders (matches #848 in Jenkins root).
· testReloadJenkinsAndFindBuildInProgress can now pass unconditionally.
· ListView.setIncludeRegex avoids the need for reflection.
· f:bottomButtonBar convenient in Jelly.
As yet unimplemented:
· AutoCompletionCandidates.ofJobNames could be used, though it does not filter by permitted children.
(Nor, generally, should it, since this method is typically used for existing items, which might violate this restriction.)
Might be feasible to call ofJobNames and then filter the result; or perhaps this method should accept an Item filter.
Integrated in jenkins_main_trunk #3157
[FIXED JENKINS-18224] Introduced TransientActionFactory. (Revision f1a751f79dfbb975e4c436fd0967323e1ae7b8c6)
JENKINS-18224 Introduced Actionable.replaceAction, allowing getActions() to be deprecated except for subclasses. (Revision a22e9feaaef30b89621ae9ca3f33f862ae99f4c7)
JENKINS-18224 Preparing to merge #1059. (Revision 6eb191964b415d7f0a025847d5444db922d6fe49)
Result = SUCCESS
Jesse Glick : f1a751f79dfbb975e4c436fd0967323e1ae7b8c6
Files :
- core/src/main/java/hudson/model/Job.java
- core/src/main/resources/hudson/matrix/MatrixProject/index.jelly
- core/src/main/java/hudson/model/queue/WorkUnitContext.java
- core/src/main/resources/lib/hudson/actions.jelly
- core/src/main/java/hudson/model/Computer.java
- core/src/main/java/hudson/matrix/DefaultMatrixExecutionStrategyImpl.java
- core/src/main/java/hudson/model/AbstractProject.java
- core/src/main/java/hudson/model/TransientComputerActionFactory.java
- core/src/main/java/jenkins/model/TransientActionFactory.java
- core/src/main/resources/lib/hudson/project/projectActionFloatingBox.jelly
- core/src/main/java/hudson/model/Run.java
- core/src/main/resources/hudson/model/AbstractBuild/index.jelly
- core/src/main/java/hudson/model/AbstractBuild.java
- core/src/main/java/hudson/model/Actionable.java
- core/src/main/java/hudson/model/Queue.java
- core/src/main/java/hudson/model/TransientBuildActionFactory.java
- core/src/main/java/hudson/model/TransientProjectActionFactory.java
- test/src/test/java/jenkins/model/TransientActionFactoryTest.java
- core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
- core/src/main/resources/hudson/model/AbstractProject/main.jelly
Jesse Glick : a22e9feaaef30b89621ae9ca3f33f862ae99f4c7
Files :
- core/src/main/java/hudson/model/CauseAction.java
- core/src/main/java/hudson/model/Computer.java
- core/src/main/java/hudson/model/labels/LabelAtom.java
- core/src/main/java/hudson/model/Actionable.java
- core/src/main/java/hudson/cli/SetBuildParameterCommand.java
- core/src/main/java/hudson/triggers/SCMTrigger.java
- test/src/test/java/hudson/model/UserTest.java
- core/src/main/java/hudson/tasks/Fingerprinter.java
- core/src/main/java/hudson/model/AbstractProject.java
- core/src/main/java/hudson/model/AbstractBuild.java
Jesse Glick : 6eb191964b415d7f0a025847d5444db922d6fe49
Files :
- core/src/main/java/jenkins/model/TransientActionFactory.java
- changelog.html
- core/src/main/java/hudson/model/Actionable.java
Code changed in jenkins
User: Jesse Glick
Path:
core/src/main/java/hudson/model/Actionable.java
core/src/main/java/jenkins/model/TransientActionFactory.java
http://jenkins-ci.org/commit/jenkins/c21b209ba383e5e4f6522ec866d03fb9ca5745a4
Log:
JENKINS-18224 Relaxing type parameter restriction on TransientActionFactory since useful mixin interfaces like Item do not extend Actionable.
Integrated in jenkins_main_trunk #3158
JENKINS-18224 Relaxing type parameter restriction on TransientActionFactory since useful mixin interfaces like Item do not extend Actionable. (Revision c21b209ba383e5e4f6522ec866d03fb9ca5745a4)
Result = SUCCESS
Jesse Glick : c21b209ba383e5e4f6522ec866d03fb9ca5745a4
Files :
- core/src/main/java/jenkins/model/TransientActionFactory.java
- core/src/main/java/hudson/model/Actionable.java
Making Actionable understand transient actions is actually a good idea, because transient actions in general are typically done as a hack.
Although it probably implies calling transient action factory on every page rendering.