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-36193] Raise exception when trying to build a job that is disabled #2432
Conversation
👍 |
The test failure is unrelated, retriggering just in case. |
Retriggering build after #2435 |
Ready for merge. I'll wait till Friday in the case @godfath3r finds some time to write tests |
@@ -178,7 +178,7 @@ public final void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParamet | |||
} | |||
|
|||
if (!asJob().isBuildable()) { | |||
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable")); | |||
throw HttpResponses.error(SC_CONFLICT, new IOException(asJob().getFullName() + " is not buildable")); |
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.
Somewhat creative use of a 409, but as good a status as any I suppose.
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.
FWIW build-token-root
currently uses a 400.
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.
400 Bad Request The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
409 Conflict The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough
Taken from here: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
409 seems more close to the situation. What do you guys say? If SC_CONFLICT seems better then, build-token-root should also use 409.
Definitely could use a new test demonstrating the bug. This seems to be the only existing test in Jenkins core covering a related topic, which is alarming. |
I will try to write some test. Please don't merge until then. |
I'll write the test in a follow-up pull request |
We had a discussion with @godfath3r in IRC about it several days ago |
Merged as a part of #2457 |
JENKINS-36193