Add optional SHA parameter to CI lint API
What does this MR do and why?
Adds support for option to pass the commit SHA as an attribute to the CI lint API. This makes validating CI config changes in MRs much easier.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Set up a repo with a valid .gitlab-ci.yml in the default branch (e.g. https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml)
- Create a new branch and edit the .gitlab-ci.yml so that it's not valid anymore (like adding
include: .does-not-exist
at the top) -
GET /projects/:id/ci/lint
should return json withvalid: true
-
GET /projects/:id/ci/lint?sha=:new-branch-head
should return json withvalid: false
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Resolves #369212 (closed)
Edited by Oula Kuuva