Skip to content

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.

  1. 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)
  2. 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)
  3. GET /projects/:id/ci/lint should return json with valid: true
  4. GET /projects/:id/ci/lint?sha=:new-branch-head should return json with valid: 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.

Resolves #369212 (closed)

Edited by Oula Kuuva

Merge request reports

Loading