[cdk-pipelines] Stacks in stage doesn't get deployed in parallel when stage.add_application is used?
See original GitHub issue❓ Parallel Deployment to Multiple Accounts
The Question
[1]: CDK Pipeline does not deploy the a stack in two accounts in parallel
environments = self.node.try_get_context("environments")
stage = pipeline.add_stage("dev")
stage.add_application(EpsRoute53(self, f"dev01-route53", env=environments["dev01"], account_identifier="dev01"))
stage.add_application(EpsRoute53(self, f"dev02-route53", env=environments["dev02"], account_identifier="dev02"))
Note, environments[“dev01”], - account, region combination
Result: The stack EpsRoute53 is getting ordered as follows
- dev01-epsroute53.prepare
- dev01-epsroute53.deploy
- dev02-epsroute53.prepare
- dev02-epsroute53.deploy
I had to change to using something like this to get it added pipeline stage actions in parallel.
environments = self.node.try_get_context("environments")
stage = pipeline.add_stage("dev")
stage.add_actions(pipelines.DeployCdkStackAction(action_role=iam.Role.from_role_arn(self, id="role-dev01",role_arn="arn:aws:iam::<account-dev01>:role/<pipeline-role-arn>"),
stack_name="dev01-route53-domain-stack",
template_path="<path of the template>",
region="us-west-2",
cloud_assembly_input=cloud_assembly_artifact,
prepare_run_order=1,
execute_run_order=2,
cloud_formation_execution_role=iam.Role.from_role_arn(self, id="role-dev01a",
role_arn="arn:aws:iam::<account-dev01>:role/cdk-XXXX-cfn-exec-role-<account-dev01>-us-west-2")
)))
stage.add_actions(pipelines.DeployCdkStackAction(action_role=iam.Role.from_role_arn(self, id="role-dev01",role_arn="arn:aws:iam::<account-dev02>:role/<pipeline-role-arn>"),
stack_name="dev02-route53-domain-stack",
template_path="<path of the template>",
region="us-west-2",
cloud_assembly_input=cloud_assembly_artifact,
prepare_run_order=1,
execute_run_order=2,
cloud_formation_execution_role=iam.Role.from_role_arn(self, id="role-dev02a",
role_arn="arn:aws:iam::<account-dev02>:role/cdk-XXXX-cfn-exec-role-<account-dev02>-us-west-2")
)))
Is this an expected behavior?
Environment
- CDK CLI Version: 1.60.0 (build 8e3f53a)
- Module Version: 1.60.0
- Node.js Version: v12.18.2
- OS: CentOS Linux release 7.8.2003 (Core)
- Language (Version): Python 3.7.9
Other information
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Continuous integration and delivery (CI/CD) using CDK ...
CDK Pipelines are self-updating. If you add application stages or stacks, the pipeline automatically reconfigures itself to deploy those new stages or ...
Read more >Deploy stacks in parallel with AWS CDK Pipelines
For the deployment of the first application, it does two actions in the stage; "prepare" and "deploy". These are linked to "RunOrder: 1"...
Read more >AWS CDK Pipeline: Assets stage fails to find buildSpec ...
We are trying to get our multi-stack application deployed using the cdk pipeline library. We have recently disabled the ...
Read more >Production-Ready CDK - CDK Pipelines - Luminis
Don't use 'cdk deploy' in your pipelines ... import { Stack, StackProps, Stage } from 'aws-cdk-lib'; import { CodePipeline, ...
Read more >DEPLOY YOUR APPLICATION TO AWS USING CDK ...
For deploying your application to the cloud you will be using AWS CDK Pipelines. CDK Pipelines are a high level construct from CDK...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The workaround we ended up using is:
It resets the run order after each application and allows them to run in parallel.
@rix0rrr , Thank you for reviewing my request. Any tentative of ETA on when we could get this feature added?
Even with run order say if I had two accounts, the action in runOrder 1 has to be successful for both the accounts for action in subsequent order to start. Instead of stopping the whole pipeline when a deployments fails in one of the many accounts, shouldn’t it stop just the deployment just in that one account and push forward in the remaining accounts.