Skip to content

CI Lint API doesn't properly lint local includes due to missing project context

Summary

Using the CI Lint API (https://docs.gitlab.com/ee/api/lint.html) does not accept a project context which means we cannot lint CI Pipeline data successfully that contains local includes.

Steps to reproduce

  1. Create a pipeline template file .gitlab-local.yml
  2. Create a .gitlab-ci.yml pipeline file.
  3. Include the pipeline from step 1 in the main pipeline file via local include.
  4. Run the contents of .gitlab-ci.yml through the web UI CI Lint tool; lint succeeds.
  5. Run the contents of .gitlab-ci.yml through the CI Lint RESTful API; lint fails.

Example Project

https://gitlab.com/test-group64/my-test-project

What is the current bug behavior?

When running a pipeline file that contains a local file include through the CI lint RESTful API, the lint fails with the following error: Issues: Local file .gradle-local.yml does not have project!

This is because through the RESTful API, there is no way to give the linter context as to where the pipeline file is located that is being linted.

What is the expected correct behavior?

CI lint through the RESTful API passes.

Edited by Laura Montemayor