aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.55k stars 3.87k forks source link

fix(cli): bootstrap respects qualifier from cdk.json #31410

Closed kaizencc closed 1 week ago

kaizencc commented 2 weeks ago

closes #28249.

The qualifier property can be set via the context key "@aws-cdk/core:bootstrapQualifier" and if omitted, the arbitrary default is hnb659fds. In the case of cdk bootstrap, there is an additional way to set the qualifier via the --qualifier CLI option. Specific to the cdk bootstrap logic, we currently only honor the command line argument, which is an error.

Ultimately, the following cdk bootstrap calls should be identical:

{
  "@aws-cdk/core:bootstrapQualifier": "abcde",
}

I've made the decision that the --qualifier parameter takes precedent over the cdk.json context if they are both set.

aws-cdk-automation commented 2 weeks ago

:arrow_right: PR build request submitted to test-main-pipeline :arrow_left:

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

kaizencc commented 2 weeks ago

I mean cdk.json, sorry. Although all places we add context goes into the same Configuration object so in theory it should work for both cdk.json and cdk.context.json.

kaizencc commented 2 weeks ago

The only other place in cli.ts where I see two ways of describing the same thing is here:

case 'synth':
        const quiet = configuration.settings.get(['quiet']) ?? args.quiet;

and it is in fact defaulting to the opposite. But this line was written by a community contributor and it doesn't look like that decision was made with any intentionality (and in fact maybe was done to make testing easier). I think we should default to command line arguments before context values and would support switching the quiet logic around also.

mergify[bot] commented 1 week ago

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-cdk-automation commented 1 week ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

mergify[bot] commented 1 week ago

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).

github-actions[bot] commented 1 week ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.