fix: validate 'include' keywords in gitlab-ci.yml configuration files
What does this MR do?
During .gitlab-ci.yml
configuration file validation there are two
cases:
- either we are validating a file within a project context (a project and a sha is given in option parameters)
- either we are validating a file with no project context (as in the api POST /ci/lint)
In the first case, all include:
keywords are replaced by the content
of the included CI cnfiguration files.
In the second case, the include:
configuration is kept untouched.
The current problem arises in the second case when one wants to
validate a generic .gitlab-ci.yml
configuration file with an include:
keyword from the API. The following error will be raised by the API:
"jobs:include config should be a hash"
.
This commit fixes the behavior by validating the include:
keyword if
its present to not parse it as a job definition.
What are the relevant issue numbers?
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/55863 & #52822 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
~~Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.~~ -
Security reports checked/validated by reviewer