Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pipelines ties cli version with cdk-assets version #31261

Merged
merged 8 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are sure it is safe to unlock all CLI versions (both aws-cdk and cdk-assets), then remove the this.cliVersion property entirely.

Otherwise, keep the versioning on aws-cdk and remove its use only for cdk-assets.

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
Loading