I have all my scripts in a file scripts-ci.yaml
that I include in the main gitlab-ci.yaml
.
When I try to use the scripts in scripts-ci.yaml
from the main gitlab-ci.yml
using include
, I get the following error Included file .gitlab-ci.yml does not have valid YAML syntax!
.
I should note that when I copy the script in gitlab-ci.yml
directly and skip using include
everything works fine.
Here is how things look:
# scripts.yaml
.test-include-scripts: &test-include-scripts
- echo "testing includes with anchor scripts"
# .gitlab-ci.yml
include:
- local: '.gitlab/ci/scripts-ci.yaml'
test-include:
script:
- *test-include-scripts
You can see an example here: