GitLab CI configuration should be valid but isn't: jobs:build:before_script config should be a string or a nested array of strings up to 10 levels deep.
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
This GitLab CI configuration is invalid: jobs:build:before_script config should be a string or a nested array of strings up to 10 levels deep.
This error message appears when I add a : character inside a string in a gitlab ci yml before_script section, removing the : makes the pipeline be considered valid.
Steps to reproduce.
- Add the following before_script to a job
before_script:
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
- export NVM_DIR="$HOME/.nvm"
- \[ -s "$NVM_DIR/nvm.sh" \] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- \[ -s "$NVM_DIR/bash_completion" \] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
- nvm --version
- nvm install 16
- npm --version
- node --version
- if [ -z "$BUILD_ENV" ]; then echo "Error: BUILD_ENV is empty"; exit 1; fi
What is the current bug behavior?
It will display the following error message: This GitLab CI configuration is invalid: jobs:build:before_script config should be a string or a nested array of strings up to 10 levels deep.
Removing the : in the last line makes the pipeline be considered valid.
What is the expected correct behavior?
Should be a valid pipeline already with the Error: BUILD_ENV, it should not require me to write Error BUILD_ENV.

