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: version blocking for CLI #8737

Merged
merged 2 commits into from Nov 9, 2021
Merged

feat: version blocking for CLI #8737

merged 2 commits into from Nov 9, 2021

Conversation

attilah
Copy link
Contributor

@attilah attilah commented Nov 8, 2021

Description of changes

This PR adds a version blocking functionality to the CLI to guard against unwanted or unexpected results when a modification (add, remove, push, etc) operation would be executed against a project that was already pushed by a newer version of the CLI.

From now on Amplify CLI defines a minimumCLIVersion in its package.json file and also emits the same information into the root stack's Metadata section.

The version of the CLI that was used to execute the last push operation, also added to the root stack's Metadata and as a Tag on the stack resources as well.

If the CLI after checking the versions determine that the currently running CLI version has a lower version number it will exit the process.

There are certain commands that does not enforce this version check like amplify version or amplify env list.

If the version check should be bypassed for some reason, defining the AMPLIFY_CLI_DISABLE_VERSION_CHECK environment variable with any value will enable this.

Issue #, if available
N/A

Description of how you validated changes
Added unit tests to test the various parts of the new functionality

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies

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

@attilah attilah requested review from yuth and jhockett November 8, 2021 19:41
@attilah attilah requested a review from a team as a code owner November 8, 2021 19:41
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2021

Codecov Report

Merging #8737 (92f929a) into master (dbf9925) will increase coverage by 0.02%.
The diff coverage is 81.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8737      +/-   ##
==========================================
+ Coverage   56.93%   56.96%   +0.02%     
==========================================
  Files         756      757       +1     
  Lines       42255    42321      +66     
  Branches     8653     8675      +22     
==========================================
+ Hits        24059    24108      +49     
- Misses      17375    17392      +17     
  Partials      821      821              
Impacted Files Coverage Δ
...ppsync-simulator/src/utils/auth-helpers/helpers.ts 80.95% <ø> (ø)
...ppsync-simulator/src/utils/graphql-runner/index.ts 100.00% <ø> (ø)
packages/amplify-cli-core/src/index.ts 100.00% <ø> (ø)
...-transformer/src/graphql-searchable-transformer.ts 96.04% <ø> (ø)
...ify-graphql-transformer-core/src/transform-host.ts 23.62% <0.00%> (-1.59%) ⬇️
...rovider-awscloudformation/src/aws-utils/aws-cfn.js 16.66% <0.00%> (-0.05%) ⬇️
...awscloudformation/src/graphql-transformer/utils.ts 32.78% <ø> (+0.17%) ⬆️
...y-provider-awscloudformation/src/push-resources.ts 9.20% <0.00%> (-0.06%) ⬇️
...es/amplify-appsync-simulator/src/velocity/index.ts 73.13% <28.57%> (-5.56%) ⬇️
packages/amplify-cli/src/index.ts 37.75% <60.00%> (-0.07%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c534dc4...92f929a. Read the comment docs.

Copy link
Contributor

@jhockett jhockett left a comment

Choose a reason for hiding this comment

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

LGTM, just one nit

packages/amplify-cli/src/version-gating/index.ts Outdated Show resolved Hide resolved
@sachscode sachscode merged commit b92cd32 into aws-amplify:master Nov 9, 2021
sachscode added a commit that referenced this pull request Nov 9, 2021
sachscode added a commit that referenced this pull request Nov 9, 2021
ammarkarachi pushed a commit to ammarkarachi/amplify-cli that referenced this pull request Nov 9, 2021
ammarkarachi pushed a commit to ammarkarachi/amplify-cli that referenced this pull request Nov 9, 2021
sachscode pushed a commit that referenced this pull request Nov 9, 2021
* Revert "fix(amplify-category-auth): added username attributes to configure sms (#8624)"

This reverts commit adb70b1.

* Revert "Model vnext unit test update (#8749)"

This reverts commit 8a308a8.

* Revert "Revert "feat: version blocking for CLI (#8737)" (#8747)"

This reverts commit 2d5110c.

* Revert "chore: update aws-sdk, cdk, typescript dependency, regen yarn.lock (#8739)"

This reverts commit d8065a8.

* Revert "feat: version blocking for CLI (#8737)"

This reverts commit b92cd32.

* Revert "Remove pipelineFunction references in favor of resolvers (#8729)"

This reverts commit a0295aa.

* Revert "fix: move @model params to root stack and fix ds logical id (#8736)"

This reverts commit df4408c.

* Revert "fix(amplify-provider-awscloudformation): use amplify prompts for warnings (#8731)"

This reverts commit 98840ec.
SwaySway pushed a commit to SwaySway/amplify-cli that referenced this pull request Nov 9, 2021
SwaySway pushed a commit to SwaySway/amplify-cli that referenced this pull request Nov 9, 2021
@jhockett jhockett mentioned this pull request Apr 27, 2022
4 tasks
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.

None yet

5 participants