Skip to content

Conversation

edwardfoyle
Copy link
Contributor

@edwardfoyle edwardfoyle commented Mar 29, 2023

Description of changes

Adds a prePush handler to the auth category that checks to make sure the auth config is migrated from < v7 config (parameters.json) to the current config (cli-inputs.json). If not migrated, the push is stopped and instructions for migration are printed.

Issue #, if available

fixes #9750

Description of how you validated changes

Manually tested and added a unit test. Existing e2e tests running here https://app.circleci.com/pipelines/github/aws-amplify/amplify-cli?branch=run-e2e%2Ffoyleef%2Ffail-fast-migration

Checklist

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

@edwardfoyle edwardfoyle requested a review from a team as a code owner March 29, 2023 23:08
Amplifiyer
Amplifiyer previously approved these changes Mar 30, 2023
sobolk
sobolk previously approved these changes Mar 30, 2023
@edwardfoyle edwardfoyle dismissed stale reviews from sobolk and Amplifiyer via c125777 April 4, 2023 23:30
@akshbhu
Copy link
Contributor

akshbhu commented Apr 5, 2023

This can cause a breaking change to Cx who are using old templates without migration.

@edwardfoyle edwardfoyle added the do-not-merge PRs that are approved and green, but should not be merged yet label Apr 5, 2023
sobolk
sobolk previously approved these changes Apr 5, 2023
@edwardfoyle edwardfoyle removed the do-not-merge PRs that are approved and green, but should not be merged yet label Apr 5, 2023
sobolk
sobolk previously approved these changes Apr 5, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2023

Codecov Report

❌ Patch coverage is 86.36364% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.33%. Comparing base (984c0f8) to head (a4b93d8).
⚠️ Report is 1403 commits behind head on dev.

Files with missing lines Patch % Lines
packages/amplify-category-auth/src/index.js 14.28% 5 Missing and 1 partial ⚠️

❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #12337      +/-   ##
==========================================
- Coverage   49.45%   47.33%   -2.12%     
==========================================
  Files         692      841     +149     
  Lines       33424    38297    +4873     
  Branches     6840     7812     +972     
==========================================
+ Hits        16529    18129    +1600     
- Misses      15370    18524    +3154     
- Partials     1525     1644     +119     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@edwardfoyle edwardfoyle changed the title fix: block auth push if not migrated to cli-inputs fix: block auth w/ triggers push if not migrated to cli-inputs Apr 6, 2023
Copy link
Contributor

@akshbhu akshbhu left a comment

Choose a reason for hiding this comment

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

one more question , Is prePushHandler called when deploying with amplify init --forcePush ?

@edwardfoyle
Copy link
Contributor Author

@akshbhu It is as of my recent change around failing init --forcePush for missing params
https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-cli/src/commands/init.ts#L37

@edwardfoyle edwardfoyle merged commit 758f10a into aws-amplify:dev Apr 6, 2023
aws-eddy pushed a commit to aws-eddy/amplify-cli that referenced this pull request Apr 7, 2023
aws-eddy added a commit that referenced this pull request Apr 7, 2023
* chore: complete prefixing cli-core migration

* chore: generate api extract and sort package.json

