A CICD file with bad syntax that is included might silently fail.
Summary
If a .gitilab-ci.yml file includes another file that has incorrect syntax, but it is in a section that the original .gitlab-ci.yml file also has, then the syntax failure is silently dropped and the section is not merged.
Steps to reproduce
First, create a repo with a .gitlab-ci.yml file:
# .gitlab-ci.yml
variables:
KEY1: "val1"
KEY2: "val2"
include: included-file.yml
test:
script:
- echo $KEY1
- echo $KEY2
- echo $INCLUDED_KEY
Then, create the included-file.yml:
# included-file.yml
variables:
- INCLUDED_KEY: "included value" # this syntax is incorrect!
Then, push the files to trigger a CI run. Note that the job DOES pass, and that echo $INCLUDED_KEY does not print anything. This indicates that the syntax error of having a list of key/values instead of key/values in included-file.yml is silently dropped.
Then, fix the syntax error, push, and note that echo $INCLUDED_KEY does print "included value" as expected.
Example Project
I reproduced this on a totally new repo:
First pipeilne with silently dropped error: https://gitlab.com/kroseaf/silent-syntax-drop-repro/-/jobs/1577579327
Second pipeline with fix: https://gitlab.com/kroseaf/silent-syntax-drop-repro/-/jobs/1577586945
What is the current bug behavior?
Syntax errors of included files in CICD are dropped under some conditions.
What is the expected correct behavior?
Syntax errors of included files in CICD should ALWAYS cause an error.
Output of checks
This bug happens on GitLab.com