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

fix(ecr-assets): cannot build ARM images using modern stack synthesis #20563

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/test/image-asset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@ describe('image asset', () => {
expect(assetMetadata && (assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry).platform).toEqual('linux/arm64');
});

testFutureBehavior('with platform: default synth edition', flags, App, (app) => {
// GIVEN
const stack = new Stack(app, 'Stack', { synthesizer: new DefaultStackSynthesizer() });
// WHEN
const asset = new DockerImageAsset(stack, 'Image', {
directory: path.join(__dirname, 'demo-image'),
platform: Platform.LINUX_ARM64,
});

// THEN
const asm = app.synth();
const stackAssets = JSON.parse(fs.readFileSync(path.join(asm.directory, 'Stack.assets.json'), { encoding: 'utf-8' }));
const dockerImageAsset = stackAssets.dockerImages[asset.assetHash];
expect(dockerImageAsset.source.platform).toEqual('linux/arm64');
});

testFutureBehavior('asset.repository.grantPull can be used to grant a principal permissions to use the image', flags, App, (app) => {
// GIVEN
const stack = new Stack(app);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class AssetManifestBuilder {
dockerBuildTarget: asset.dockerBuildTarget,
dockerFile: asset.dockerFile,
networkMode: asset.networkMode,
platform: asset.platform,
},
destinations: {
[this.manifestEnvName(stack)]: {
Expand Down