Skip to content

Commit 3ea0742

Browse files
authored
Merge branch 'main' into tools/project-sync
2 parents eeb8c05 + e9e794e commit 3ea0742

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.mergify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pull_request_rules:
6565
label:
6666
add: [contribution/core]
6767
conditions:
68-
- author~=^(rix0rrr|iliapolo|otaviomacedo|kaizencc|TheRealAmazonKendra|mrgrain|pahud|ashishdhingra|kellertk|moelasmar|paulhcsun|GavinZZ|xazhao|gracelu0|shikha372|QuantumNeuralCoder|godwingrs22|bergjaak|samson-keung|IanKonlog|Leo10Gama|scorbiere|jiayiwang7|saiyush|5d|iankhou|SimonCMoore|maharajhaider|Y-JayKim|astiwana|ykethan|aemada-aws|ozelalisen|abogical|alinko-aws|vishaalmehrishi|alvazjor|kumsmrit|kumvprat|leonmk-aws|matboros|gasolima|abidhasan-aws)$
68+
- author=@aws/aws-cdk-team
6969
- -label~="contribution/core"
7070
- name: automatic merge
7171
actions:

packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface CodePipelineProps {
7575
readonly crossAccountKeys?: boolean;
7676

7777
/**
78-
* CDK CLI version to use in self-mutation and asset publishing steps
78+
* CDK CLI version to use in self-mutation step
7979
*
8080
* If you want to lock the CDK CLI version used in the pipeline, by steps
8181
* that are automatically generated for you, specify the version here.
@@ -97,6 +97,20 @@ export interface CodePipelineProps {
9797
*/
9898
readonly cliVersion?: string;
9999

100+
/**
101+
* CDK CLI version to use in asset publishing steps
102+
*
103+
* If you want to lock the `cdk-assets` version used in the pipeline, by steps
104+
* that are automatically generated for you, specify the version here.
105+
*
106+
* We recommend you do not specify this value, as not specifying it always
107+
* uses the latest CLI version which is backwards compatible with old versions.
108+
*
109+
* @see https://www.npmjs.com/package/cdk-assets
110+
* @default - Latest version
111+
*/
112+
readonly cdkAssetsCliVersion?: string;
113+
100114
/**
101115
* Whether the pipeline will update itself
102116
*
@@ -403,6 +417,7 @@ export class CodePipeline extends PipelineBase {
403417

404418
private readonly singlePublisherPerAssetType: boolean;
405419
private readonly cliVersion?: string;
420+
private readonly cdkAssetsCliVersion: string;
406421

407422
constructor(scope: Construct, id: string, private readonly props: CodePipelineProps) {
408423
super(scope, id, props);
@@ -411,6 +426,7 @@ export class CodePipeline extends PipelineBase {
411426
this.dockerCredentials = props.dockerCredentials ?? [];
412427
this.singlePublisherPerAssetType = !(props.publishAssetsInParallel ?? true);
413428
this.cliVersion = props.cliVersion ?? preferredCliVersion();
429+
this.cdkAssetsCliVersion = props.cdkAssetsCliVersion ?? 'latest';
414430
this.useChangeSets = props.useChangeSets ?? true;
415431
this.stackOutputs = new StackOutputsMap(this);
416432
this.usePipelineRoleForActions = props.usePipelineRoleForActions ?? false;
@@ -881,7 +897,7 @@ export class CodePipeline extends PipelineBase {
881897
const script = new CodeBuildStep(node.id, {
882898
commands,
883899
installCommands: [
884-
'npm install -g cdk-assets@latest',
900+
`npm install -g cdk-assets@${this.cdkAssetsCliVersion}`,
885901
],
886902
input: this._cloudAssemblyFileSet,
887903
buildEnvironment: {

packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,32 @@ test.each([
210210
});
211211
});
212212

213+
test.each([
214+
[undefined, 'latest'],
215+
['9.9.9', '9.9.9'],
216+
])('When I request cdk-assets version %p I get %p', (requested, expected) => {
217+
const pipelineStack = new cdk.Stack(app, 'PipelineStack', { env: PIPELINE_ENV });
218+
const pipe = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', {
219+
cdkAssetsCliVersion: requested,
220+
});
221+
222+
pipe.addStage(new FileAssetApp(pipelineStack, 'App', {}));
223+
224+
Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', {
225+
Source: {
226+
BuildSpec: Match.serializedJson(Match.objectLike({
227+
phases: {
228+
install: {
229+
commands: [
230+
`npm install -g cdk-assets@${expected}`,
231+
],
232+
},
233+
},
234+
})),
235+
},
236+
});
237+
});
238+
213239
test('CodeBuild action role has the right AssumeRolePolicyDocument', () => {
214240
const pipelineStack = new cdk.Stack(app, 'PipelineStack', { env: PIPELINE_ENV });
215241
new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk');

0 commit comments

Comments
 (0)