Add support for validating multiple local CI configuration files at once
*Note from maintainers: This issue describes a problem with CI config files that depend on the context set by the main `.gitlab-ci.yml`.* *The best solution reached in the comments is to allow to validate multiple local files at once. "Local" meaning file from local repository folder, even if it's changed or not commited. From the example below, that means including the local `ci/jobs.yaml` and `ci/templates.yaml` with the request to validate the main `.gitlab-ci.yml`. This feature is blocked by the lack of GitLab API support: https://gitlab.com/gitlab-org/gitlab/-/issues/349696* <details><summary>original title</summary> Feature request: Gitlab CI validation consider all related yaml files during validation </details> ### Problem to solve I am using Gitlab vscode extension to validate my Gitlab CI yaml files, the extension currently is only validate the current file without involving all the extended files. Therefore I often get "Job_1 : Unknown keys in extends (template_1)" ### Proposal If we can search for all the extended files based on the `include` block in the `.gitlab-ci.yml` file first, then validate the specific file, it will make the validation more legitimate. ### Further details For example, I have a `.gitlab-ci-yml` like following: ``` include: - local: "ci/jobs.yaml" - local: "ci/templates.yaml" ``` In the `jobs.yaml` file, I have a lot of jobs extends the template in `templates.yaml` file: ``` job_1: extends: temp_1 variables: - bla job_2: extends: temp_2 variables: - bla ``` And in `templates.yaml` file, I have those templates defined. Now I want to validate `jobs.yaml` file, but I got the validation saying that they don't recognize `temp_1` and `temp_2`. If the extension is able to find the templates.yaml by using the `.gitlab-ci.yaml` file, then we can validate deeper on the `jobs.yaml` file. This might require users to config the location of the `.gitlab-ci.yaml` file in the extension or the extension will look for them in the root of the project automatically. ### Links / references The Gitlab CI Lint has this feature: https://docs.gitlab.com/ee/ci/lint.html, but every time when I use it I have to manually paste the `include` block into the tool as well.
issue