Amplify-console: [Question] Automate environment push and remove

Created on 27 May 2020  路  6Comments  路  Source: aws-amplify/amplify-console

Which Category is your question related to?
Environments and teams workflow.

Amplify CLI Version
4.21.0

What AWS Services are you utilizing?
Auth, Api, Storage, Hosting, Function, AppSync

Question
Suppose I have the following workflow.
A github repo with a master, develop and feature branches.
Developers can only merge to the develop and master branches through pull requests.
According to the docs to provision the backend from one environment to another one must:

  1. git clone
  2. amplify init
  3. git checkout feature
  4. amplify env checkout feature
  5. amplify pull
  6. git checkout develop
  7. amplify env checkout develop
  8. git merge feature
  9. amplify push

My question is, is there a way to automate this from a pull request? So a developer works on a feature on his own sandbox, he then creates a pull request and after the pull request is accepted and merged all of the steps above are automated. Maybe not all but those pertinent to merging a feature to develop.
Or will an admin have to perform all those steps above after a pull request is accepted?
Also, any way to remove an amplify environment automatically after a pull request has been merged and the branch deleted?

Just a note, I've set up Pull Request Previews and Continuous Deployment on AppSync.

bug

Most helpful comment

Hey @Joycehao19 , read though that and that's what I have at the moment.

I was looking for a way to automate the merge of amplify environments with pull requests.

Whenever an amplify environment is related to a branch, like the way it's recommended by the docs here: https://docs.amplify.aws/cli/teams/sandbox, and you want to merge said branch through a pull request, after doing the code review with the team a developer would have to manually merge the amplify environment after the pull request has been accepted.

I was looking for a way to automate that. Merge the amplify environment WITH the git branch. Basically, automating that second step described on the docs.

All 6 comments

@marlonmarcello We support a headless version some of the samples scripts and documentation. Is this something you were looking for?

These are interesting. Do you know of a way to implement these with the Amplify Console?

The Amplify Console does have a build script to perform CI/CD. Transferring to the console team as they should be able to help you out regarding this.

Hi @marlonmarcello , Here are some useful links about the way to use Amplify Console and Pr-Previews feature. If you have any questions, please let us know.

https://docs.aws.amazon.com/amplify/latest/userguide/getting-started.html
https://docs.aws.amazon.com/amplify/latest/userguide/pr-previews.html

Hey @Joycehao19 , read though that and that's what I have at the moment.

I was looking for a way to automate the merge of amplify environments with pull requests.

Whenever an amplify environment is related to a branch, like the way it's recommended by the docs here: https://docs.amplify.aws/cli/teams/sandbox, and you want to merge said branch through a pull request, after doing the code review with the team a developer would have to manually merge the amplify environment after the pull request has been accepted.

I was looking for a way to automate that. Merge the amplify environment WITH the git branch. Basically, automating that second step described on the docs.

Like @marlonmarcello, I find the same issue for my projects.

I'm using the Pattern-based feature branch deployments, and the sandbox-backend environments are always kept.

There's no mention of this behaviour in the documentation, and the only solution I can see for now is for myself to create a custom Lambda function to cleanup the stale environments...

Was this page helpful?
0 / 5 - 0 ratings