是否可以忽略使用 AWS CDK 创建的部署的 CodeDeploy 部署错误?
Is it possible to ignore CodeDeploy deployment errors for deployments created using AWS CDK?
我想使用 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 堆栈继续无错误地继续,即不回滚。这可能吗?我该如何实现?
AWS-CDK
中的该功能有一个 open GitHub issue:
所以设置回滚行为暂时不能在CDK中设置。如果有帮助,您可以在 CLI (--disable-rollback or --rollback-configuration) 中完成。
我想使用 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 堆栈继续无错误地继续,即不回滚。这可能吗?我该如何实现?
AWS-CDK
中的该功能有一个 open GitHub issue:
所以设置回滚行为暂时不能在CDK中设置。如果有帮助,您可以在 CLI (--disable-rollback or --rollback-configuration) 中完成。