Skip to content

Commit

Permalink
fix: pipelines ties cli version with cdk-assets version (#31261)
Browse files Browse the repository at this point in the history
cdk-assets is no longer being versioned in line with the cli or with aws-cdk-lib. Because every change must be backward compatible, we can just use `latest` for cdk-assets (not that we will soon be releasing a new major version of cdk-assets but we are releasing that with the `v3-latest` tag at present. When we are ready to swap versions, we will begin labeling the v3 line as `latest` and make the v2 line `v2-latest` as it will be in maintenance mode.

Note: the linter and potentially the build will fail for this initially because an integ test needs to be updated.

Closes #31253.


### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored Sep 13, 2024
1 parent 743a112 commit 4392ab4
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 33 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@
]
},
"Source": {
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelinesFileSystemLocations-Beta/PipelinesFileSystemLocationsBetaStack18199ECAE.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@latest\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelinesFileSystemLocations-Beta/PipelinesFileSystemLocationsBetaStack18199ECAE.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"Type": "CODEPIPELINE"
},
"VpcConfig": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@
]
},
"Source": {
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@latest\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"Type": "CODEPIPELINE"
},
"VpcConfig": {
Expand Down Expand Up @@ -2072,7 +2072,7 @@
]
},
"Source": {
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@latest\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}",
"Type": "CODEPIPELINE"
},
"VpcConfig": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,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 +838,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
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/pipelines/lib/private/cli-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export function findUp(name: string, directory: string): string | undefined {
}

return findUp(name, path.dirname(absoluteDirectory));
}
}
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

0 comments on commit 4392ab4

Please sign in to comment.