我想使用AWS CDK创建CodeDeploy部署。当前,如果部署失败,则会回滚整个CDK堆栈。是否可以忽略部署的任何失败?
例如,以下是cdk deploy
的输出,显示了回滚:
test-release-1: deploying...
test-release-1: creating CloudFormation changeset...
0/5 | 00:34:43 | CREATE_IN_PROGRESS | AWS::IAM::Role | test-release-1-CodeDeployRole (testrelease1CodeDeployRole533AAAB6)
0/5 | 00:34:43 | CREATE_IN_PROGRESS | AWS::CodeDeploy::Application | test-release-1-tls_proxy_ir (testrelease1tlsproxyir46F038FD)
0/5 | 00:34:43 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata
0/5 | 00:34:44 | CREATE_IN_PROGRESS | AWS::IAM::Role | test-release-1-CodeDeployRole (testrelease1CodeDeployRole533AAAB6) Resource creation Initiated
0/5 | 00:34:44 | CREATE_IN_PROGRESS | AWS::CodeDeploy::Application | test-release-1-tls_proxy_ir (testrelease1tlsproxyir46F038FD) Resource creation Initiated
1/5 | 00:34:44 | CREATE_COMPLETE | AWS::CodeDeploy::Application | test-release-1-tls_proxy_ir (testrelease1tlsproxyir46F038FD)
1/5 | 00:34:45 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata Resource creation Initiated
2/5 | 00:34:45 | CREATE_COMPLETE | AWS::CDK::Metadata | CDKMetadata
3/5 | 00:35:00 | CREATE_COMPLETE | AWS::IAM::Role | test-release-1-CodeDeployRole (testrelease1CodeDeployRole533AAAB6)
3/5 | 00:35:03 | CREATE_IN_PROGRESS | AWS::CodeDeploy::DeploymentGroup | test-release-1-tls_proxy_ir-cdk-test (testrelease1tlsproxyircdktest)
3/5 | 00:35:03 | CREATE_IN_PROGRESS | AWS::CodeDeploy::DeploymentGroup | test-release-1-tls_proxy_ir-cdk-test (testrelease1tlsproxyircdktest) Resource creation Initiated
4/5 | 00:35:34 | CREATE_FAILED | AWS::CodeDeploy::DeploymentGroup | test-release-1-tls_proxy_ir-cdk-test (testrelease1tlsproxyircdktest) Deployment d-7MWZ2VBK1 failed. Status=Failed
C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7853:49
\_ Kernel._wrapSandboxCode (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:8313:20)
\_ Kernel._create (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7853:26)
\_ Kernel.create (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7600:21)
\_ KernelHost.processRequest (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7388:28)
\_ KernelHost.run (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7328:14)
\_ Immediate._onImmediate (C:\Users\JOHN~1.TIP\AppData\Local\Temp\jsii-java-runtime8625275517600395680\jsii-runtime.js:7331:37)
\_ processImmediate (internal/timers.js:456:21)
4/5 | 00:35:35 | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack | test-release-1 The following resource(s) failed to create: [testrelease1tlsproxyircdktest]. . Rollback requested by user.
4/5 | 00:35:43 | DELETE_IN_PROGRESS | AWS::CodeDeploy::Application | test-release-1-tls_proxy_ir (testrelease1tlsproxyir46F038FD)
4/5 | 00:35:43 | DELETE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata
4/5 | 00:35:44 | DELETE_IN_PROGRESS | AWS::CodeDeploy::DeploymentGroup | test-release-1-tls_proxy_ir-cdk-test (testrelease1tlsproxyircdktest)
5/5 | 00:35:44 | DELETE_COMPLETE | AWS::CodeDeploy::DeploymentGroup | test-release-1-tls_proxy_ir-cdk-test (testrelease1tlsproxyircdktest)
6/5 | 00:35:44 | DELETE_COMPLETE | AWS::CodeDeploy::Application | test-release-1-tls_proxy_ir (testrelease1tlsproxyir46F038FD)
6/5 | 00:35:44 | DELETE_IN_PROGRESS | AWS::IAM::Role | test-release-1-CodeDeployRole (testrelease1CodeDeployRole533AAAB6)
7/5 | 00:35:44 | DELETE_COMPLETE | AWS::CDK::Metadata | CDKMetadata
8/5 | 00:35:46 | DELETE_COMPLETE | AWS::IAM::Role | test-release-1-CodeDeployRole (testrelease1CodeDeployRole533AAAB6)
9/5 | 00:35:47 | ROLLBACK_COMPLETE | AWS::CloudFormation::Stack | test-release-1
如果部署失败,我只希望CDK堆栈继续运行而没有错误,即没有回滚。这可能吗,我该如何实现?
答案 0 :(得分:0)
AWS-CDK
中有针对该功能的 open GitHub 问题:
因此,暂时无法在CDK中设置回滚行为。如果有帮助,可以在CLI(--disable-rollback or --rollback-configuration)中完成。