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: remove parameters when resource is deleted or unlinked #12544

Merged
merged 6 commits into from
May 19, 2023

Conversation

jhockett
Copy link
Contributor

@jhockett jhockett commented Apr 28, 2023

Description of changes

Add a step a the end of amplify push to remove parameters from Parameter Store for any resources that were removed during push.

Issue #, if available

Fixes #12385

Description of how you validated changes

e2e test passes locally, also manually verified correct parameters are removed

Passing e2e run

Checklist

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

@jhockett jhockett requested a review from a team as a code owner April 28, 2023 19:41
@@ -480,7 +480,10 @@ export const run = async (context: $TSContext, resourceDefinition: $TSObject, re
.map(({ category, resourceName }) => context.amplify.removeDeploymentSecrets(context, category, resourceName));

await adminModelgen(context, resources);

await deleteEnvironmentParametersForResources(context, context.amplify.getEnvInfo().envName, [
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
await deleteEnvironmentParametersForResources(context, context.amplify.getEnvInfo().envName, [
await deleteEnvironmentParametersForResources(context, [

envInfo we can fetch inside the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would limit the use of the function to the current environment. I updated to use stateManager to resolve the current envName.

@codecov-commenter
Copy link

Codecov Report

Merging #12544 (3cc4708) into dev (ec9a2ba) will increase coverage by 47.59%.
The diff coverage is 45.78%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff             @@
##              dev   #12544       +/-   ##
===========================================
+ Coverage    0.00%   47.59%   +47.59%     
===========================================
  Files        1296      842      -454     
  Lines      149743    38323   -111420     
  Branches     1296     7835     +6539     
===========================================
+ Hits            0    18241    +18241     
+ Misses     148447    18459   -129988     
- Partials     1296     1623      +327     
Impacted Files Coverage Δ
...ify-category-function/src/events/prePushHandler.ts 33.33% <0.00%> (+33.33%) ⬆️
...ib/S3AndCloudFront/helpers/configure-CloudFront.js 87.06% <ø> (+87.06%) ⬆️
...lify-category-hosting/lib/S3AndCloudFront/index.js 89.65% <ø> (+89.65%) ⬆️
...s/amplify-cli-core/src/errors/amplify-exception.ts 82.35% <ø> (+82.35%) ⬆️
packages/amplify-cli-core/src/types.ts 100.00% <ø> (+100.00%) ⬆️
packages/amplify-cli/src/commands/console.ts 0.00% <0.00%> (ø)
packages/amplify-cli/src/commands/pull.ts 0.00% <0.00%> (ø)
...es/amplify-provider-awscloudformation/src/index.ts 60.20% <ø> (+60.20%) ⬆️
...c/extensions/amplify-helpers/auth-notifications.ts 41.00% <4.34%> (+41.00%) ⬆️
...service-walkthroughs/execPermissionsWalkthrough.ts 70.42% <11.11%> (+70.42%) ⬆️
... and 22 more

... and 1273 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@awsluja awsluja left a comment

Choose a reason for hiding this comment

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

lgtm

@jhockett jhockett merged commit f78fb68 into aws-amplify:dev May 19, 2023
@jhockett jhockett deleted the ps-delete-on-push branch May 19, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amplify import storage pollutes ParameterStore with duplicate parameters
5 participants