cdklabs / cdklabs/cdk-cicd-wrapper
[BUG] Race condition for logging bucket
- Dominant language
- TypeScript
- Stars
- 34
- Forks
- 9
- Avg merge
- 2h 57m
- Merged PRs (30d)
- 48
Description
### Describe the bug
The first time a stage is deployed there is a race condition where the Deploy action requires a bucket from the ComplianceLogBucketStack and fails with an error like this:
```
Resource handler returned message: "The target bucket for logging does not exist (Service: S3, Status Code: 400
```
This also leaves the Cloudformation stack in the "Rollback Complete" state, so if you retry the the failed deploy action or the entire stage, it will fail with:
```
Stack:arn:aws:cloudformation:ap-southeast-2:123456789:stack/INT-mystack/... is in ROLLBACK_COMPLETE state and can not be updated
```
If you delete the rolled back Cloudformation template in the deployment account the Deploy stage will run successfully on the second try.
I have replicated this in two stages.
### Expected Behavior
The Deploy stage will complete without errors
### Current Behavior
The deploy stage may fail on the first deployment if the ComplianceLogBucket stack has not created the log bucket before the deploy stack references it.
### Reproduction Steps
I created a simple app with the following stack
```
const app = new cdk.App();
PipelineBlueprint.builder().defineStages([Stage.RES, Stage.DEV, Stage.INT])
.addStack({provide: (context) => {
const testwrapper = new cicdwrapperStack(context.scope, 'cicdwrapperStack3', {});
Tags.of(testwrapper).add('Project', 'TestWrapper3');
}
})
.synth(app);
```
Both Dev and Int failed on the first deployment, but were OK from then on.
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CI/CD Wrapper version used
"@cdklabs/cdk-cicd-wrapper": "^0.2.17", "@cdklabs/cdk-cicd-wrapper-cli": "^0.2.15",
### Environment details (OS name and version, etc.)
Code is edited on OSX, but the deployment is from CodeBuild
Contributor guide
Assessment
This issue has not been assessed yet.