Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Multiple deployments steps

Samer Jarmakani June 27, 2021

I'm trying to find out if my issue relates to this: https://jira.atlassian.com/browse/BCLOUD-18261

We have 3 EC2 instances. Staging, Live, and Live SaaS.

When pushing to the staging branch, I want it to just deploy to staging. This works fine.

When pushing to the master branch, I want it to deploy to Staging > Live (manual step) and Live SaaS (manual step). This way I can manually deploy to Live once Staging has been tested, and then deploy to Live SaaS if Live has had no issues.

Here's my bitbucket-pipelines.yml:

image: atlassian/default-image:2

definitions:
steps:
- step: &build
name: Build
script:
- zip -r projectnav.zip *
artifacts:
- projectnav.zip
pipelines:
branches:
staging:
- step: *build
- step:
name: Upload to S3
services:
- docker
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'upload'
APPLICATION_NAME: ${APP_NAME_STAGING}
S3_BUCKET: ${S3_BUCKET}
ZIP_FILE: 'projectnav.zip'
- step:
name: Deploy to Staging
deployment: staging
services:
- docker
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APP_NAME_STAGING}
S3_BUCKET: ${S3_BUCKET}
DEPLOYMENT_GROUP: ${DEPLOYMENT_GROUP_STAGING}
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
WAIT: 'true'
master:
- step: *build
- step:
name: Upload to S3
services:
- docker
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'upload'
APPLICATION_NAME: ${APP_NAME_LIVE_SAAS}
S3_BUCKET: ${S3_BUCKET}
ZIP_FILE: 'projectnav.zip'
- step:
name: Deploy to Staging
deployment: staging
services:
- docker
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APP_NAME_LIVE_SAAS}
S3_BUCKET: ${S3_BUCKET}
DEPLOYMENT_GROUP: ${DEPLOYMENT_GROUP_STAGING}
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
WAIT: 'true'
- step:
name: Deploy to SaaS
trigger: manual
deployment: production
services:
- docker
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APP_NAME_LIVE_SAAS}
S3_BUCKET: ${S3_BUCKET}
DEPLOYMENT_GROUP: ${DEPLOYMENT_GROUP_LIVE_SAAS}
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
WAIT: 'true'

 It fails on the Deploy to Staging step with the following error:

An error occurred (DeploymentGroupDoesNotExistException) when calling the CreateDeployment operation: No Deployment Group found for name: ProjectNavStagingDeploymentGroup

If I change the APPLICATION_NAME variables so that they correspond to each step (APP_NAME_STAGING for the Staging step), I get this error:

An error occurred (RevisionDoesNotExistException) when calling the GetApplicationRevision operation: No application revision found for revision.

I have the CodeDeploy applications and deployment groups all setup in CodeDeploy, and I've checked to make sure the variables are set correctly in BitBucket.

Is it just not possible to have multiple deployment steps for CodeDeploy? The issue seems to be around the APPLICATION_NAME and DEPLOYMENT_GROUP variables. I'm not exactly sure what they should be for each step. Any help would be greatly appreciated. Thanks!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events