【发布时间】:2020-12-04 16:55:23
【问题描述】:
在执行 Azure DevOps 版本时,是否可以从 shell 脚本填充 Azure DevOps 库变量?
我的最终目标是在发布管道中的“替换令牌”任务中使用它,以便将秘密放入 yaml 中(比我目前拥有的要干净得多)。替换标记仅适用于 ADO 库变量。
我目前的解决方法是使用 sed 替换秘密给我的内容,并将其输出到另一个 yaml,我用它来部署 Kubernetes。任何替代方案都会很棒!
这是我现在拥有的 -
# Lets get the DB and Redis PW from AWS Secrets - used so we only have to set or change the passwords in one place - AWS Secrets
# Note that the AWS_secret_arn is different between stage and release and the variable is set in the library AppConfigs_xxxxx
DB_PW=$(aws secretsmanager get-secret-value --secret-id $(AWS_secret_arn) | jq -r '.SecretString' | jq -r '.db_pw')
echo " *** The secret is - " $DB_PW
# We are replacing the db_password with the one we acquired from AWS secrets
sed "s/db_pw_placeholder/$DB_PW/g" service.yaml > service-final.yaml
echo "### kubectl apply now running the service manifest ###"
kubectl apply -f service-final.yaml
我还想使用相同的方法从 AWS 获取其他参数以填充 ADO 变量库 - 例如 RDS DB 端点。
【问题讨论】:
-
嗨@ErnieAndBert。这张票有什么更新吗?如果答案能给你一些帮助,请随时告诉我。只是提醒this。
标签: amazon-web-services azure-devops azure-pipelines