aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.61k stars 3.91k forks source link

cdk-assets: Messaging should be more explicit around asset publishing. #14403

Open bgshacklett opened 3 years ago

bgshacklett commented 3 years ago

CDK should be more explicit about its actions in status messages when assets are being published. If cached assets are used, this should be explained to the user by default, not limited to verbose output.

Use Case

Recent failures with packaging (see: https://github.com/aws/aws-cdk/issues/12536) led to a long troubleshooting process for me and my team. If CDK was explicit that cached assets in the staging bucket were not being overwritten, it would have removed a lot of uncertainty regarding what was actually going on.

Proposed Solution

Update messaging to be more explicit about the asset publishing process.

Current Messaging

CdkTestStack: deploying...
[0%] start: Publishing f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
[100%] success: Published f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
CdkTestStack: creating CloudFormation changeset...

Proposed Messaging

CdkTestStack: deploying...
[0%] start: Publishing f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
[0%] found: Found s3://cdktoolkit-stagingbucket-ab52pr18ol6w/assets/f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684.zip
[100%] success: Using existing published asset: f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
CdkTestStack: creating CloudFormation changeset...

Other

Full output of current behavior, including verbose output:

CdkTestStack: deploying...
Waiting for stack CDKToolkit to finish creating or updating...
[AWS cloudformation 200 0.112s 0 retries] describeStacks({ StackName: 'CDKToolkit' })
[AWS cloudformation 200 0.092s 0 retries] describeStacks({ StackName: 'CdkTestStack' })
Preparing asset f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684: {"path":"asset.f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684","id":"f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684","packaging":"zip","sourceHash":"f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684","s3BucketParameter":"AssetParametersf406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684S3Bucket22C26EA4","s3KeyParameter":"AssetParametersf406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684S3VersionKeyC8C31F3E","artifactHashParameter":"AssetParametersf406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684ArtifactHash8E6E5A94"}
Storing asset asset.f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684 at s3://cdktoolkit-stagingbucket-ab52pr18ol6w/assets/f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684.zip
CdkTestStack: checking if we can skip deploy
[AWS cloudformation 200 0.073s 0 retries] getTemplate({ StackName: 'CdkTestStack', TemplateStage: 'Original' })
CdkTestStack: template has changed
CdkTestStack: deploying...
[0%] start: Publishing f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
[0%] check: Check s3://cdktoolkit-stagingbucket-ab52pr18ol6w/assets/f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684.zip
[AWS s3 200 0.191s 0 retries] getBucketLocation({ Bucket: 'cdktoolkit-stagingbucket-ab52pr18ol6w' })
[AWS s3 200 0.073s 0 retries] listObjectsV2({
  Bucket: 'cdktoolkit-stagingbucket-ab52pr18ol6w',
  Prefix: 'assets/f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684.zip',
  MaxKeys: 1
})
[0%] found: Found s3://cdktoolkit-stagingbucket-ab52pr18ol6w/assets/f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684.zip
[100%] success: Published f406de8131dc4c76d441630e7f2b643a0a8f4aeafdf68ced20ed731754cb4684:current
Removing existing change set with name cdk-deploy-change-set if it exists
[AWS cloudformation 200 0.094s 0 retries] deleteChangeSet({ StackName: 'CdkTestStack', ChangeSetName: 'cdk-deploy-change-set' })
Attempting to create ChangeSet with name cdk-deploy-change-set to update stack CdkTestStack
CdkTestStack: creating CloudFormation changeset...

This is a :rocket: Feature Request

eladb commented 3 years ago

Routing to @rix0rrr

github-actions[bot] commented 2 years ago

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

bgshacklett commented 2 years ago

Please don't auto-close.