Skip to content

Commit

Permalink
fix: pipelines ties cli version with cdk-assets version
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealAmazonKendra committed Aug 30, 2024
1 parent 2a27711 commit cce98fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { GraphNodeCollection, isGraph, AGraphNode, PipelineGraph } from '../help
import { PipelineBase } from '../main';
import { AssetSingletonRole } from '../private/asset-singleton-role';
import { CachedFnSub } from '../private/cached-fnsub';
import { preferredCliVersion } from '../private/cli-version';
import { appOf, assemblyBuilderOf, embeddedAsmPath, obtainScope } from '../private/construct-internals';
import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../private/default-codebuild-image';
import { toPosixPath } from '../private/fs';
Expand Down Expand Up @@ -388,7 +387,7 @@ export class CodePipeline extends PipelineBase {
this.selfMutationEnabled = props.selfMutation ?? true;
this.dockerCredentials = props.dockerCredentials ?? [];
this.singlePublisherPerAssetType = !(props.publishAssetsInParallel ?? true);
this.cliVersion = props.cliVersion ?? preferredCliVersion();
this.cliVersion = props.cliVersion ?? 'latest';
this.useChangeSets = props.useChangeSets ?? true;
this.stackOutputs = new StackOutputsMap(this);
}
Expand Down Expand Up @@ -817,8 +816,6 @@ export class CodePipeline extends PipelineBase {
}

private publishAssetsAction(node: AGraphNode, assets: StackAsset[]): ICodePipelineActionFactory {
const installSuffix = this.cliVersion ? `@${this.cliVersion}` : '';

const commands = assets.map(asset => {
const relativeAssetManifestPath = path.relative(this.myCxAsmRoot, asset.assetManifestPath);
return `cdk-assets --path "${toPosixPath(relativeAssetManifestPath)}" --verbose publish "${asset.assetSelector}"`;
Expand All @@ -840,7 +837,7 @@ export class CodePipeline extends PipelineBase {
const script = new CodeBuildStep(node.id, {
commands,
installCommands: [
`npm install -g cdk-assets${installSuffix}`,
'npm install -g cdk-assets@latest',
],
input: this._cloudAssemblyFileSet,
buildEnvironment: {
Expand Down
41 changes: 0 additions & 41 deletions packages/aws-cdk-lib/pipelines/lib/private/cli-version.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/pipelines/test/compliance/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('basic pipeline', () => {
BuildSpec: Match.serializedJson(Match.objectLike({
phases: {
install: {
commands: ['npm install -g cdk-assets@1.2.3'],
commands: ['npm install -g aws-cdk@1.2.3'],
},
},
})),
Expand Down Expand Up @@ -388,7 +388,7 @@ test('can supply pre-install scripts to asset upload', () => {
BuildSpec: Match.serializedJson(Match.objectLike({
phases: {
install: {
commands: ['npm config set registry https://registry.com', 'npm install -g cdk-assets@2'],
commands: ['npm config set registry https://registry.com', 'npm install -g cdk-assets@latest'],
},
},
})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('CodePipeline has self-mutation stage', () => {
BuildSpec: Match.serializedJson(Match.objectLike({
phases: {
install: {
commands: ['npm install -g aws-cdk@2'],
commands: ['npm install -g aws-cdk@latest'],
},
build: {
commands: Match.arrayWith(['cdk -a . deploy PipelineStack --require-approval=never --verbose']),
Expand Down Expand Up @@ -187,7 +187,7 @@ test('self-mutation stage can be customized with BuildSpec', () => {
BuildSpec: Match.serializedJson(Match.objectLike({
phases: {
install: {
commands: ['npm config set registry example.com', 'npm install -g aws-cdk@2'],
commands: ['npm config set registry example.com', 'npm install -g aws-cdk@latest'],
},
build: {
commands: Match.arrayWith(['cdk -a . deploy PipelineStack --require-approval=never --verbose']),
Expand Down

0 comments on commit cce98fa

Please sign in to comment.