Skip to content
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

Make /manage/configuration-as-code/check respond with a JSON list of issues #2628

Open
jesstruck opened this issue Jan 24, 2025 · 0 comments

Comments

@jesstruck
Copy link

jesstruck commented Jan 24, 2025

What feature do you want to see added?

When sending a POST to this url <JENKINS_HOST>/manage/configuration-as-code/check with a valid JCasC file the endpoint returns status code 200 and a empty list.

when doing the exact same call but with an invalid JCasC file we get status code 500, and a HTML page with a generic stapler response saying A problem occurred while processing the request, I would expected this to return status code 200 ( 400 Bad Request / 409 Conflict or similar ) a list containing all the errors in the invalid file.

The curl command we use for succesful testing

curl --location 'https://<JENKINS_HOST>/manage/configuration-as-code/check' \
--header 'Content-Type: application/yaml' \
--header 'Authorization: Basic <token>' \
--header 'Cookie: <cookie> \
--data-raw '# Valid JCasC file
jenkins:
  systemMessage: "Welcome to Jenkins!" # Optional
  numExecutors: 2 # Default number of executors
  scmCheckoutRetryCount: 3 # Default retry count for SCM operations
 
credentials:
  system:
    domainCredentials:
      - credentials:
          - usernamePassword:
              scope: GLOBAL
              id: "admin-credentials"
              description: "Default admin credentials"
              username: "admin"
              password: "admin"
' 

The Failing command

curl --location 'https://<JENKINS_HOST>/manage/configuration-as-code/check' \
--header 'Content-Type: application/yaml' \
--header 'Authorization: Basic <token>' \
--header 'Cookie: <cookie> \
--data-raw '# Invalid JCasC file
jenkins:
  systemMessage1: "Welcome to Jenkins!" # Optional
  numExecutors: 2 # Default number of executors
  scmCheckoutRetryCount: 3 # Default retry count for SCM operations
 
credentials:
  system:
    domainCredentials:
      - credentials:
          - usernamePassword:
              scope: GLOBAL
              id: "admin-credentials"
              description: "Default admin credentials"
              username: "admin"
              password: "admin"
' 

Upstream changes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant