Skip to content

Draft: PoC: FY24-Q2 - Ops Hackathon - Enhance the syntax validation with override variables detection on CI::Lint

What does this MR do and why?

Enhance the syntax validation of .gitlab-ci.yml to include highlighting and validation of variables, particularly in cases where pre-defined variables are being overridden within the yaml configuration's variable scope.

Screenshots or screen recordings

image

Screen_Recording_2023-05-31_at_19.42.44

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Define the Project variable.
  2. Define a variable with the same name (in Project) in .gitlab-ci.yml variables section.
  3. Run Ci Lint with enabled Simulate a pipeline created for the default branch
  4. Check Warnings

Some areas to improve:

  1. Add tests.
  2. We have to figure out do we need to make overridden variables calculation for every job in .gitlab-ci.yml - or only summarize it at the end.
  3. Add more information to the warnings from which area of variables we get overridden (Project, variables from another yaml file, etc.)
  4. Optimise warnings calculation as from first glance it could be done together with the errors parsing, but for the prototype, it was introduced with the dedicated call to call Variables::Builder from scratch.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

!
Edited by Dmytro Biryukov

Merge request reports