Skip to content

Commit

Permalink
Merge branch 'main' into add-asset-prepublishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 19, 2022
2 parents fb9bf4d + cfad863 commit 9a18370
Show file tree
Hide file tree
Showing 290 changed files with 496 additions and 28,492 deletions.
1 change: 0 additions & 1 deletion .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ env:
{"area":"@aws-cdk/aws-ecs-patterns","keywords":["aws-ecs-patterns","ecs-patterns"],"labels":["@aws-cdk/aws-ecs-patterns"],"assignees":["madeline-k"]},
{"area":"@aws-cdk/aws-efs","keywords":["aws-efs","efs","accesspoint"],"labels":["@aws-cdk/aws-efs"],"assignees":["corymhall"]},
{"area":"@aws-cdk/aws-eks","keywords":["aws-eks","eks","fargateprofile","fargatecluster"],"labels":["@aws-cdk/aws-eks"],"assignees":["otaviomacedo"]},
{"area":"@aws-cdk/aws-eks-legacy","keywords":["aws-eks-legacy","eks-legacy"],"labels":["@aws-cdk/aws-eks-legacy"],"assignees":["otaviomacedo"]},
{"area":"@aws-cdk/aws-elasticache","keywords":["aws-elasticache","elastic-cache"],"labels":["@aws-cdk/aws-elasticache"],"assignees":["otaviomacedo"]},
{"area":"@aws-cdk/aws-elasticbeanstalk","keywords":["aws-elasticbeanstalk","elastic-beanstalk"],"labels":["@aws-cdk/aws-elasticbeanstalk"],"assignees":["Naumel"]},
{"area":"@aws-cdk/aws-elasticloadbalancing","keywords":["aws-elasticloadbalancing","elastic-loadbalancing","elb"],"labels":["@aws-cdk/aws-elasticloadbalancing"],"assignees":["corymhall"]},
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.38.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.38.0-alpha.0...v2.38.1-alpha.0) (2022-08-18)

