Skip to content

Return configuration reload errors as JSON#2864

Merged
timja merged 5 commits into
jenkinsci:masterfrom
somiljain2006:Error-handling
Jul 7, 2026
Merged

Return configuration reload errors as JSON#2864
timja merged 5 commits into
jenkinsci:masterfrom
somiljain2006:Error-handling

Conversation

@somiljain2006

@somiljain2006 somiljain2006 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #2304

Return structured error responses when JCasC reload fails. Return an HTTP 500 response with a JSON error body when a Configuration as Code reload triggered via the reload endpoint fails, rather than a generic server error. This provides clients with actionable error details while preserving successful reload behavior. Add integration tests covering reload failures, JSON error responses, and server-side logging.

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates the feature works or fixes the issue.

@somiljain2006
somiljain2006 requested a review from a team as a code owner July 6, 2026 17:36
Comment thread plugin/src/main/java/io/jenkins/plugins/casc/TokenReloadAction.java Outdated
Comment thread plugin/src/main/java/io/jenkins/plugins/casc/TokenReloadAction.java Outdated

@RequirePOST
public void doIndex(StaplerRequest2 request, StaplerResponse2 response) throws IOException {
public void doIndex(StaplerRequest2 request, StaplerResponse2 response) throws IOException, ServletException {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint intentionally implements UnprotectedRootAction and authorizes requests using the configured reload token. The operation is executed only after a constant-time token comparison, so the missing permission-check warning is a false positive.

@somiljain2006
somiljain2006 requested a review from timja July 6, 2026 22:12
@timja timja added the feature A PR that adds a feature - used by Release Drafter label Jul 7, 2026
@timja
timja merged commit e3a6e23 into jenkinsci:master Jul 7, 2026
17 checks passed
@somiljain2006
somiljain2006 deleted the Error-handling branch July 7, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A PR that adds a feature - used by Release Drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return errors as part of the response

3 participants