feat(cli): option to ignore no stacks#28387
Conversation
|
Still working through this, need to add tests. |
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
| }); | ||
| } | ||
| })); | ||
|
|
There was a problem hiding this comment.
should the integ tests go in this file?
packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts
Show resolved
Hide resolved
|
Exemption Request: I added a CLI integ test instead of framework-integ, because this is a change of CLI. |
|
@lpizzinidev When you have time could mind reviewing? |
lpizzinidev
left a comment
There was a problem hiding this comment.
The implementation looks good.
I left some comments for improvements 👍
packages/aws-cdk/lib/cli.ts
Outdated
| .option('asset-parallelism', { type: 'boolean', desc: 'Whether to build/publish assets in parallel' }) | ||
| .option('asset-prebuild', { type: 'boolean', desc: 'Whether to build all assets before deploying the first stack (useful for failing Docker builds)', default: true }), | ||
| .option('asset-prebuild', { type: 'boolean', desc: 'Whether to build all assets before deploying the first stack (useful for failing Docker builds)', default: true }) | ||
| .option('ignore-no-stacks', { type: 'boolean', desc: 'Ignore the error message if the app contains no stacks', default: false }), |
There was a problem hiding this comment.
| .option('ignore-no-stacks', { type: 'boolean', desc: 'Ignore the error message if the app contains no stacks', default: false }), | |
| .option('ignore-no-stacks', { type: 'boolean', desc: 'Whether to deploy if the app contains no stacks', default: false }), |
packages/aws-cdk/lib/cdk-toolkit.ts
Outdated
|
|
||
| const startSynthTime = new Date().getTime(); | ||
| const stackCollection = await this.selectStacksForDeploy(options.selector, options.exclusively, options.cacheCloudAssembly); | ||
| // eslint-disable-next-line max-len |
There was a problem hiding this comment.
| // eslint-disable-next-line max-len |
We should just take linter's advice and split the next line into multiple lines (same below).
| } else { | ||
| throw new Error('This app contains no stacks'); | ||
| } |
There was a problem hiding this comment.
| } else { | |
| throw new Error('This app contains no stacks'); | |
| } | |
| throw new Error('This app contains no stacks'); |
No need for an else
| } | ||
| })); | ||
|
|
||
| integTest('cli-lib deploy no stack', withCliLibFixture(async (fixture) => { |
There was a problem hiding this comment.
We should also add the throwing case for coverage.
| /** | ||
| * Higher order function to execute a block with a CliLib Integration CDK app fixture | ||
| */ | ||
| export function withCliLibIntegrationCdkApp<A extends TestContext & AwsContext>(block: (context: CliLibIntegrationTestFixture) => Promise<void>) { |
There was a problem hiding this comment.
Should use a different name than with-cli-lib
| .rejects.toThrow('conditional-resource does not exist'); | ||
| })); | ||
|
|
||
| integTest('deploy --ignore-no-stacks', withDefaultFixture(async (fixture) => { |
There was a problem hiding this comment.
Not sure about this.
We should verify that the app deploys when there are no stacks in it.
There was a problem hiding this comment.
Can you please add back the integration tests in cli-lib.integtest.ts? (both happy and failure cases)
Then this will be good imo.
lpizzinidev
left a comment
There was a problem hiding this comment.
On second thought, the integration tests in cli.integtest.ts should provide enough coverage here.
Thanks for the changes 👍
|
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
|
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Thank you @msambol !!! |
I'm new to development on this package—any feedback regarding testing is appreciated.
Closes #28371.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license