I am trying to sync two branches in two different repositories in AWS Codecommit. Is there any way to do the sync in an automated way?

478 views Asked by At

Using Codecommit to store the repositories. I have one branches in RepoA and one branch in RepoB. I am trying to sync the changes made in RepoA's branch into RepoB's branch but in an automated way. Is there any way I can use Lambda or codebuild containers to do so?

1

There are 1 answers

0
saurabh14292 On

I don't think so there is any out-of-the-box solution from CodeCommit for this. I also don't think having 2 different repos, one for developer and one for deployment is a good design.

Coming back to answer your question, you can sync the branches in 2 different repos through a script, and call the same from Lambda. However, what you have to take care over here is, are all the parameters to execute this script are well within Lambda's limits?

Assuming the sequence of operation is something like :

  1. Clone repo A.
  2. Checkout branch A.
  3. Add new remote "origin2" as repo B to repo A cloned copy.
  4. Pull from origin2 branch A.
  5. Push to origin2 branch A.

I would say, better to trigger a Container with required script and details/parameters to execute the script.

If you already have any CI setup such as Jenkins/Bamboo, it will be a lot easier.