I'm writing a gitlab-ci.yaml script for my pipeline, and trying to define an array of strings variable (simplified version of the code):
npm_audit:
variables:
PACKAGE-WHITE-LIST: ["package A", "package B"]
script:
- npm install audit-ci
- npx audit-ci -w PACKAGE-WHITE-LIST npm >> audit.log
When I run the pipeline, I get a yaml parse failure: "variables config should be a hash of key value pairs array"
What am I missing here?
Your code is not working for some reasons :
$
before your variable name to retrieve its valueThe following definition should work :
npm_audit:
variables:
PACKAGE_WHITE_LIST: "package A package B"
script:
- npm install audit-ci
- npx audit-ci -w $PACKAGE_WHITE_LIST npm >> audit.log