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

feat(api-gateway): allow configuration of deployment description #21207

Conversation

josephedward
Copy link
Contributor

@josephedward josephedward commented Jul 18, 2022


Closes #20934

Motivation: Customer would like to be able to set the description per deployment. From inside their pipeline, they could get the commit hash / commit message, timestamp, custom text, and other git-related metadata that they would like to set as description.

Thanks to @TheRealAmazonKendra for help cleaning this PR up and providing some pointers on locally building the CDK.

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 Jul 18, 2022

@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Jul 18, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team July 18, 2022 16:32
@josephedward
Copy link
Contributor Author

@peterwoodworth since RestApi already has a description (it was just never passed to _configureDeployment) do you think this warrants a change to a test or the README? This PR is for #20934 - but I don't see where _configureDeployment or the RestApiBaseProps interface are tested.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Please see my comment below. We will provide a more thorough review once the build is fixed and tests have been written.

@@ -554,7 +561,7 @@ export abstract class RestApiBase extends Resource implements IRestApi {
if (deploy) {

this._latestDeployment = new Deployment(this, 'Deployment', {
description: 'Automatically created by the RestApi construct',
description: props.description? props.description :'Automatically created by the RestApi construct',
Copy link
Contributor

Choose a reason for hiding this comment

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

Take a closer look at where this function is called. It's in two constructors, SpecRestApi and RestApi. The props for one of these doesn't have the description field. You'll need to add it there and then add some tests in both places for the output of description being set and not being set.

I will exempt a README change for this but it will require an update to the expected output of the integ tests as this will change the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @TheRealAmazonKendra ! That raises another question I had - how do I update those integration test outputs? Do I have to run a CDK synth, and if so, what do I need to pass to it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@josephedward josephedward Jul 19, 2022

Choose a reason for hiding this comment

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

If RestApiProps has a description var, and SpecRestApiProps extends RestApiBaseProps(where I added the var), do I need to add code to those constructors? Is it problematic that this description would possibly overlap with a description in the OpenAPI specification?

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra Jul 19, 2022

Choose a reason for hiding this comment

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

I interpreted the both the error message and the code wrong. Scratch everything I said and sorry for the confusion on my part.

The issue here is that RestApiProps extends RestApiOptions which extends RestApiBaseProps. So, description is being declared twice in the context of RestApiProps. Since you are (correctly) adding it to RestApiBaseProps it should be removed from RestApiProps. I think that will solve the error.

@TheRealAmazonKendra
Copy link
Contributor

Two additional quick notes:

This PR needs a body that aligns with our guidelines in the Pull Request section of the contributing guide. Please review that and revise the PR body. The title is great and needs no update.

Since you're not writing new integration tests, you don't really have to do the whole process in the file I linked to. Just run the build, see where the failures are, and update the expected values in those files as long as it aligns with what you'd expect to see as output.

You can either push changes and let CodeBuild run until failure and push another change to fix that failure (this will likely take a few attempts) or you can do it locally. If you do it locally, I highly recommend using the scrips/foreach.sh version of the build. Basically, build everything (warning: this takes a long time) using yarn install && scripts/foreach.sh yarn build. If a package fails the build for whatever reason (sometimes there's just a fluke failure) you can start where it left off with scripts/foreach.sh yarn build again.

Once the builds are complete, run scripts/foreach.sh yarn test. When you hit a failure, fix the output and re-run that. It starts from that package again so you're not starting over at the beginning. This is what I've found to be the fastest and most efficient way to find all the packages that have impacted integration tests.

@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/exempt-readme The PR linter will not require README changes label Jul 19, 2022
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 20, 2022 17:12

Pull request has been modified.

@josephedward
Copy link
Contributor Author

Thanks for the helpful info - running the full build locally now, but I committed that change and edited the PR body. I don't think I can see anything from CodeBuild? It wants me to authenticate first.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thanks for the helpful info - running the full build locally now, but I committed that change and edited the PR body. I don't think I can see anything from CodeBuild? It wants me to authenticate first.

You can read the output once the build completes. In this case, no integ test updates were needed so I'll exempt that. Please do add tests for both the case when you add a description and when you don't. Once we get that, I see this as done.

josephedward and others added 2 commits July 22, 2022 11:03
added tests for:
- instantiating RestApi with description
- instantiating RestAPI with no description
- calling _configureDeployment with a custom description
- calling _configureDeployment with no description
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 22, 2022 15:04

Pull request has been modified.

@josephedward
Copy link
Contributor Author

I added tests for creating a RestApi with and without a description, and tests for calling _configureDeployment with and without a description (since calling _configureDeployment defaults to 'Automatically created by the RestApi construct' instead of being blank). Linter still wants an update to the integration tests - I was running those but wasn't sure if you wanted me to update the snapshots, then I dropped it when I saw your message.

Removed double quotations
…cription' of https://github.com/josephedward/aws-cdk into feat(api-gateway)-allow-configuration-of-deployment-description
removing _configureDeployment
@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jul 22, 2022
@TheRealAmazonKendra
Copy link
Contributor

Oooops. You're totally right that I said I'd exempt integ test updates and then forgot to. It is possible, though, that the output will be impacted and an update will need to be made to the snapshots. Without looking through the tests themselves, I can't say for sure.

@@ -333,6 +333,23 @@ export interface SecureStringParameterAttributes extends CommonStringParameterAt
* @example
*
* const ssmParameter = new ssm.StringParameter(this, 'mySsmParameter', {
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the merge went wrong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that! I must have pulled from main on my local fork.

@mergify
Copy link
Contributor

mergify bot commented Jul 25, 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: c6c7bd0
  • 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 03fc2bd into aws:main Jul 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Jul 25, 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).

mrgrain pushed a commit to mrgrain/aws-cdk that referenced this pull request Jul 27, 2022
…#21207)

----
Closes aws#20934

Motivation: Customer would like to be able to set the description per deployment. From inside their pipeline, they could get the commit hash / commit message, timestamp, custom text, and other git-related metadata that they would like to set as description.

Thanks to @TheRealAmazonKendra for help cleaning this PR up and providing some pointers on locally building the CDK. 

### All Submissions:

* [ ] 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 Jul 28, 2022
…#21207)

----
Closes aws#20934

Motivation: Customer would like to be able to set the description per deployment. From inside their pipeline, they could get the commit hash / commit message, timestamp, custom text, and other git-related metadata that they would like to set as description.

Thanks to @TheRealAmazonKendra for help cleaning this PR up and providing some pointers on locally building the CDK. 

### All Submissions:

* [ ] 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 Jul 28, 2022
…#21207)

----
Closes aws#20934

Motivation: Customer would like to be able to set the description per deployment. From inside their pipeline, they could get the commit hash / commit message, timestamp, custom text, and other git-related metadata that they would like to set as description.

Thanks to @TheRealAmazonKendra for help cleaning this PR up and providing some pointers on locally building the CDK. 

### All Submissions:

* [ ] 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 added a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
…#21207)

----
Closes aws#20934

Motivation: Customer would like to be able to set the description per deployment. From inside their pipeline, they could get the commit hash / commit message, timestamp, custom text, and other git-related metadata that they would like to set as description.

Thanks to @TheRealAmazonKendra for help cleaning this PR up and providing some pointers on locally building the CDK. 

### All Submissions:

* [ ] 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
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(api-gateway): allow configuration of deployment description
3 participants