-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
[JENKINS-74795] Job created via REST API attaches to default view #9947
Conversation
Co-authored-by: Mark Waite <[email protected]>
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.
Compared Stapler traces of 2.474, 2.484, and PR build, for both Jenkins
and Folder
(legacy types without 2
), and XML POST and copy
mode, and this essentially restores the previous behavior. GET gets rejected as expected.
(Note to myself: RFE idea: Show parameter types in Stapler traces for web methods.)
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.
I compared 2.474, 2.475, and the pre-release build from this pull request. The results from this build match the results from 2.474. I checked:
- Job created with createItem at root no longer assigns the job to the primary view
- Job created with createItem inside a view assigns the job to the view
Those behaviors are consistent between 2.474 and the build of this pull request. Thanks very much!
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
Co-authored-by: Mark Waite <[email protected]>
…nkinsci#9947) Co-authored-by: Mark Waite <[email protected]> (cherry picked from commit 8298257)
Problem
See JENKINS-74795. Creating jobs via the
createItem
REST API erroneously attaches those items to the default view after #9672.Evaluation
In the working scenario prior to #9672, the
Jenkins#doCreateItem
method is invoked by Stapler via its routable interface methodModifiableItemGroup#doCreateItem
. In the failing scenario after #9672, the (incorrect)ListView#doCreateItem
method is invoked by Stapler via its routable superclass methodView#doCreateItem
. This (mostly) works by accident, sinceView#doCreateItem
happens to delegate toJenkins#doCreateItem
, but the incorrect behavior is still apparent when the item is incorrectly added to the default view.View#doCreateItem
should never be invoked in this scenario, and the only reason it is was a regression in routing in #9672.Solution
Make the
Jenkins#doCreateItem(StaplerRequest2, StaplerResponse2)
default method routable, as the equivalent interface method was prior to #9672. For consistency withView#doCreateItem(StaplerRequest2, StaplerResponse2)
, add a@RequirePOST
annotation as well. The deprecated compatibility methods remain non-routable as before.Testing done
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist
Closes #9933