Skip to content

Comments

feat(cli): add publish command for asset publishing#1020

Open
go-to-k wants to merge 38 commits intoaws:mainfrom
go-to-k:publish
Open

feat(cli): add publish command for asset publishing#1020
go-to-k wants to merge 38 commits intoaws:mainfrom
go-to-k:publish

Conversation

@go-to-k
Copy link
Contributor

@go-to-k go-to-k commented Jan 11, 2026

Fixes #982


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team January 11, 2026 17:42
@go-to-k go-to-k changed the title feat(cli): support publish command for asset publishing feat(cli): add publish command for asset publishing Jan 11, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 97.40260% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.84%. Comparing base (f7ffdad) to head (bcfc439).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/cdk-toolkit.ts 95.91% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1020      +/-   ##
==========================================
+ Coverage   87.76%   87.84%   +0.07%     
==========================================
  Files          72       72              
  Lines       10137    10214      +77     
  Branches     1339     1344       +5     
==========================================
+ Hits         8897     8972      +75     
- Misses       1215     1217       +2     
  Partials       25       25              
Flag Coverage Δ
suite.unit 87.84% <97.40%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@go-to-k
Copy link
Contributor Author

go-to-k commented Feb 23, 2026

@mrgrain

Tried to change it. Could you please take a look at it?

@go-to-k go-to-k requested a review from mrgrain February 23, 2026 10:04
},
},
},
'publish': {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure about the name yet

Copy link
Contributor Author

@go-to-k go-to-k Feb 23, 2026

Choose a reason for hiding this comment

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

I see. Do you have any good ideas?

publish, build, release, upload, push, prepare, etc...

'force': { type: 'boolean', alias: 'f', desc: 'Always publish assets, even if they are already published', default: false },
'asset-parallelism': { type: 'boolean', desc: 'Whether to build/publish assets in parallel' },
'concurrency': { type: 'number', desc: 'Maximum number of simultaneous asset publishing operations (dependency permitting) to execute.', default: 1, requiresArg: true },
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this the same setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The deploy command's settings already have that configurations. The asset-parallelism determines "whether to parallelize or not," and concurrency determines the number of parallel processes.
However, they certainly look similar. I removed asset-parallelism.

Comment on lines 514 to 542
const buildAsset = async (assetNode: AssetBuildNode) => {
const buildAssetSpan = await ioHelper.span(SPAN.BUILD_ASSET).begin({
asset: assetNode.asset,
});
await deployments.buildSingleAsset(
assetNode.assetManifestArtifact,
assetNode.assetManifest,
assetNode.asset,
{
stack: assetNode.parentStack,
roleArn: options.roleArn,
stackName: assetNode.parentStack.stackName,
},
);
await buildAssetSpan.end();
};

const publishAsset = async (assetNode: AssetPublishNode) => {
const publishAssetSpan = await ioHelper.span(SPAN.PUBLISH_ASSET).begin({
asset: assetNode.asset,
});
await deployments.publishSingleAsset(assetNode.assetManifest, assetNode.asset, {
stack: assetNode.parentStack,
roleArn: options.roleArn,
stackName: assetNode.parentStack.stackName,
forcePublish: options.force,
});
await publishAssetSpan.end();
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Lot's of duplication with _deploy() here. Let's find a way to reuse the same code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created createBuildAssetFunction and createPublishAssetFunction.

@go-to-k
Copy link
Contributor Author

go-to-k commented Feb 23, 2026

@mrgrain

I've updated them based on your feedback.

@go-to-k go-to-k requested a review from mrgrain February 23, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(cli): Add cdk publish command for asset publishing

3 participants