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(cx-api): bootstrap stack is validated even if the custom synthesizer does not require it #21518

Merged
merged 2 commits into from
Aug 9, 2022
Merged

fix(cx-api): bootstrap stack is validated even if the custom synthesizer does not require it #21518

merged 2 commits into from
Aug 9, 2022

Conversation

huyphan
Copy link
Contributor

@huyphan huyphan commented Aug 9, 2022

This fixes #21324

The property requiresBootstrapStackVersion of the class AssetManifestArtifact is a required property of type number that is defaulted to 1. This behavior prevents the custom synthesizers from disabling the validation of the bootstrap stack when it knows that it does not need this stack.

This change allows the property to be undefined, removes the behaviour of defaulting it to 1, and adds a breaking unit test.


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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

@gitpod-io
Copy link

gitpod-io bot commented Aug 9, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team August 9, 2022 09:56
@github-actions github-actions bot added p2 bug This issue is a bug. labels Aug 9, 2022
@huyphan huyphan marked this pull request as ready for review August 9, 2022 10:10
@mrgrain
Copy link
Contributor

mrgrain commented Aug 9, 2022

Hey @huyphan Could you share your reasoning why you've chosen Option 1 over Option 2 (as per the issue)?

API elements with incompatible changes:
err  - PROP @aws-cdk/cx-api.AssetManifestArtifact.requiresBootstrapStackVersion: type Optional<number> (formerly number): output type is now optional [changed-type:@aws-cdk/cx-api.AssetManifestArtifact.requiresBootstrapStackVersion]
@aws-cdk/region-info... OK.
Some packages seem to have undergone breaking API changes. Please avoid.

@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 9, 2022

Changing number to number | boolean is just as much of a breaking change as number | undefined is (which ?: number basically comes down to, more or less).

Given that, and since we are the only users of this code anyway, I'm okay with this change. It will break ~ 0 people.

(Watch me regret that stance as this change will bring customers out of the woodwork who this breaks 😅)

The only real alternative is { requiredVersion: number; justKiddingDisregardVersion?: boolean }, which I'd like to avoid if we can. If we end up breaking someone, we can always still move to that.

@huyphan
Copy link
Contributor Author

huyphan commented Aug 9, 2022

Even if there's anyone affected by this breaking change, the impact is negligible -- instead of failing early, the CLI will fail a bit later when it tries to make use of the resources in the bootstrap stack (e.g. uploading assets to the S3 bucket or the ECR repository). But all of that happened before a stack deployment, so it wouldn't affect a service stack.

Also, that scenario only happens when the user (1) uses a custom synthesizer which (2) makes use of the new-style bootstrap stack but (3) does not explicit specify that it needs a new-style bootstrap stack. This is a wrong logic anyway.

@mergify
Copy link
Contributor

mergify bot commented Aug 9, 2022

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: 95bf193
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Aug 9, 2022

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 merged commit afb1c2d into aws:main Aug 9, 2022
jusdino pushed a commit to Mxr-RAPID-DevOps/aws-cdk that referenced this pull request Aug 10, 2022
…zer does not require it (aws#21518)

This fixes aws#21324

The property `requiresBootstrapStackVersion` of the class `AssetManifestArtifact` is a [required property of type number](https://github.com/aws/aws-cdk/blob/34e31b90c8cdd51b8af61f352aa0ab7a0332ed4c/packages/%40aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts#L38-L41) that is [defaulted to `1`]((https://github.com/aws/aws-cdk/blob/34e31b90c8cdd51b8af61f352aa0ab7a0332ed4c/packages/%40aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts#L58)). This behavior prevents the custom synthesizers from disabling the validation of the bootstrap stack when it knows that it does not need this stack. 

This change allows the property to be `undefined`, removes the behaviour of defaulting it to `1`, and adds a breaking unit test. 

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
…zer does not require it (aws#21518)

This fixes aws#21324

The property `requiresBootstrapStackVersion` of the class `AssetManifestArtifact` is a [required property of type number](https://github.com/aws/aws-cdk/blob/34e31b90c8cdd51b8af61f352aa0ab7a0332ed4c/packages/%40aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts#L38-L41) that is [defaulted to `1`]((https://github.com/aws/aws-cdk/blob/34e31b90c8cdd51b8af61f352aa0ab7a0332ed4c/packages/%40aws-cdk/cx-api/lib/artifacts/asset-manifest-artifact.ts#L58)). This behavior prevents the custom synthesizers from disabling the validation of the bootstrap stack when it knows that it does not need this stack. 

This change allows the property to be `undefined`, removes the behaviour of defaulting it to `1`, and adds a breaking unit test. 

----

### All Submissions:

* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cli): the CLI still validates the bootstrap stack's version even when the asset producer says "don't"
4 participants