question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What’s the best workflow for multi-env?

See original GitHub issue

Which Category is your question related to? multi-env

Amplify CLI Version 4.19

What AWS Services are you utilizing? API, Auth, Lambda, DynamoDB, S3

I realize that this is partially an Amplify Console question, but there is overlap, so I’m asking this here first, because my confusion mainly revolves around multi-env on my local.

I’ve read Team workflows with Amplify CLI backend environments, and it’s what I’m trying to follow as a guide.

And I’m admittedly confused, as I write this, so kindly keep that in mind.

If I’m working in an existing prod env that has been created with multiple back-end resources (e.g. auth, lambda, storage, etc.), and I do a amplify env add, adding a new develop env, followed by a amplify push, it modifies several files in the existing git branch (currently master) on my local that are specific to the new develop environment.

These include:

  • team-provider-info.json
  • cloud formation templates for lambdas
  • aws-exports.js

team-provider-info.json seems fine to commit and push to master, and aws-exports.js is excluded so that’s okay too. But, from what I can tell, the cloud formation templates are updated with new values for the S3 deployment bucket.

If I’m in the master branch (git) when I do this, and I push those changes to an Amplify Console connected repo, won’t this result in the current front-end in the Amplify console talking to the back-end resources for the newly created amplify env?

If I’m in a develop branch when I add and push the new env via amplify cli, the same file changes occur, and connecting the new branch in the Amplify console results in a separate app talking to the correct backed, with master left as-is. All good!

Here’s where I get confused: I now want to merge develop to master.

If I do this, the aforementioned file changes will overwrite those in master, and I fear this will cause master to talk to the wrong back-end.

If I’m incorrect about this assumption, and checking these env related changes, please set me straight. I’m asking because, I’ve recently had an incident where I’ve deployed a front-end and it was talking to an incorrect back-end, but I’m not completely sure how exactly I worked that piece of magic.

If what I’ve described is correct, what is the workflow to be used to ensure that the correct cloud formation templates are committed to the correct branches so that deployment front-ends are configured with the correct back-ends?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kevcam4891commented, Jun 19, 2020
  1. We’re working on a better way to do this - but at this point this is the way we’re handling uploading updates to the Lambda function via CloudFormation.

@kaustavghosh06 Have you guys had any progress on this? Is this a matter of ignoring the cloudformation file when doing the directory change hash computation, or something a little more nuanced?

1reaction
kaustavghosh06commented, Oct 22, 2020

@kimfucious Yup, adding those files to .gitignore to avoid the headache of viewing it in git updates is a good idea if you’re not actively working on the resource. Closing this issue and goes without saying that if you have any other specific issues please feel free to open up a new issue in our repo!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Multiple Environments to Improve Your Development ...
In today's modern business environment, it is imperative for product development teams to maintain an optimal workflow if they hope to ...
Read more >
Using workflows to deploy an API to multiple environments
In our multi-deployment process, we will create a workflow that first deploys an API to a staging environment, and runs automated tests ...
Read more >
GitHub Action Reusable Workflows With Multi Environments ...
1. SUBSCRIBE FOR MORE LEARNING : https://www.youtube.com/channel/UCv9MUffHWyo2GgLIDLVu0KQ=...
Read more >
Multi-environment service orchestrations | Google Cloud Blog
This approach makes it easy to deploy changes to a workflow in a staging environment, run tests against it, and gradually roll out...
Read more >
Github Actions: deploy to multiple environments from single ...
Github Actions is awesome and you can automate so much with it. One lacking feature though is support for code reuse in workflow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found