Skip to content
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

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

Merged
merged 5 commits into from
Sep 16, 2024
Merged

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

merged 5 commits into from
Sep 16, 2024

Conversation

kaizencc
Copy link
Contributor

@kaizencc kaizencc commented Sep 11, 2024

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:

  • cdk bootstrap with the following cdk.json file:
{
  "@aws-cdk/core:bootstrapQualifier": "abcde",
}
  • cdk bootstrap --qualifier="abcde"

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

@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p1 labels Sep 11, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team September 11, 2024 18:16
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 11, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

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.

@aws-cdk-automation aws-cdk-automation added the pr/needs-cli-test-run This PR needs CLI tests run against it. label Sep 11, 2024
@kaizencc kaizencc added pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Sep 12, 2024
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

I've made the decision that the --qualifier parameter takes precedent over the cdk.json context if they are both set but I can see a reasonable argument for throwing an error too

@kaizencc That's usually how it's done. But to confirm, how do other flags work?

Also the issue expects cdk.json to work. But you say you are fixing it for context.json? Can you clarify please.

@aws-cdk-automation
Copy link
Collaborator

➡️ PR build request submitted to test-main-pipeline ⬅️

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

@kaizencc kaizencc changed the title fix(cli): bootstrap respects qualifier from context.json fix(cli): bootstrap respects qualifier from cdk.json Sep 12, 2024
@kaizencc
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@kaizencc kaizencc added pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested and removed pr/needs-cli-test-run This PR needs CLI tests run against it. labels Sep 12, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review September 12, 2024 18:03

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Contributor

mergify bot commented Sep 16, 2024

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
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: ff55718
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 44134ad into main Sep 16, 2024
11 of 12 checks passed
Copy link
Contributor

mergify bot commented Sep 16, 2024

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

@mergify mergify bot deleted the conroy/p1 branch September 16, 2024 10:09
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort p1 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: cdk.json "qualifier" ignored
3 participants