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] asset bundling fails with DOCKER_BUILDKIT=1 #8910

Closed
elthrasher opened this issue Jul 6, 2020 · 1 comment
Closed

[core] asset bundling fails with DOCKER_BUILDKIT=1 #8910

elthrasher opened this issue Jul 6, 2020 · 1 comment
Assignees
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@elthrasher
Copy link
Contributor

Asset bundler fails with Docker buildkit. This is because of a regex searching for "Successfully built " which doesn't appear when using buildkit. Buildkit may some day be the default and some systems are already using buildkit by default so it's best to support both versions of docker build.

Reproduction Steps

The tests in aws-s3-assets can reproduce this issue handily:

% DOCKER_BUILDKIT=0 npm t

> @aws-cdk/aws-s3-assets@0.0.0 test /Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/aws-s3-assets
> cdk-test

PASS test/compat.test.js
PASS test/asset.test.js

=============================== Coverage summary ===============================
Statements   : 94.23% ( 49/52 )
Branches     : 86.21% ( 25/29 )
Functions    : 100% ( 6/6 )
Lines        : 94.23% ( 49/52 )
================================================================================

Test Suites: 2 passed, 2 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        2.039s, estimated 3s
Ran all test suites.
Verifying integ.assets.bundling.lit.js against integ.assets.bundling.lit.expected.json ... OK.
Verifying integ.assets.directory.lit.js against integ.assets.directory.lit.expected.json ... OK.
Verifying integ.assets.file.lit.js against integ.assets.file.lit.expected.json ... OK.
Verifying integ.assets.permissions.lit.js against integ.assets.permissions.lit.expected.json ... OK.
Verifying integ.assets.refs.lit.js against integ.assets.refs.lit.expected.json ... OK.
Verifying integ.multi-assets.js against integ.multi-assets.expected.json ... OK.
Tests successful. Total time (5.4s) | cdk-integ-assert (2.8s) | /Users/mattmorgan/mine/aws-cdk/node_modules/jest/bin/jest.js (2.6s)

The test works just fine when buildkit is disabled.

% DOCKER_BUILDKIT=1 npm t

> @aws-cdk/aws-s3-assets@0.0.0 test /Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/aws-s3-assets
> cdk-test

PASS test/compat.test.js
PASS test/asset.test.js

=============================== Coverage summary ===============================
Statements   : 94.23% ( 49/52 )
Branches     : 86.21% ( 25/29 )
Functions    : 100% ( 6/6 )
Lines        : 94.23% ( 49/52 )
================================================================================

Test Suites: 2 passed, 2 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        2.19s, estimated 3s
Ran all test suites.
Verifying integ.assets.bundling.lit.js against integ.assets.bundling.lit.expected.json ... /Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/core/lib/bundling.js:37
            throw new Error('Failed to extract image ID from Docker build output');
            ^

Error: Failed to extract image ID from Docker build output
    at Function.fromAsset (/Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/core/lib/bundling.js:37:19)
    at new TestStack (/Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js:14:51)
    at Object.<anonymous> (/Users/mattmorgan/mine/aws-cdk/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js:28:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
Error: Command exited with status 1
    at exec (/Users/mattmorgan/mine/aws-cdk/tools/cdk-integ-tools/lib/integ-helpers.js:297:15)
    at IntegrationTest.cdkSynthFast (/Users/mattmorgan/mine/aws-cdk/tools/cdk-integ-tools/lib/integ-helpers.js:85:15)
    at main (/Users/mattmorgan/mine/aws-cdk/tools/cdk-integ-tools/bin/cdk-integ-assert.js:17:35)
Error: cdk-integ-assert exited with error code 1
Tests failed. Total time (3.2s) | /Users/mattmorgan/mine/aws-cdk/node_modules/jest/bin/jest.js (2.7s) | cdk-integ-assert (0.4s)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
npm ERR! Test failed.  See above for more details.

It fails when buildkit is enabled.

Error Log

Error: Failed to extract image ID from Docker build output

Environment

  • **CLI Version :1.49.1
  • **Framework Version:1.49.1
  • **Node.js Version:12.18.2
  • **OS :MacOS
  • **Language (Version):TypeScript(3.9.5)

Other

It's a fairly easy fix. PR coming.


This is 🐛 Bug Report

@elthrasher elthrasher added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 6, 2020
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Jul 6, 2020
elthrasher added a commit to elthrasher/aws-cdk that referenced this issue Jul 6, 2020
@elthrasher
Copy link
Contributor Author

Should be fixed by #8911

@eladb eladb closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants