Skip to content

Commit 6676a61

Browse files
authored
Merge branch 'master' into c9-repo-support
2 parents fdf27e6 + 49c9f99 commit 6676a61

34 files changed

+2001
-452
lines changed

CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,50 @@
22

33
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.
44

5+
## [1.42.0](https://github.com/aws/aws-cdk/compare/v1.41.0...v1.42.0) (2020-05-27)
6+
7+
8+
### ⚠ BREAKING CHANGES
9+
10+
* **cloudtrail:** API signatures of `addS3EventSelectors` and
11+
`addLambdaEventSelectors` have changed. Their parameters are now
12+
strongly typed to accept `IBucket` and `IFunction` respectively.
13+
* **cloudtrail:** `addS3EventSelectors` and `addLambdaEventSelectors`
14+
can no longer be used to configure all S3 data events or all Lambda data
15+
events. Two new APIs `logAllS3DataEvents()` and
16+
`logAllLambdaDataEvents()` have been introduced to achieve this.
17+
* **cloudtrail:** The property `snsTopic` is now of the type `ITopic`.
18+
19+
### Features
20+
21+
* **cfnspec:** cloudformation spec v14.4.0 ([#8195](https://github.com/aws/aws-cdk/issues/8195)) ([99e7330](https://github.com/aws/aws-cdk/commit/99e7330fc5fc140964c47d8c6dbaee2b46b382e1))
22+
* **cloudtrail:** create cloudwatch event without needing to create a Trail ([#8076](https://github.com/aws/aws-cdk/issues/8076)) ([0567a23](https://github.com/aws/aws-cdk/commit/0567a2360ac713e3171c9a82767611174dadb6c6)), closes [#6716](https://github.com/aws/aws-cdk/issues/6716)
23+
* **cloudtrail:** user specified log group ([#8079](https://github.com/aws/aws-cdk/issues/8079)) ([0a3785b](https://github.com/aws/aws-cdk/commit/0a3785b7626633fcbdf26ab793c70f2bc017314b)), closes [#6162](https://github.com/aws/aws-cdk/issues/6162)
24+
* **codeguruprofiler:** ProfilingGroup ([#7895](https://github.com/aws/aws-cdk/issues/7895)) ([995088a](https://github.com/aws/aws-cdk/commit/995088abb00d9c75adbb65845998a8328bb5ba14))
25+
* **codepipeline:** use a special bootstrapless synthesizer for cross-region support Stacks ([#8091](https://github.com/aws/aws-cdk/issues/8091)) ([575f1db](https://github.com/aws/aws-cdk/commit/575f1db0474327c61c4ac626608c9f443ce231d2)), closes [#8082](https://github.com/aws/aws-cdk/issues/8082)
26+
* **cognito:** user pool - case sensitivity for sign in ([460394f](https://github.com/aws/aws-cdk/commit/460394f3dc4737cee80504d6c8ef106ecc3b67d5)), closes [#7988](https://github.com/aws/aws-cdk/issues/7988) [#7235](https://github.com/aws/aws-cdk/issues/7235)
27+
* **core:** CfnJson enables intrinsics in hash keys ([#8099](https://github.com/aws/aws-cdk/issues/8099)) ([195cd40](https://github.com/aws/aws-cdk/commit/195cd405d9f0869875de2ec78661aee3af2c7c7d)), closes [#8084](https://github.com/aws/aws-cdk/issues/8084)
28+
* **eks:** improve security using IRSA conditions ([#8084](https://github.com/aws/aws-cdk/issues/8084)) ([35a01a0](https://github.com/aws/aws-cdk/commit/35a01a079af40da291007da08af6690c9a81c101))
29+
* **elbv2:** Supports new types of listener rule conditions ([#7848](https://github.com/aws/aws-cdk/issues/7848)) ([3d30ffa](https://github.com/aws/aws-cdk/commit/3d30ffa38c51ae26686287e993af445ea3067766)), closes [#3888](https://github.com/aws/aws-cdk/issues/3888)
30+
* **secretsmanager:** adds grantWrite to Secret ([#7858](https://github.com/aws/aws-cdk/issues/7858)) ([3fed84b](https://github.com/aws/aws-cdk/commit/3fed84ba9eec3f53c662966e366aa629209b7bf5))
31+
* **sns:** add support for subscription DLQ in SNS ([383cdb8](https://github.com/aws/aws-cdk/commit/383cdb86effeafdf5d0767ed379b16b3d78a933b))
32+
* **stepfunctions:** new service integration classes for Lambda, SNS, and SQS ([#7946](https://github.com/aws/aws-cdk/issues/7946)) ([c038848](https://github.com/aws/aws-cdk/commit/c0388483524832ca7863de4ee9c472b8ab39de8e)), closes [#6715](https://github.com/aws/aws-cdk/issues/6715) [#6489](https://github.com/aws/aws-cdk/issues/6489)
33+
* **stepfunctions:** support paths in Pass state ([#8070](https://github.com/aws/aws-cdk/issues/8070)) ([86eac6a](https://github.com/aws/aws-cdk/commit/86eac6af074bf78a921c52d613eca0dd4a514a49)), closes [#7181](https://github.com/aws/aws-cdk/issues/7181)
34+
* **stepfunctions-tasks:** task for starting a job run in AWS Glue ([#8143](https://github.com/aws/aws-cdk/issues/8143)) ([a721e67](https://github.com/aws/aws-cdk/commit/a721e670cdc9888cd67ef1a24021004e18bfd23c))
35+
36+
37+
### Bug Fixes
38+
39+
* **apigateway:** contextAccountId in AccessLogField incorrectly resolves to requestId ([7b89e80](https://github.com/aws/aws-cdk/commit/7b89e805c716fa73d41cc97fcb728634e7a59136)), closes [#7952](https://github.com/aws/aws-cdk/issues/7952) [#7951](https://github.com/aws/aws-cdk/issues/7951)
40+
* **autoscaling:** add noDevice as a volume type ([#7253](https://github.com/aws/aws-cdk/issues/7253)) ([751958b](https://github.com/aws/aws-cdk/commit/751958b69225fdfc52622781c618f5a77f881fb6)), closes [#7242](https://github.com/aws/aws-cdk/issues/7242)
41+
* **aws-eks:** kubectlEnabled: false conflicts with addNodegroup ([#8119](https://github.com/aws/aws-cdk/issues/8119)) ([8610889](https://github.com/aws/aws-cdk/commit/86108890a51443dc06ec6325038c7b19cbdaee76)), closes [#7993](https://github.com/aws/aws-cdk/issues/7993)
42+
* **cli:** paper cuts ([#8164](https://github.com/aws/aws-cdk/issues/8164)) ([af2ea60](https://github.com/aws/aws-cdk/commit/af2ea60e7ae4aaab17ddd10a9142e1809b4c8246))
43+
* **dynamodb:** the maximum number of nonKeyAttributes is 100, not 20 ([#8186](https://github.com/aws/aws-cdk/issues/8186)) ([0393528](https://github.com/aws/aws-cdk/commit/03935280f1addef392c9b4460737cce8bb2eb8c9)), closes [#8095](https://github.com/aws/aws-cdk/issues/8095)
44+
* **eks:** unable to add multiple service accounts ([#8122](https://github.com/aws/aws-cdk/issues/8122)) ([524440c](https://github.com/aws/aws-cdk/commit/524440c5454d15276c92581a08d4ee7cad1790eb))
45+
* **events:** cannot use the same target account for 2 cross-account event sources ([#8068](https://github.com/aws/aws-cdk/issues/8068)) ([395c07c](https://github.com/aws/aws-cdk/commit/395c07c0cac7739743fc71d71fddd8880b608ead)), closes [#8010](https://github.com/aws/aws-cdk/issues/8010)
46+
* **lambda-nodejs:** build fails on Windows ([#8140](https://github.com/aws/aws-cdk/issues/8140)) ([04490b1](https://github.com/aws/aws-cdk/commit/04490b134a05ec34523541a3ca282ba8957a7964)), closes [#8107](https://github.com/aws/aws-cdk/issues/8107)
47+
* **cloudtrail:** better typed event selector apis ([#8097](https://github.com/aws/aws-cdk/issues/8097)) ([0028778](https://github.com/aws/aws-cdk/commit/0028778c0f00f2faa8dad25345cd17f311fad5da))
48+
549
## [1.41.0](https://github.com/aws/aws-cdk/compare/v1.40.0...v1.41.0) (2020-05-21)
650

751

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"tools/*"
1111
],
1212
"rejectCycles": "true",
13-
"version": "1.41.0"
13+
"version": "1.42.0"
1414
}

package.json

+16-7
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,34 @@
4848
"nohoist": [
4949
"**/jszip",
5050
"**/jszip/**",
51-
"@aws-cdk/cdk-assets-schema/semver",
52-
"@aws-cdk/cdk-assets-schema/semver/**",
53-
"@aws-cdk/core/minimatch",
54-
"@aws-cdk/core/minimatch/**",
55-
"@aws-cdk/cloudformation-include/yaml",
56-
"@aws-cdk/cloudformation-include/yaml/**",
5751
"@aws-cdk/aws-codepipeline-actions/case",
5852
"@aws-cdk/aws-codepipeline-actions/case/**",
5953
"@aws-cdk/aws-ecr-assets/minimatch",
6054
"@aws-cdk/aws-ecr-assets/minimatch/**",
6155
"@aws-cdk/aws-lambda-nodejs/parcel-bundler",
6256
"@aws-cdk/aws-lambda-nodejs/parcel-bundler/**",
57+
"@aws-cdk/cdk-assets-schema/semver",
58+
"@aws-cdk/cdk-assets-schema/semver/**",
6359
"@aws-cdk/cloud-assembly-schema/jsonschema",
6460
"@aws-cdk/cloud-assembly-schema/jsonschema/**",
6561
"@aws-cdk/cloud-assembly-schema/semver",
6662
"@aws-cdk/cloud-assembly-schema/semver/**",
63+
"@aws-cdk/cloudformation-include/yaml",
64+
"@aws-cdk/cloudformation-include/yaml/**",
65+
"@aws-cdk/core/minimatch",
66+
"@aws-cdk/core/minimatch/**",
6767
"@aws-cdk/cx-api/semver",
6868
"@aws-cdk/cx-api/semver/**",
69-
"@aws-cdk/cx-api/semver/**"
69+
"monocdk-experiment/case",
70+
"monocdk-experiment/case/**",
71+
"monocdk-experiment/jsonschema",
72+
"monocdk-experiment/jsonschema/**",
73+
"monocdk-experiment/minimatch",
74+
"monocdk-experiment/minimatch/**",
75+
"monocdk-experiment/semver",
76+
"monocdk-experiment/semver/**",
77+
"monocdk-experiment/yaml",
78+
"monocdk-experiment/yaml/**"
7079
]
7180
}
7281
}

packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,27 @@ export interface PipelineDeployStackActionProps {
3232
*/
3333
readonly createChangeSetRunOrder?: number;
3434

35+
/**
36+
* The name of the CodePipeline action creating the ChangeSet.
37+
*
38+
* @default 'ChangeSet'
39+
*/
40+
readonly createChangeSetActionName?: string;
41+
3542
/**
3643
* The runOrder for the CodePipeline action executing the ChangeSet.
3744
*
3845
* @default ``createChangeSetRunOrder + 1``
3946
*/
4047
readonly executeChangeSetRunOrder?: number;
4148

49+
/**
50+
* The name of the CodePipeline action creating the ChangeSet.
51+
*
52+
* @default 'Execute'
53+
*/
54+
readonly executeChangeSetActionName?: string;
55+
4256
/**
4357
* IAM role to assume when deploying changes.
4458
*
@@ -116,7 +130,7 @@ export class PipelineDeployStackAction implements codepipeline.IAction {
116130
const changeSetName = props.changeSetName || 'CDK-CodePipeline-ChangeSet';
117131
const capabilities = cfnCapabilities(props.adminPermissions, props.capabilities);
118132
this.prepareChangeSetAction = new cpactions.CloudFormationCreateReplaceChangeSetAction({
119-
actionName: 'ChangeSet',
133+
actionName: props.createChangeSetActionName ?? 'ChangeSet',
120134
changeSetName,
121135
runOrder: createChangeSetRunOrder,
122136
stackName: props.stack.stackName,
@@ -126,7 +140,7 @@ export class PipelineDeployStackAction implements codepipeline.IAction {
126140
capabilities,
127141
});
128142
this.executeChangeSetAction = new cpactions.CloudFormationExecuteChangeSetAction({
129-
actionName: 'Execute',
143+
actionName: props.executeChangeSetActionName ?? 'Execute',
130144
changeSetName,
131145
runOrder: executeChangeSetRunOrder,
132146
stackName: this.stack.stackName,

packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, haveResource, isSuperObject } from '@aws-cdk/assert';
1+
import { expect, haveResource, haveResourceLike, isSuperObject } from '@aws-cdk/assert';
22
import * as cfn from '@aws-cdk/aws-cloudformation';
33
import * as codebuild from '@aws-cdk/aws-codebuild';
44
import * as codepipeline from '@aws-cdk/aws-codepipeline';
@@ -406,6 +406,43 @@ export = nodeunit.testCase({
406406
);
407407
test.done();
408408
},
409+
410+
'allows overriding the ChangeSet and Execute action names'(test: nodeunit.Test) {
411+
const stack = getTestStack();
412+
const selfUpdatingPipeline = createSelfUpdatingStack(stack);
413+
selfUpdatingPipeline.pipeline.addStage({
414+
stageName: 'Deploy',
415+
actions: [
416+
new PipelineDeployStackAction({
417+
input: selfUpdatingPipeline.synthesizedApp,
418+
adminPermissions: true,
419+
stack,
420+
createChangeSetActionName: 'Prepare',
421+
executeChangeSetActionName: 'Deploy',
422+
}),
423+
],
424+
});
425+
426+
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
427+
Stages: [
428+
{},
429+
{},
430+
{
431+
Name: 'Deploy',
432+
Actions: [
433+
{
434+
Name: 'Prepare',
435+
},
436+
{
437+
Name: 'Deploy',
438+
},
439+
],
440+
},
441+
],
442+
}));
443+
444+
test.done();
445+
},
409446
});
410447

411448
class FakeAction implements codepipeline.IAction {

packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts

+16
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ export interface BitBucketSourceActionProps extends codepipeline.CommonAwsAction
6969
* @experimental
7070
*/
7171
export class BitBucketSourceAction extends Action {
72+
/**
73+
* The name of the property that holds the ARN of the CodeStar Connection
74+
* inside of the CodePipeline Artifact's metadata.
75+
*
76+
* @internal
77+
*/
78+
public static readonly _CONNECTION_ARN_PROPERTY = 'CodeStarConnectionArnProperty';
79+
7280
private readonly props: BitBucketSourceActionProps;
7381

7482
constructor(props: BitBucketSourceActionProps) {
@@ -98,6 +106,14 @@ export class BitBucketSourceAction extends Action {
98106
// the action needs to write the output to the pipeline bucket
99107
options.bucket.grantReadWrite(options.role);
100108

109+
// if codeBuildCloneOutput is true,
110+
// save the connectionArn in the Artifact instance
111+
// to be read by the CodeBuildAction later
112+
if (this.props.codeBuildCloneOutput === true) {
113+
this.props.output.setMetadata(BitBucketSourceAction._CONNECTION_ARN_PROPERTY,
114+
this.props.connectionArn);
115+
}
116+
101117
return {
102118
configuration: {
103119
ConnectionArn: this.props.connectionArn,

packages/@aws-cdk/aws-codepipeline-actions/lib/codebuild/build-action.ts

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as codebuild from '@aws-cdk/aws-codebuild';
22
import * as codepipeline from '@aws-cdk/aws-codepipeline';
33
import * as iam from '@aws-cdk/aws-iam';
44
import * as cdk from '@aws-cdk/core';
5+
import { BitBucketSourceAction } from '..';
56
import { Action } from '../action';
67

78
/**
@@ -153,6 +154,19 @@ export class CodeBuildAction extends Action {
153154
});
154155
}
155156

157+
// if any of the inputs come from the BitBucketSourceAction
158+
// with codeBuildCloneOutput=true,
159+
// grant the Project's Role to use the connection
160+
for (const inputArtifact of this.actionProperties.inputs || []) {
161+
const connectionArn = inputArtifact.getMetadata(BitBucketSourceAction._CONNECTION_ARN_PROPERTY);
162+
if (connectionArn) {
163+
this.props.project.addToRolePolicy(new iam.PolicyStatement({
164+
actions: ['codestar-connections:UseConnection'],
165+
resources: [connectionArn],
166+
}));
167+
}
168+
}
169+
156170
const configuration: any = {
157171
ProjectName: this.props.project.projectName,
158172
EnvironmentVariables: this.props.environmentVariables &&

packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/test.bitbucket-source-action.ts

+67-26
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,8 @@ export = {
1212
'produces the correct configuration when added to a pipeline'(test: Test) {
1313
const stack = new Stack();
1414

15-
const sourceOutput = new codepipeline.Artifact();
16-
new codepipeline.Pipeline(stack, 'Pipeline', {
17-
stages: [
18-
{
19-
stageName: 'Source',
20-
actions: [
21-
new cpactions.BitBucketSourceAction({
22-
actionName: 'BitBucket',
23-
owner: 'aws',
24-
repo: 'aws-cdk',
25-
output: sourceOutput,
26-
connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
27-
}),
28-
],
29-
},
30-
{
31-
stageName: 'Build',
32-
actions: [
33-
new cpactions.CodeBuildAction({
34-
actionName: 'CodeBuild',
35-
project: new codebuild.PipelineProject(stack, 'MyProject'),
36-
input: sourceOutput,
37-
}),
38-
],
39-
},
40-
],
15+
createBitBucketAndCodeBuildPipeline(stack, {
16+
codeBuildCloneOutput: false,
4117
});
4218

4319
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
@@ -73,4 +49,69 @@ export = {
7349
test.done();
7450
},
7551
},
52+
53+
'setting codeBuildCloneOutput=true adds permission to use the connection to the following CodeBuild Project'(test: Test) {
54+
const stack = new Stack();
55+
56+
createBitBucketAndCodeBuildPipeline(stack, {
57+
codeBuildCloneOutput: true,
58+
});
59+
60+
expect(stack).to(haveResourceLike('AWS::IAM::Policy', {
61+
'PolicyDocument': {
62+
'Statement': [
63+
{
64+
'Action': [
65+
'logs:CreateLogGroup',
66+
'logs:CreateLogStream',
67+
'logs:PutLogEvents',
68+
],
69+
},
70+
{},
71+
{},
72+
{},
73+
{},
74+
{
75+
'Action': 'codestar-connections:UseConnection',
76+
'Effect': 'Allow',
77+
'Resource': 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
78+
},
79+
],
80+
},
81+
}));
82+
83+
test.done();
84+
},
7685
};
86+
87+
function createBitBucketAndCodeBuildPipeline(stack: Stack, props: { codeBuildCloneOutput: boolean }): void {
88+
const sourceOutput = new codepipeline.Artifact();
89+
new codepipeline.Pipeline(stack, 'Pipeline', {
90+
stages: [
91+
{
92+
stageName: 'Source',
93+
actions: [
94+
new cpactions.BitBucketSourceAction({
95+
actionName: 'BitBucket',
96+
owner: 'aws',
97+
repo: 'aws-cdk',
98+
output: sourceOutput,
99+
connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
100+
codeBuildCloneOutput: props.codeBuildCloneOutput,
101+
}),
102+
],
103+
},
104+
{
105+
stageName: 'Build',
106+
actions: [
107+
new cpactions.CodeBuildAction({
108+
actionName: 'CodeBuild',
109+
project: new codebuild.PipelineProject(stack, 'MyProject'),
110+
input: sourceOutput,
111+
outputs: [new codepipeline.Artifact()],
112+
}),
113+
],
114+
},
115+
],
116+
});
117+
}

packages/@aws-cdk/aws-codepipeline/lib/artifact.ts

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class Artifact {
1717
}
1818

1919
private _artifactName?: string;
20+
private readonly metadata: { [key: string]: any } = {};
2021

2122
constructor(artifactName?: string) {
2223
validation.validateArtifactName(artifactName);
@@ -80,6 +81,25 @@ export class Artifact {
8081
};
8182
}
8283

84+
/**
85+
* Add arbitrary extra payload to the artifact under a given key.
86+
* This can be used by CodePipeline actions to communicate data between themselves.
87+
* If metadata was already present under the given key,
88+
* it will be overwritten with the new value.
89+
*/
90+
public setMetadata(key: string, value: any): void {
91+
this.metadata[key] = value;
92+
}
93+
94+
/**
95+
* Retrieve the metadata stored in this artifact under the given key.
96+
* If there is no metadata stored under the given key,
97+
* null will be returned.
98+
*/
99+
public getMetadata(key: string): any {
100+
return this.metadata[key];
101+
}
102+
83103
public toString() {
84104
return this.artifactName;
85105
}

0 commit comments

Comments
 (0)