在Powershell启动的进程中访问Azure DevOps秘密

时间:2019-04-18 15:24:31

标签: node.js powershell azure-devops

ADO秘密变量: MY_SECRET_VAR=blablabla

ADO powershell脚本作为构建任务:

# secrets aren't automatically env variables - so try to explicitly set it
echo "##vso[task.setvariable variable=MY_SECRET_VAR]$(MY_SECRET_VAR)"

# run a node.js script that needs to use the secret
npm run <my-node-script>

Node.js脚本

process.env.MY_SECRET_VAR   //undefined

如何从node.js中将机密作为环境变量访问?

0 个答案:

没有答案