【发布时间】:2020-07-15 23:18:22
【问题描述】:
我正在将 aws cloudformation 集成到我的 jenkins 管道中。我想执行一个
$ aws cloudformation describe-stacks --stack-name dev-nics-proxyservlet-svc --region us-west-2
命令查看我是否有一个带有我正在寻找的名称的堆栈。如果命令发现栈存在,我想删除栈:
$ aws cloudformation delete-stack --stack-name dev-nics-proxyservlet-svc
但是如果堆栈不存在,我想创建堆栈:
aws cloudformation create-stack --stack-name dev-nics-proxyservlet-svc --region us-west-2 --template-body file://dev-nics-proxyservlet-cluster.yml --parameters file://dev-nics-proxyservlet-svc-param.json --capabilities "CAPABILITY_IAM" "CAPABILITY_NAMED_IAM"
如何在声明性的多分支 jenkins 管道中编写这个 shell comman?任何帮助表示赞赏。 谢谢!
【问题讨论】:
-
这应该在
bash? -
我这么认为?不确定是否有办法在 groovy 中做到这一点
-
好的。您可以在 bash 中查看我的答案。
标签: shell if-statement jenkins amazon-cloudformation multibranch-pipeline