## [2.38.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.37.1-alpha.0...v2.38.0-alpha.0) (2022-08-17)


Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.38.1](https://github.com/aws/aws-cdk/compare/v2.38.0...v2.38.1) (2022-08-18)

### Reverts

* cli: revert "feat(cli): --concurrency option" ([#21664](https://github.com/aws/aws-cdk/pull/21664)) ([2ad2163b](https://github.com/aws/aws-cdk/commit/2ad2163b96254f9715dff405100a047d6c2c5958))
* cli: revert "feat(cli): cdk watch --concurrency" ([#21665](https://github.com/aws/aws-cdk/pull/21665)) ([6048d4fc](https://github.com/aws/aws-cdk/commit/6048d4fc37239bcd5193d5487464590c786bf56b))

## [2.38.0](https://github.com/aws/aws-cdk/compare/v2.37.1...v2.38.0) (2022-08-17)


Expand Down
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ configure it on the asset itself.
Use `asset.imageUri` to reference the image. It includes both the ECR image URL
and tag.

Use `asset.imageTag` to reference only the image tag.

You can optionally pass build args to the `docker build` command by specifying
the `buildArgs` property. It is recommended to skip hashing of `buildArgs` for
values that can change between different machines to maintain a consistent
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ export class DockerImageAsset extends Construct implements IAsset {
*/
public readonly assetHash: string;

/**
* The tag of this asset when it is uploaded to ECR. The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix.
*/
public readonly imageTag: string;

/**
* The path to the asset, relative to the current Cloud Assembly
*
Expand Down Expand Up @@ -362,6 +367,7 @@ export class DockerImageAsset extends Construct implements IAsset {

this.repository = ecr.Repository.fromRepositoryName(this, 'Repository', location.repositoryName);
this.imageUri = location.imageUri;
this.imageTag = location.imageTag ?? this.assetHash;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/lib/tarball-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export class TarballImageAsset extends Construct implements IAsset {
*/
public readonly assetHash: string;

/**
* The tag of this asset when it is uploaded to ECR. The tag may differ from the assetHash if a stack synthesizer adds a dockerTagPrefix.
*/
public readonly imageTag: string;

constructor(scope: Construct, id: string, props: TarballImageAssetProps) {
super(scope, id);

Expand Down Expand Up @@ -78,6 +83,7 @@ export class TarballImageAsset extends Construct implements IAsset {

this.repository = ecr.Repository.fromRepositoryName(this, 'Repository', location.repositoryName);
this.imageUri = location.imageUri;
this.imageTag = location.imageTag ?? this.assetHash;
}
}

24 changes: 24 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 @@ -405,6 +405,30 @@ describe('image asset', () => {
expect(asset1.assetHash).toEqual('13248c55633f3b198a628bb2ea4663cb5226f8b2801051bd0c725950266fd590');
expect(asset2.assetHash).toEqual('b78978ca702a8eccd37804ce31d76cd83a695b557dbf95aeb109332ee8b1fd32');
});

describe('imageTag is correct for different stack synthesizers', () => {
const stack1 = new Stack();
const stack2 = new Stack(undefined, undefined, {
synthesizer: new DefaultStackSynthesizer({
dockerTagPrefix: 'banana',
}),
});

const directory = path.join(__dirname, 'demo-image-custom-docker-file');

const asset1 = new DockerImageAsset(stack1, 'Asset1', { directory });
const asset2 = new DockerImageAsset(stack2, 'Asset2', { directory });

test('stack with default synthesizer', () => {
expect(asset1.assetHash).toEqual('13248c55633f3b198a628bb2ea4663cb5226f8b2801051bd0c725950266fd590');
expect(asset1.imageTag).toEqual('13248c55633f3b198a628bb2ea4663cb5226f8b2801051bd0c725950266fd590');
});

test('stack with overwritten synthesizer', () => {
expect(asset2.assetHash).toEqual('13248c55633f3b198a628bb2ea4663cb5226f8b2801051bd0c725950266fd590');
expect(asset2.imageTag).toEqual('banana13248c55633f3b198a628bb2ea4663cb5226f8b2801051bd0c725950266fd590');
});
});
});

function testDockerDirectoryIsStagedWithoutFilesSpecifiedInDockerignore(app: App, ignoreMode?: IgnoreMode) {
Expand Down
28 changes: 27 additions & 1 deletion packages/@aws-cdk/aws-ecr-assets/test/tarball-asset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Template } from '@aws-cdk/assertions';
import * as iam from '@aws-cdk/aws-iam';
import { testFutureBehavior } from '@aws-cdk/cdk-build-tools/lib/feature-flag';
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
import { App, Stack } from '@aws-cdk/core';
import { App, Stack, DefaultStackSynthesizer } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import { TarballImageAsset } from '../lib';

Expand Down Expand Up @@ -136,6 +136,32 @@ describe('image asset', () => {
}).toThrow(/Cannot find file at/);

});

describe('imageTag is correct for different stack synthesizers', () => {
const stack1 = new Stack();
const stack2 = new Stack(undefined, undefined, {
synthesizer: new DefaultStackSynthesizer({
dockerTagPrefix: 'banana',
}),
});
const asset1 = new TarballImageAsset(stack1, 'MyAsset', {
tarballFile: 'test/demo-tarball/empty.tar',
});
const asset2 = new TarballImageAsset(stack2, 'MyAsset', {
tarballFile: 'test/demo-tarball/empty.tar',
});

test('stack with default synthesizer', () => {
expect(asset1.assetHash).toEqual('95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df');
expect(asset1.imageTag).toEqual('95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df');
});

test('stack with overwritten synthesizer', () => {
expect(asset2.assetHash).toEqual('95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df');
expect(asset2.imageTag).toEqual('banana95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df');
});
});

});

function isAssetManifest(x: cxapi.CloudArtifact): x is cxapi.AssetManifestArtifact {
Expand Down
3 changes: 0 additions & 3 deletions packages/@aws-cdk/aws-eks-legacy/.eslintrc.js

This file was deleted.

24 changes: 0 additions & 24 deletions packages/@aws-cdk/aws-eks-legacy/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions packages/@aws-cdk/aws-eks-legacy/.npmignore

This file was deleted.

Loading

0 comments on commit 9a18370

Please sign in to comment.