簡體   English   中英

使用環境變量替換在 CodeBuild 中運行 aws cli 命令

[英]Run aws cli command in CodeBuild with environment variable substituion

我試圖在來自 buildspec.yml 的 CodeBuild 結束時運行 aws cli 命令。

容器/圖像是“aws/codebuild/amazonlinux2-x86_64-standard:1.0”

我有一個 $Branch 環境變量(當前設置為“master”)

我想運行命令“aws codepipeline start-pipeline-execution --name bbentityinterface-master-Pipeline”

我試過“aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline)”和“aws codepipeline start-pipeline-execution --name bbentityinterface-$Branch-Pipeline”

並且都失敗了。

“aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline)”失敗如下(來自日志):

如何正確構造此行以執行命令?

運行命令 aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline) /codebuild/output/tmp/script.sh: line 4: bbentityinterface-master-Pipeline: command not found usage: aws [options] [ ...] [參數] 要查看幫助文本,您可以運行:

aws 幫助 aws 幫助 aws 幫助 aws:錯誤:參數 --name:需要一個參數

[Container] 2020/01/08 15:46:40 命令沒有成功退出aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline) exit status 2

弄清楚了...

eval "aws codepipeline start-pipeline-execution --name bbentityinterface-$Branch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM