-
Notifications
You must be signed in to change notification settings - Fork 87
feat(cli): add publish-assets command for asset publishing without deployment #1020
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
Merged
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
8dad596
init
go-to-k a267160
wip for assetParallelism
go-to-k 4196ccc
modify
go-to-k 8be83e6
integ
go-to-k ef1e062
tweak
go-to-k 5240325
tweak
go-to-k 7ca3fdf
README
go-to-k 5fa07b2
fix
go-to-k f137fcc
Merge branch 'main' into publish
go-to-k 78db795
comments
go-to-k 81fa49b
removePublishedAssets
go-to-k d2abc2b
publish.test
go-to-k 303f186
imports
go-to-k bd89d27
Merge branch 'main' of https://github.com/go-to-k/aws-cdk-cli into pu…
go-to-k e592c9e
mock
go-to-k a0ee290
mock
go-to-k 69980aa
Merge branch 'main' into publish
go-to-k d2aed1f
README
go-to-k afb379c
Merge branch 'main' of https://github.com/go-to-k/aws-cdk-cli into pu…
go-to-k 06769f2
implement in toolkit-lib
go-to-k 170fc97
rm success
go-to-k c039eb6
exclusively
go-to-k 9ac288c
rm toolkitStackName
go-to-k 514989a
use concurrency
go-to-k 198eeef
response
go-to-k 678377f
test
go-to-k 31b4858
publishedAssets
go-to-k 4d8e80f
improve
go-to-k 5a10ccf
fix
go-to-k c199031
modify
go-to-k 51b4b1d
rm
go-to-k 86ddcff
implement in toolkit-lib
go-to-k 2b4ce75
forgot to build
go-to-k ff5920e
add createBuildAssetFunction and createPublishAssetFunction
go-to-k 4025ad8
rm assetParallelism
go-to-k 7b00e47
fix lint
go-to-k 9e96c9a
add publish to BUNDLING_COMMANDS
go-to-k bcfc439
refactor
go-to-k 49d70d0
Merge branch 'main' into publish
go-to-k b724ab8
Merge branch 'main' of https://github.com/go-to-k/aws-cdk-cli into pu…
go-to-k f41f437
use concurrency only
go-to-k 577a95d
rm roleArn
go-to-k 4addfb8
All assets are already published
go-to-k e524311
PublishAssetsPayload
go-to-k 9359fb9
CDK_TOOLKIT_I9402
go-to-k 7ec9139
fix tests
go-to-k f6ce6e8
message-registry.md
go-to-k 6ccd9b7
fix
go-to-k 169a0aa
fix tests
go-to-k 42ace23
Merge branch 'main' into publish
go-to-k cb33027
typo
go-to-k cab10fa
Merge branch 'publish' of https://github.com/go-to-k/aws-cdk-cli into…
go-to-k 9d16908
cdk publish-assets
go-to-k a047696
tweak for doc
go-to-k 4d71d48
Merge branch 'main' into publish
go-to-k 1d83be9
table align
go-to-k afd8f3b
unify assets payload
go-to-k cc2600c
concurrency to 4
go-to-k 3025828
requireUnstableFeature
go-to-k c6d0df4
use PublishAssetsOptions in toolkit-lib
go-to-k 2ff8cce
Merge branch 'main' into publish
go-to-k b1b9375
chore: self mutation
github-actions[bot] 999a579
Merge branch 'main' into publish
mrgrain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...tests/cli-integ-tests/publish-assets/cdk-publish-assets-idempotent-and-force.integtest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { integTest, withDefaultFixture } from '../../../lib'; | ||
|
|
||
| jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime | ||
|
|
||
| integTest( | ||
| 'publish-assets is idempotent and --force re-uploads', | ||
| withDefaultFixture(async (fixture) => { | ||
| const stackName = 'lambda'; | ||
| const fullStackName = fixture.fullStackName(stackName); | ||
|
|
||
| // First publish | ||
| const firstOutput = await fixture.cdk(['publish-assets', fullStackName, '--unstable=publish-assets']); | ||
| expect(firstOutput).toMatch('Assets published successfully'); | ||
|
|
||
| // Second publish without --force should detect nothing to do | ||
| const secondOutput = await fixture.cdk(['publish-assets', fullStackName, '--unstable=publish-assets']); | ||
| expect(secondOutput).toMatch('All assets are already published'); | ||
|
|
||
| // Third publish with --force should re-upload | ||
| const forceOutput = await fixture.cdk(['publish-assets', fullStackName, '--unstable=publish-assets', '--force']); | ||
| expect(forceOutput).toMatch('Assets published successfully'); | ||
| }), | ||
| ); |
22 changes: 22 additions & 0 deletions
22
...li-integ/tests/cli-integ-tests/publish-assets/cdk-publish-assets-then-deploy.integtest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { integTest, withDefaultFixture } from '../../../lib'; | ||
|
|
||
| jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime | ||
|
|
||
| integTest( | ||
| 'publish-assets then deploy detects already uploaded assets', | ||
| withDefaultFixture(async (fixture) => { | ||
| const stackName = 'lambda'; | ||
| const fullStackName = fixture.fullStackName(stackName); | ||
|
|
||
| // First, publish assets | ||
| const publishOutput = await fixture.cdk(['publish-assets', fullStackName, '--unstable=publish-assets']); | ||
| expect(publishOutput).toMatch('Assets published successfully'); | ||
|
|
||
| // Then deploy the same stack; it should detect the already published assets and skip re-publishing | ||
| const deployOutput = await fixture.cdkDeploy(stackName, { options: ['-v'], captureStderr: true }); | ||
| expect(deployOutput).toMatch(/0 still need to be published/); | ||
|
|
||
| // Clean up | ||
| await fixture.cdkDestroy(stackName); | ||
| }), | ||
| ); |
19 changes: 19 additions & 0 deletions
19
...eg/tests/cli-integ-tests/publish-assets/cdk-publish-assets-without-deploying.integtest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { DescribeStacksCommand } from '@aws-sdk/client-cloudformation'; | ||
| import { integTest, withDefaultFixture } from '../../../lib'; | ||
|
|
||
| jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime | ||
|
|
||
| integTest( | ||
| 'publish-assets without deploying', | ||
| withDefaultFixture(async (fixture) => { | ||
| const stackName = 'lambda'; | ||
| const fullStackName = fixture.fullStackName(stackName); | ||
|
|
||
| const output = await fixture.cdk(['publish-assets', fullStackName, '--unstable=publish-assets']); | ||
| expect(output).toMatch('Assets published successfully'); | ||
|
|
||
| // assert the stack was not deployed | ||
| await expect(fixture.aws.cloudFormation.send(new DescribeStacksCommand({ StackName: fullStackName }))) | ||
| .rejects.toThrow(/does not exist/); | ||
| }), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/@aws-cdk/toolkit-lib/lib/actions/publish-assets/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import type { IManifestEntry } from '@aws-cdk/cdk-assets-lib'; | ||
| import type { StackSelector } from '../../api/cloud-assembly'; | ||
|
|
||
| export interface PublishAssetsOptions { | ||
| /** | ||
| * Select stacks to publish assets for | ||
| * | ||
| * @default - All stacks | ||
| */ | ||
| readonly stacks?: StackSelector; | ||
|
|
||
| /** | ||
| * Always publish assets, even if they are already published | ||
| * | ||
| * @default false | ||
| */ | ||
| readonly force?: boolean; | ||
|
|
||
| /** | ||
| * Maximum number of simultaneous asset operations (building and publishing) | ||
| * | ||
| * @default 4 | ||
| */ | ||
| readonly concurrency?: number; | ||
| } | ||
|
|
||
| export interface PublishAssetsResult { | ||
| /** | ||
| * List of assets that were published | ||
| */ | ||
| readonly publishedAssets: IManifestEntry[]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import type { IManifestEntry } from '@aws-cdk/cdk-assets-lib'; | ||
|
|
||
| export interface AssetsPayload { | ||
| /** | ||
| * List of assets | ||
| */ | ||
| readonly assets: IManifestEntry[]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.