2
votes

I am trying to run an aws cli command at the end of a CodeBuild from the buildspec.yml.

The container/image is "aws/codebuild/amazonlinux2-x86_64-standard:1.0"

I have an environment variable of $Branch (currently set to 'master')

and I want to run the command "aws codepipeline start-pipeline-execution --name bbentityinterface-master-Pipeline"

I have tried "aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline)" and "aws codepipeline start-pipeline-execution --name bbentityinterface-$Branch-Pipeline"

and both fail.

"aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline)" fails as below (from the log):

How can I properly construct this line to execute the command?

Running command 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] [ ...] [parameters] To see help text, you can run:

aws help aws help aws help aws: error: argument --name: expected one argument

[Container] 2020/01/08 15:46:40 Command did not exit successfully aws codepipeline start-pipeline-execution --name $(bbentityinterface-$Branch-Pipeline) exit status 2

1

1 Answers

2
votes

Figured it out...

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