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: breaking change to deployment config props #22567

Merged
merged 1 commit into from
Oct 20, 2022
Merged

Conversation

MrArnoldPalmer
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer commented Oct 19, 2022

Change all deploymentConfig static method implementations on
EcsDeploymentConfig, LambdaDeploymentConfig, and
ServerDeploymentConfig to return their corresponding specific
interfaces instead of IBaseDeploymentConfig. This reverts breaking
changes to Java users introduced in #22159

Fixes #22566


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

@MrArnoldPalmer MrArnoldPalmer requested a review from a team October 19, 2022 21:38
@gitpod-io
Copy link

gitpod-io bot commented Oct 19, 2022

@github-actions github-actions bot added the p2 label Oct 19, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team October 19, 2022 21:38
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 19, 2022
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p0 and removed p2 labels Oct 19, 2022
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.

@MrArnoldPalmer
Copy link
Contributor Author

@clareliguori I removed all of the "more specific" deployment config interfaces as part of fixing this, instead of re-implementing the deploymentConfig and fromDeploymentConfigNasme methods in all of the deployment config classes (with the more specific return types) since I couldn't think of any case off the top of my head where these interfaces may be needed with additional properties etc.

Additionally we should be able to add them back with additional optional properties in the future in a non-breaking way, just keeping them around seems dangerous as it opens us to this bug of structural interfaces are implemented somewhere where an explicit type is actually needed for Java compatibility.

@kaizencc kaizencc added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Oct 19, 2022
@kaizencc
Copy link
Contributor

Exempting tests. Our typescript tests are insufficient to test this anyhow. I will test this locally in java before merging this PR.

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 19, 2022 21:47

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

@MrArnoldPalmer
Copy link
Contributor Author

MrArnoldPalmer commented Oct 19, 2022

@madeline-k pointed out a user explicitly importing and defining the more specific interfaces would be broken by this, but leaving them in feels like leaving the foot gun loaded.

import { IServerDeploymentConfig } from '';

const myThing: IServerDeploymentConfig { ... };

We may have to though, @kaizencc @corymhall what do you think?

@corymhall
Copy link
Contributor

@madeline-k pointed out a user explicitly importing and defining the more specific interfaces would be broken by this, but leaving them in feels like leaving the foot gun loaded.

Yeah I think we probably should leave them in. If we mark them as deprecated thats probably good enough to prevent them from being used in the future.

Comment on lines 164 to 170
"props-physical-name:@aws-cdk/aws-codedeploy.CustomLambdaDeploymentConfigProps",
"from-signature:@aws-cdk/aws-codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName",
"from-signature:@aws-cdk/aws-codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName",
"from-signature:@aws-cdk/aws-codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName",
"no-unused-type:@aws-cdk/aws-codedeploy.IEcsDeploymentConfig",
"no-unused-type:@aws-cdk/aws-codedeploy.ILambdaDeploymentConfig",
"no-unused-type:@aws-cdk/aws-codedeploy.IServerDeploymentConfig"
Copy link
Contributor

Choose a reason for hiding this comment

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

I've looked over these and they seem reasonable from our changes, but want to highlight them just in case.

Change all `deploymentConfig` static method implementations on
`EcsDeploymentConfig`, `LambdaDeploymentConfig`, and
`ServerDeploymentConfig` to return their corresponding specific
interfaces instead of `IBaseDeploymentConfig`. This reverts breaking
changes to Java users introduced in #22159
@MrArnoldPalmer MrArnoldPalmer force-pushed the fix/codedeploy-breakage branch from ff0d4de to 3b6bfde Compare October 20, 2022 00:31
@MrArnoldPalmer
Copy link
Contributor Author

Went back to keeping all of the interface types and instead of calling BaseDeploymentConfig.deploymentConfig from each implementor call a free floating function in utils.ts since overriding a protected method and changing the return type is not allowed by JSII. This should be non-breaking as BaseDeploymentConfig class is abstract.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

I tested this by running a java app against my local aws-cdk-lib with this change, and did not get an error. I also tested it against a normal aws-cdk-lib and did get the error. Putting my stamp of approval on this and shipping it.

@mergify
Copy link
Contributor

mergify bot commented Oct 20, 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 be6074a into main Oct 20, 2022
@mergify mergify bot deleted the fix/codedeploy-breakage branch October 20, 2022 02:16
madeline-k pushed a commit that referenced this pull request Oct 21, 2022
Change all `deploymentConfig` static method implementations on
`EcsDeploymentConfig`, `LambdaDeploymentConfig`, and
`ServerDeploymentConfig` to return their corresponding specific
interfaces instead of `IBaseDeploymentConfig`. This reverts breaking
changes to Java users introduced in #22159

Fixes #22566

----

### 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*
mrgrain pushed a commit to mrgrain/aws-cdk that referenced this pull request Oct 24, 2022
Change all `deploymentConfig` static method implementations on
`EcsDeploymentConfig`, `LambdaDeploymentConfig`, and
`ServerDeploymentConfig` to return their corresponding specific
interfaces instead of `IBaseDeploymentConfig`. This reverts breaking
changes to Java users introduced in aws#22159

Fixes aws#22566

----

### 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. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p0 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

‼️ (codedeploy): ServerDeploymentConfig Type Error in java
5 participants