Reputation: 7609
I am using bitbucket, and I setup a token as secured variable in my pipeline settings.
I would like to use that token in my script, so I did :
- step:
name: 'Cancel Previous'
script:
- node ./pipelines/skip-previous.js $APP_PASSWORD
Now, I can't find a way to get that variable APP_PASSWORD...
in the node js, I do
const APP_PASSWORD = process.argv.slice(2);
console.log(process.argv);
but what is Get is
[ '/usr/local/bin/node', '/opt/atlassian/pipelines/agent/build/pipelines/skip-previous.js', '$APP_PASSWORD' ]
i tried with "
or '
or --
but nothing...
Upvotes: 1
Views: 1183
Reputation: 3621
Try using process.env.APP_PASSWORD
in your js code.
The APP_PASSWORD variable is an environment variable and therefore should be accessible through process.env
Upvotes: 2