Reputation: 1348
I am using the codedeploy orb to deploy my application to AWS and instead of hardcoding the values in there like application-name etc, i am trying to pass variables instead but the orb doesn’t seem to be respecting the variables.
This is my code
deploy:
executor: aws-cli/default
steps:
- aws-cli/setup:
profile-name: my-role
- checkout
- run :
name: "Set stage name"
command: |
stage=$(echo "${CIRCLE_USERNAME}" | tr '[:upper:]' '[:lower:]')
- aws-code-deploy/deploy-bundle:
application-name: "my-app-$stage-application"
deployment-group: "my-app-$stage-deployment-group"
bundle-bucket: "my-app-$stage-bucket"
bundle-key: "appspec"
bundle-type: "yaml"
deployment-config: "CodeDeployDefault.ECSAllAtOnce"
But i am running into the following error :-
An error occurred (ApplicationDoesNotExistException) when calling the CreateDeployment operation: No application found for name: my-app- -application
.
So clearly in my-app- -application
the variables is not being set. any ideas on how to resolve it? Thank you.
Upvotes: 0
Views: 645
Reputation: 523
The way you're currently setting your stage
variable is scoped to the "Set stage name" step only.
Try the following instead:
- run :
name: "Set stage name"
command: |
echo "export stage=$(echo "${CIRCLE_USERNAME}"| tr '[:upper:]' '[:lower:]')" >> "$BASH_ENV"
Related documentation:
Upvotes: 0