* feat(amplify-util-uibuilder): support StorageField (#12386)

* feat((amplify-util-uibuilder): support StorageField

* chore: update all aws-sdk versions to ^2.1350.0

* fix: revert changes to package.json.ejs

* chore: add **/aws-sdk to package.json under resolutions

* fix: revert white space changes in package.json.ejs

* fix: bump codegen-ui to 2.12.1

* chore: bump lint memory

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>

* chore: reclassify CFN deployment errors if all the errors are from custom resources (#12398)

* chore: reclassify CFN deployment errors if all the errors are from custom resources

* fix: run prettier

* fix: correctly scope amplify-cli-core

* fix: pr review updates

* fix: reclassify BucketNotExists error during init-env (#12399)

* feat: create new NodeJS functions with nodejs18.x runtime (#12394)

* chore: use node 18 in the packaged cli

* chore: force prebuild-install to 7.11

* chore: try update

* Revert "chore: try update"

This reverts commit 6332c61.

* chore: disable deprecation flags

* chore: try node18 image

* chore: more memory

* chore: less parallelization

* chore: try newer windows

* Revert "chore: try newer windows"

This reverts commit 59d5e6d.

* chore: install node 18 on windows

* chore: install node 18 on windows

* chore: try this

* chore: try this

* chore: try this

* chore: try this

* Revert "Revert "chore: try newer windows""

This reverts commit dcac927.

* chore: try this

* chore: try this

* chore: consolidate steps

* chore: parallel in UT

* chore: parallel in UT

* chore: remove dotnet migration test

* chore: fix results script

* chore: fix dotnet

* chore: install create react app

* chore: allow old ssl

* Revert "chore: allow old ssl"

This reverts commit 08d03f9.

* chore: use new react scripts

* chore: poke ci

* chore: fix init test

* chore: use usual ECR repo

* chore: use previous windows image

* Revert "chore: use previous windows image"

This reverts commit f3299f1.

* chore: update pkg

* chore: remove sequential promise

* chore: run this in us west

* Revert "chore: remove sequential promise"

This reverts commit f053413.

* chore: wait for selection

* chore: wait for selection

* chore: wait for selection

* chore: wait for choice first

* feat: generate nodejs18 lambdas

* chore: dont use modules

* chore: undo that

* chore: make crud work

* chore: fix test

* chore: fix that test

* chore: refactor imports

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: add nodejs12.x to migrate from

* chore: fix test

* chore: fix test

* chore: test nodejs crud

* chore: update tests

* chore: pr feedback

* fix: block auth w/ triggers push if not migrated to cli-inputs (#12337)

* fix: catch undefined LogicalName when Lambda Layer versions are deleted from the console (#12351)

* fix: throw a descriptive AmplifyError when an existing lambda layer LogicalName is undefined

* chore: migrate missing files

* chore: fixing failing tests

* chore: sort package.json

* chore: complete prefixing cli-core migration

* chore: regenerate yarn.lock and address codeQL warnings

* chore: lint file

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>
Co-authored-by: Amplifiyer <[email protected]>
Co-authored-by: Edward Foyle <[email protected]>
Co-authored-by: Spencer Stolworthy <[email protected]>
aws-eddy added a commit to aws-eddy/amplify-cli that referenced this pull request Apr 10, 2023
* chore: complete prefixing cli-core migration

* chore: generate api extract and sort package.json

* feat(amplify-util-uibuilder): support StorageField (aws-amplify#12386)

* feat((amplify-util-uibuilder): support StorageField

* chore: update all aws-sdk versions to ^2.1350.0

* fix: revert changes to package.json.ejs

* chore: add **/aws-sdk to package.json under resolutions

* fix: revert white space changes in package.json.ejs

* fix: bump codegen-ui to 2.12.1

* chore: bump lint memory

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>

* chore: reclassify CFN deployment errors if all the errors are from custom resources (aws-amplify#12398)

* chore: reclassify CFN deployment errors if all the errors are from custom resources

* fix: run prettier

* fix: correctly scope amplify-cli-core

* fix: pr review updates

* fix: reclassify BucketNotExists error during init-env (aws-amplify#12399)

* feat: create new NodeJS functions with nodejs18.x runtime (aws-amplify#12394)

* chore: use node 18 in the packaged cli

* chore: force prebuild-install to 7.11

* chore: try update

* Revert "chore: try update"

This reverts commit 6332c61.

* chore: disable deprecation flags

* chore: try node18 image

* chore: more memory

* chore: less parallelization

* chore: try newer windows

* Revert "chore: try newer windows"

This reverts commit 59d5e6d.

* chore: install node 18 on windows

* chore: install node 18 on windows

* chore: try this

* chore: try this

* chore: try this

* chore: try this

* Revert "Revert "chore: try newer windows""

This reverts commit dcac927.

* chore: try this

* chore: try this

* chore: consolidate steps

* chore: parallel in UT

* chore: parallel in UT

* chore: remove dotnet migration test

* chore: fix results script

* chore: fix dotnet

* chore: install create react app

* chore: allow old ssl

* Revert "chore: allow old ssl"

This reverts commit 08d03f9.

* chore: use new react scripts

* chore: poke ci

* chore: fix init test

* chore: use usual ECR repo

* chore: use previous windows image

* Revert "chore: use previous windows image"

This reverts commit f3299f1.

* chore: update pkg

* chore: remove sequential promise

* chore: run this in us west

* Revert "chore: remove sequential promise"

This reverts commit f053413.

* chore: wait for selection

* chore: wait for selection

* chore: wait for selection

* chore: wait for choice first

* feat: generate nodejs18 lambdas

* chore: dont use modules

* chore: undo that

* chore: make crud work

* chore: fix test

* chore: fix that test

* chore: refactor imports

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: add nodejs12.x to migrate from

* chore: fix test

* chore: fix test

* chore: test nodejs crud

* chore: update tests

* chore: pr feedback

* fix: block auth w/ triggers push if not migrated to cli-inputs (aws-amplify#12337)

* fix: catch undefined LogicalName when Lambda Layer versions are deleted from the console (aws-amplify#12351)

* fix: throw a descriptive AmplifyError when an existing lambda layer LogicalName is undefined

* chore: migrate missing files

* chore: fixing failing tests

* chore: sort package.json

* chore: complete prefixing cli-core migration

* chore: regenerate yarn.lock and address codeQL warnings

* chore: lint file

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>
Co-authored-by: Amplifiyer <[email protected]>
Co-authored-by: Edward Foyle <[email protected]>
Co-authored-by: Spencer Stolworthy <[email protected]>
aws-eddy added a commit to aws-eddy/amplify-cli that referenced this pull request Apr 11, 2023
* chore: complete prefixing cli-core migration

* chore: generate api extract and sort package.json

* feat(amplify-util-uibuilder): support StorageField (aws-amplify#12386)

* feat((amplify-util-uibuilder): support StorageField

* chore: update all aws-sdk versions to ^2.1350.0

* fix: revert changes to package.json.ejs

* chore: add **/aws-sdk to package.json under resolutions

* fix: revert white space changes in package.json.ejs

* fix: bump codegen-ui to 2.12.1

* chore: bump lint memory

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>

* chore: reclassify CFN deployment errors if all the errors are from custom resources (aws-amplify#12398)

* chore: reclassify CFN deployment errors if all the errors are from custom resources

* fix: run prettier

* fix: correctly scope amplify-cli-core

* fix: pr review updates

* fix: reclassify BucketNotExists error during init-env (aws-amplify#12399)

* feat: create new NodeJS functions with nodejs18.x runtime (aws-amplify#12394)

* chore: use node 18 in the packaged cli

* chore: force prebuild-install to 7.11

* chore: try update

* Revert "chore: try update"

This reverts commit 6332c61.

* chore: disable deprecation flags

* chore: try node18 image

* chore: more memory

* chore: less parallelization

* chore: try newer windows

* Revert "chore: try newer windows"

This reverts commit 59d5e6d.

* chore: install node 18 on windows

* chore: install node 18 on windows

* chore: try this

* chore: try this

* chore: try this

* chore: try this

* Revert "Revert "chore: try newer windows""

This reverts commit dcac927.

* chore: try this

* chore: try this

* chore: consolidate steps

* chore: parallel in UT

* chore: parallel in UT

* chore: remove dotnet migration test

* chore: fix results script

* chore: fix dotnet

* chore: install create react app

* chore: allow old ssl

* Revert "chore: allow old ssl"

This reverts commit 08d03f9.

* chore: use new react scripts

* chore: poke ci

* chore: fix init test

* chore: use usual ECR repo

* chore: use previous windows image

* Revert "chore: use previous windows image"

This reverts commit f3299f1.

* chore: update pkg

* chore: remove sequential promise

* chore: run this in us west

* Revert "chore: remove sequential promise"

This reverts commit f053413.

* chore: wait for selection

* chore: wait for selection

* chore: wait for selection

* chore: wait for choice first

* feat: generate nodejs18 lambdas

* chore: dont use modules

* chore: undo that

* chore: make crud work

* chore: fix test

* chore: fix that test

* chore: refactor imports

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: fix test

* chore: add nodejs12.x to migrate from

* chore: fix test

* chore: fix test

* chore: test nodejs crud

* chore: update tests

* chore: pr feedback

* fix: block auth w/ triggers push if not migrated to cli-inputs (aws-amplify#12337)

* fix: catch undefined LogicalName when Lambda Layer versions are deleted from the console (aws-amplify#12351)

* fix: throw a descriptive AmplifyError when an existing lambda layer LogicalName is undefined

* chore: migrate missing files

* chore: fixing failing tests

* chore: sort package.json

* chore: complete prefixing cli-core migration

* chore: regenerate yarn.lock and address codeQL warnings

* chore: lint file

---------

Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Hein Jeong <[email protected]>
Co-authored-by: Kamil Sobol <[email protected]>
Co-authored-by: Amplifiyer <[email protected]>
Co-authored-by: Edward Foyle <[email protected]>
Co-authored-by: Spencer Stolworthy <[email protected]>
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.

Prevent $ amplify push without updating API, Auth, Storage category resources in v6 to v7 migration
5 participants