@@ -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 : {
0 commit comments