Need to add a variable in place of branch name

Viewed 280

I'm new to AWS Code build and trying to create a build configuration. I've linked my bitbucket account with AWS. AWS is asking me to specify the branch from which I need to run the deployment. I am trying to create a single pipeline for a build where I can select select the branch at the beginning before triggering any build. Below is my configuration. enter image description here

Can someone please help me understand how can I add a variable instead of branch name i.e. develop specified in above image?

Update : I tried following https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-variables.html#actions-variables-examples-env-branchname but I'm getting below error.

enter image description here

When I try adding Manual Approval action group above source for specifying environment variable, I get this.

enter image description here Source is always going to be a first stage. So I'm not understanding where should I specify these environment variables?

1 Answers

CodePipeline is biased towards trunk based development (having a single releaseable branch for your project instead of feature branches etc) so the source stage in your pipeline definition has one single branch by design. When the pipeline executes the branch for the source stage is set so it’s not possible to do what you want directly.

Related