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
ecs.ContainerImage.fromAsset broken in 1.30 #6814
Labels
@aws-cdk/aws-ecs
Related to Amazon Elastic Container
bug
This issue is a bug.
documentation
This is a problem with documentation.
p0
Comments
doomsower
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Mar 19, 2020
This issue also appears to exist for "DockerImageAsset" |
SoManyHs
added
documentation
This is a problem with documentation.
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Mar 23, 2020
MrArnoldPalmer
added a commit
to MrArnoldPalmer/aws-cdk
that referenced
this issue
Mar 23, 2020
Previously, users were allowed to pass a the `file` argument in DockerImageAssetProps with a directory included in the string, IE: 'my-dir/Dockerfile'. This worked because when calling `docker build`, the --file argument was formatted by prepending the asset's staging directory. However, this was removed in v1.30.0 with the assumption that `file` could contain only a filename and `directory` included all other relative path information. This resulted in the docker build command receiving a --file argument that was relative to the ${cwd} and possibly wrong. This is resolved by using `path.resolve` to get the file's full path. Changes to how we are passing directory information to compute the asset's hash were required to not break existing asset hashes. Otherwise there is a possibility that a directory other than the one where the Dockerfile resides was being referenced when hashing the asset's contents. fixes: aws#6814
Looking into it. |
We have identified the problem and working on a fix. You can follow the progress in this tracking issue: #6954 |
MrArnoldPalmer
added a commit
to MrArnoldPalmer/aws-cdk
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as '.'. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: aws#6954 aws#6814
MrArnoldPalmer
added a commit
to MrArnoldPalmer/aws-cdk
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as '.'. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: aws#6954 aws#6814
MrArnoldPalmer
added a commit
to MrArnoldPalmer/aws-cdk
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as '.'. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: aws#6954 aws#6814
MrArnoldPalmer
added a commit
to MrArnoldPalmer/aws-cdk
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as '.'. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: aws#6954 aws#6814
Internal tracking ref: V188269601 |
mergify bot
pushed a commit
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as `.`. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: #6954 #6814
shivlaks
pushed a commit
that referenced
this issue
Mar 24, 2020
Prior v1.29.0, the context passed to the docker build command was always the current working directory. In v1.29.0, this was changed to be the directory the user passed when instantiating the asset. However, docker doesn't respect the context passed to the build command when the `--file` argument is also passed. This broke assets for users passing the `file` prop when constructing a `DockerImageAsset`. This is fixed by changing the current working directory of the `docker build` command and passing that context as `.`. Then docker uses the current working directory as the context and correctly finds the image definition file from the `file` prop. An existing integration test in the framework covers this case, but does not fail unless the stack is deployed fresh since the asset isn't rebuilt when the hash is not changed. Fix: #6954 #6814
Resolved in v1.31.0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@aws-cdk/aws-ecs
Related to Amazon Elastic Container
bug
This issue is a bug.
documentation
This is a problem with documentation.
p0
I've upgraded
aws-cdk
and@aws-cdk/*
packages from1.28.0
to1.30.0
andecs.ContainerImage.fromAsset
got broken.Docker asset is defined like this:
CLI output says that
1.30.0
builds docker images with command that looks like:And it breaks, because path
services/backend/Dockerfile
is relative to cdk project dir and it doesn't exist.1.28.0
uses:So
1.30.0
builds and tags images differently, but changelog doesn't mention it.Downgrading back to
1.28.0
solves the problem.Reproduction Steps
Error Log
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: