-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asset publishing: docker image publishing to ECR can fail, and the cloudformation deploy proceeds anyway #25827
Comments
Thanks for the report. I am making it p2 bug and will look into this issue when we can reproduce it. |
I also encountered this problem, and you can reproduce it just with an invalid Dockerfile. CDK code: import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as lambda from 'aws-cdk-lib/aws-lambda';
export class DockerAssetFailStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new lambda.DockerImageFunction(this, 'Function', {
code: lambda.DockerImageCode.fromImageAsset(__dirname),
});
}
} and Dockerfile: FROM alpine
# add an invalid file
ADD dummy ./ Then deployment continues even after the docker build error:
Also, I found that at least in CDK v2.64.0, this issue did not exist. I guess it was introduced somewhere between v2.64.0 - 2.81.0. edit) I confirmed that it was introduced on v2.80.0. |
pinging @rix0rrr as it may be relevant with #25536. I guess we need another condition to check aws-cdk/packages/aws-cdk/lib/util/asset-publishing.ts Lines 106 to 109 in 3bd973a
|
|
1 similar comment
|
Describe the bug
I found a case where the docker push to ECR failed, but CDK still attempted to deploy the cloudformation stack anyway.
Relevant section from my build logs (with project/account specific details redacted)
Expected Behavior
I expect CDK should have failed with exit code 1 after the failed docker push, not continued anyway and attempted to deploy the cloudformation stack.
Current Behavior
CDK failed to push the asset container image to ECR, and then proceeded to deploy the cloudformation stack anyway.
Reproduction Steps
The ECR push failure was a one-off problem, so I can't reliably reproduce it - just logging this issue for awareness that some cases of asset publishing failures do not fail in the way I'd expect.
Possible Solution
Better error handling for docker image asset publishing failures.
Additional Information/Context
No response
CDK CLI Version
2.81.0
Framework Version
No response
Node.js Version
18
OS
Ubuntu
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: