Skip to content
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

(core): bug with BundlingDockerImage.cp #13273

Assignees
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/small Small work item – less than a day of effort needs-triage This issue or PR still needs to be triaged. p1

Comments

@bigkraig
Copy link

BundlingDockerImage.cp uses dockerExec to create a container from the image to cp files out of. dockerExec was modified in #12001 to show the stdout/stderr, which has prevented the stdout from being returned.

I've submitted a PR that fixes the issue #13271

Reproduction Steps

Sample repo to reproduce the issue:
https://github.com/bigkraig/cdk-docker-cp

What did you expect to happen?

cp to copy the file from the image.

What actually happened?

The container id is printed, but not returned to cp to continue.

$ cdk synth
[+] Building 1.2s (7/7) FINISHED                                                                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 36B                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                      1.1s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                         0.0s
 => [1/2] FROM docker.io/library/alpine@sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be                                                                       0.0s
 => CACHED [2/2] RUN echo test > /hello.txt                                                                                                                                           0.0s
 => exporting to image                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                               0.0s
 => => writing image sha256:7b67c7b2cffd9a5181e1561ba427333e42333dd5b68e180e20524593bed83450                                                                                          0.0s
 => => naming to docker.io/library/cdk-ef58d8b98ca16cdb3a02a7184de50cd6f36ed0e8d69b061d0d84436cbe909939                                                                               0.0s
b57ec5676652d885c89e2a23bae3113085b2cb595fe4737f0b3ce18ef9866894
TypeError: Cannot read property 'toString' of null
    at BundlingDockerImage.cp (/Users/kamador/src/cdk-docker-cp/node_modules/@aws-cdk/core/lib/bundling.ts:201:26)
    at new CdkDockerCpStack (/Users/kamador/src/cdk-docker-cp/lib/cdk-docker-cp-stack.ts:10:11)
    at Object.<anonymous> (/Users/kamador/src/cdk-docker-cp/bin/cdk-docker-cp.ts:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1091:14)
    at Module.m._compile (/Users/kamador/src/cdk-docker-cp/node_modules/ts-node/src/index.ts:1056:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/kamador/src/cdk-docker-cp/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:971:32)
    at Function.Module._load (node:internal/modules/cjs/loader:812:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
npm ERR! code 1
npm ERR! path /Users/kamador/src/cdk-docker-cp
npm ERR! command failed
npm ERR! command sh -c ts-node "--prefer-ts-exts" "bin/cdk-docker-cp.ts"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kamador/.npm/_logs/2021-02-24T23_59_07_006Z-debug.log
Subprocess exited with error 1

Environment

  • CDK CLI Version : 1.91.0
  • Framework Version: 1.91.0
  • Node.js Version: v15.9.0
  • OS : MacOS and in CodeFresh CICD
  • Language (Version): TypeScript 4.1.5

Other


This is 🐛 Bug Report

@bigkraig bigkraig added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 25, 2021
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Feb 25, 2021
@bigkraig
Copy link
Author

bigkraig commented Feb 25, 2021

Related to #13152

@jogold
Copy link
Contributor

jogold commented Feb 25, 2021

Should be fixed once #12258 (reverted) is redone.

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p1 labels Feb 25, 2021
@mergify mergify bot closed this as completed in #13318 Feb 28, 2021
mergify bot pushed a commit that referenced this issue Feb 28, 2021
Use the result of a Docker build as code. The runtime code is expected to be
located at `/asset` in the image.

Also deprecate `BundlingDockerImage` in favor of `DockerImage`.

Closes #13273 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

This was referenced Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment