feat(appconfig): constrain environments to a single deployment at a time#29500
feat(appconfig): constrain environments to a single deployment at a time#29500mergify[bot] merged 8 commits intoaws:mainfrom
Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
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.
a6b974d to
39218f8
Compare
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
17211d0 to
e64d69d
Compare
e64d69d to
5f7015f
Compare
lpizzinidev
left a comment
There was a problem hiding this comment.
Looks good overall 👍
Left notes for some adjustments
| public readonly applicationId = applicationId; | ||
| public readonly environmentId = environmentId; | ||
| public readonly environmentArn = environmentArn; | ||
| public readonly name?: string | undefined; |
There was a problem hiding this comment.
| public readonly name?: string | undefined; | |
| public readonly name?: string; |
I'm not sure this will be set so probably for environments imported with fromEnvironmentArn the this.name! in addDeployment will throw.
Can you please verify?
There was a problem hiding this comment.
Yes, it will throw in that scenario and when the name is not provided to fromEnvironmentAttributes.
My understanding is that behavior is the same for the current implementation.
| public readonly applicationId = applicationId; | ||
| public readonly environmentId = environmentId; | ||
| public readonly environmentArn = environmentArn; | ||
| public readonly name? = undefined; |
There was a problem hiding this comment.
| public readonly name? = undefined; | |
| public readonly name = undefined; |
There was a problem hiding this comment.
I think having name as an optional property here is ok as it's only required when using the new methods.
|
|
||
| public addDeployment(configuration: IConfiguration): void { | ||
| if (this.name === undefined) { | ||
| throw new Error('Environment name must be known to add a Deployment'); |
There was a problem hiding this comment.
Just a note.
We can probably change this behavior by using the environmentId to build the CfnDeployment id.
However, it would require a feature flag and it's out of scope for this PR.
72448c3 to
02fb3f2
Compare
02fb3f2 to
1121054
Compare
1121054 to
9673773
Compare
paulhcsun
left a comment
There was a problem hiding this comment.
Thanks for the contribution @M-Hawkins and thank you for your patience in waiting for a review! The changes looks reasonable to me, I've left a few comments on the descriptions and one question on the login in addDeployment().
| public readonly applicationId = applicationId; | ||
| public readonly environmentId = environmentId; | ||
| public readonly environmentArn = environmentArn; | ||
| public readonly name? = undefined; |
There was a problem hiding this comment.
I think having name as an optional property here is ok as it's only required when using the new methods.
9673773 to
54b8341
Compare
|
Thanks for taking a look @paulhcsun ! |
|
@Mergifyio update |
|
Thanks again for this contribution @M-Hawkins!! And thanks as always for the review @lpizzinidev! |
✅ Branch has been successfully updated |
|
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). |
|
https://github.com/Mergifyio update |
☑️ Nothing to doDetails
|
|
@Mergifyio update |
✅ Branch has been successfully updated |
|
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
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). |
Issue # (if applicable)
Closes #29345.
Reason for this change
The current L2 AppConfig constructs do not have any guardrails
that prevent simultaneous Deployments to a single Environment.
This is not allowed, and will result in Cfn deploy-time conflicts.
Description of changes
This commit adds a pair of new public methods to IEnvironment that
enable the addition of a new Deployment for a given IConfiguration.
It then updates the creation of new Deployments in ConfigurationBase
to utilize these new methods instead of the current resource creation.
These new methods interact with an internal queue.
This queue creates a chain of Cfn dependencies between Deployments
in order to enforce that only a single Deployment can be in progress
for the Environment at any given time.
Description of how you validated changes
Added new unit and integ test coverage.
Deployed the new integ test without these changes and confirmed that Cfn failed at deployment time.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license