And also, what is the difference between these operations:
amplify env checkout [env-name]
amplify env pull [env-name]
amplify env pull [env-name] --restore
The documentation mentions these should follow git workflows, but it's still nebulous to me what exactly these operations are doing, especially within a multi-stage amplify environment.
@yuth @kaustavghosh06 I assume it has something to do with why aws-exports.js
is in .gitignore by default and conversely why it must be removed to work with Amplify Console frontend-only deployments.
We're working toward a truly automated CI/CD workflow (sans manual approval), and understanding these commands is important for writing the scripts / buildspecs that will test and deploy our CF stacks that are managed by Amplify.
@jkeys-ecg-nmsu
Please find response in-line
amplify env checkout [env-name]
This command helps you move from one environment to another similar to git checkout
.
It carries over the contents of the amplify/backend
directory i.e no changes are made to it but the amplify/#current-cloud-backend
is overwritten by the contents of the cloud for the environment you're checking into i.e the env-name
in the command.
amplify env pull [env-name]
This command helps you pulling in the state of the cloud - by pulling in the
amplify/#current-cloud-backend
directory for your current environment. You don't need theenv-name
parameter out here. This is helpful when you have multiple team members working on the same backend. You would ideally alwayspull
before youpush
to the cloud.
amplify env pull [env-name] --restore
This command helps you pulling in the state of the cloud - by pulling in the
amplify/#current-cloud-backend
directory for your current environment, but it also replaces all the contents in youramplify/backend
directory with that ofamplify/#current-cloud-backend
and all your local changes would be lost if you haven't pushed it.
This could be analogous togit reset master
.
Thank you! I think that's enough to write the CI/CD pipeline.
Most helpful comment
@jkeys-ecg-nmsu
Please find response in-line
This command helps you move from one environment to another similar to
git checkout
.It carries over the contents of the
amplify/backend
directory i.e no changes are made to it but theamplify/#current-cloud-backend
is overwritten by the contents of the cloud for the environment you're checking into i.e theenv-name
in the command.