Skip to content

Commit

Permalink
Merge branch 'master' into java-15
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 26, 2020
2 parents 9a88c1d + dde9c55 commit c29504e
Show file tree
Hide file tree
Showing 87 changed files with 1,638 additions and 1,081 deletions.
2 changes: 2 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ removed:@aws-cdk/cdk-assets-schema.FileAssetPackaging
changed-type:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.autoScalingGroups
changed-type:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.autoScalingGroups

changed-type:@aws-cdk/aws-rds.Credentials.secret

# We were leaking L1 types in L2 APIs, which now have changed required -> optional
# when ECS moved to the CloudFormation Registry spec.
change-return-type:@aws-cdk/aws-ecs.ContainerDefinition.renderContainerDefinition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"devDependencies": {
"@types/jest": "^26.0.15",
"cdk-build-tools": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0",
"ts-jest": "^26.4.1"
"ts-jest": "^26.4.2"
},
"dependencies": {
"@aws-cdk/cloud-assembly-schema": "0.0.0",
Expand All @@ -37,7 +37,7 @@
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"constructs": "^3.0.4",
"jest": "^26.6.0"
"jest": "^26.6.1"
},
"repository": {
"url": "https://github.com/aws/aws-cdk.git",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assets/test/test.staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export = {

test.deepEqual(staging.sourceHash, '2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00');
test.deepEqual(staging.sourcePath, sourcePath);
test.deepEqual(stack.resolve(staging.stagedPath), 'asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00');
test.deepEqual(staging.relativeStagedPath(stack), 'asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00');
test.done();
},

Expand All @@ -31,7 +31,7 @@ export = {

test.deepEqual(staging.sourceHash, '2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00');
test.deepEqual(staging.sourcePath, sourcePath);
test.deepEqual(stack.resolve(staging.stagedPath), sourcePath);
test.deepEqual(staging.stagedPath, sourcePath);
test.done();
},

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appsync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-autoscaling-hooktargets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront-origins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-ec2": "0.0.0",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"pkglint": "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudtrail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"colors": "^1.4.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudwatch-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@aws-cdk/aws-sns": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codecommit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-sns": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/jest": "^26.0.15",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0",
"sinon": "^9.2.0",
"ts-jest": "^26.4.1"
"ts-jest": "^26.4.2"
},
"dependencies": {
"@aws-cdk/aws-applicationautoscaling": "0.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-ecr-assets/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ nyc.config.js
*.snk
!.eslintrc.js

junit.xml
junit.xml
!jest.config.js
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-ecr-assets/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ tsconfig.json
# exclude cdk artifacts
**/cdk.out
junit.xml
test/
test/
jest.config.js
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const baseConfig = require('cdk-build-tools/config/jest.config');
module.exports = {
...baseConfig,
coverageThreshold: {
global: {
branches: 80,
statements: 80,
}
}
};
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class DockerImageAsset extends CoreConstruct implements assets.IAsset {

const stack = Stack.of(this);
const location = stack.synthesizer.addDockerImageAsset({
directoryName: staging.stagedPath,
directoryName: staging.relativeStagedPath(stack),
dockerBuildArgs: props.buildArgs,
dockerBuildTarget: props.target,
dockerFile: props.file,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ecr-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.31",
"@types/proxyquire": "^1.3.28",
"aws-cdk": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"nodeunit": "^0.11.3",
"nodeunit-shim": "0.0.0",
"pkglint": "0.0.0",
"proxyquire": "^2.1.3",
"@aws-cdk/cloud-assembly-schema": "0.0.0"
Expand Down Expand Up @@ -112,6 +111,7 @@
"announce": false
},
"cdk-build": {
"jest": true,
"env": {
"AWSLINT_BASE_CONSTRUCT": true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import * as fs from 'fs';
import * as path from 'path';
import { expect, haveResource } from '@aws-cdk/assert';
import { expect as ourExpect, haveResource } from '@aws-cdk/assert';
import * as iam from '@aws-cdk/aws-iam';
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
import { App, Lazy, Stack } from '@aws-cdk/core';
import { Test } from 'nodeunit';
import { App, DefaultStackSynthesizer, Lazy, LegacyStackSynthesizer, Stack, Stage } from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import { nodeunitShim, Test } from 'nodeunit-shim';
import { DockerImageAsset } from '../lib';

/* eslint-disable quote-props */

export = {
const DEMO_IMAGE_ASSET_HASH = 'baa2d6eb2a17c75424df631c8c70ff39f2d5f3bee8b9e1a109ee24ca17300540';

nodeunitShim({
'test instantiating Asset Image'(test: Test) {
// GIVEN
const app = new App();
Expand Down Expand Up @@ -103,7 +106,7 @@ export = {
asset.repository.grantPull(user);

// THEN
expect(stack).to(haveResource('AWS::IAM::Policy', {
ourExpect(stack).to(haveResource('AWS::IAM::Policy', {
PolicyDocument: {
'Statement': [
{
Expand Down Expand Up @@ -306,4 +309,63 @@ export = {
test.deepEqual(asset7.sourceHash, 'bc007f81fe1dd0f0bbb24af898eba3f4f15edbff19b7abb3fac928439486d667');
test.done();
},
};
});

test('nested assemblies share assets: legacy synth edition', () => {
// GIVEN
const app = new App();
const stack1 = new Stack(new Stage(app, 'Stage1'), 'Stack', { synthesizer: new LegacyStackSynthesizer() });
const stack2 = new Stack(new Stage(app, 'Stage2'), 'Stack', { synthesizer: new LegacyStackSynthesizer() });

// WHEN
new DockerImageAsset(stack1, 'Image', { directory: path.join(__dirname, 'demo-image') });
new DockerImageAsset(stack2, 'Image', { directory: path.join(__dirname, 'demo-image') });

// THEN
const assembly = app.synth();

// Read the assets from the stack metadata
for (const stageName of ['Stage1', 'Stage2']) {
const stackArtifact = assembly.getNestedAssembly(`assembly-${stageName}`).artifacts.filter(isStackArtifact)[0];
const assetMeta = stackArtifact.findMetadataByType(cxschema.ArtifactMetadataEntryType.ASSET);
expect(assetMeta[0]).toEqual(
expect.objectContaining({
data: expect.objectContaining({
path: `../asset.${DEMO_IMAGE_ASSET_HASH}`,
}),
}),
);
}
});

test('nested assemblies share assets: default synth edition', () => {
// GIVEN
const app = new App();
const stack1 = new Stack(new Stage(app, 'Stage1'), 'Stack', { synthesizer: new DefaultStackSynthesizer() });
const stack2 = new Stack(new Stage(app, 'Stage2'), 'Stack', { synthesizer: new DefaultStackSynthesizer() });

// WHEN
new DockerImageAsset(stack1, 'Image', { directory: path.join(__dirname, 'demo-image') });
new DockerImageAsset(stack2, 'Image', { directory: path.join(__dirname, 'demo-image') });

// THEN
const assembly = app.synth();

// Read the asset manifests to verify the file paths
for (const stageName of ['Stage1', 'Stage2']) {
const manifestArtifact = assembly.getNestedAssembly(`assembly-${stageName}`).artifacts.filter(isAssetManifestArtifact)[0];
const manifest = JSON.parse(fs.readFileSync(manifestArtifact.file, { encoding: 'utf-8' }));

expect(manifest.dockerImages[DEMO_IMAGE_ASSET_HASH].source).toEqual({
directory: `../asset.${DEMO_IMAGE_ASSET_HASH}`,
});
}
});

function isStackArtifact(x: any): x is cxapi.CloudFormationStackArtifact {
return x instanceof cxapi.CloudFormationStackArtifact;
}

function isAssetManifestArtifact(x: any): x is cxapi.AssetManifestArtifact {
return x instanceof cxapi.AssetManifestArtifact;
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs-patterns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-eks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@aws-cdk/assert": "0.0.0",
"@types/nodeunit": "^0.0.31",
"@types/yaml": "1.9.6",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-events-targets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-codecommit": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"aws-sdk": "^2.776.0",
"aws-sdk": "^2.778.0",
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-glue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^26.6.0",
"jest": "^26.6.1",
"pkglint": "0.0.0",
"sinon": "^9.2.0"
},
Expand Down
Loading

0 comments on commit c29504e

Please sign in to comment.