0

I have a repo set up locally to track a remote repo on AWS Code Commit. This repo has two permanent branches: 'master' and 'development'. I am trying to deploy each branch to separate Elastic Beanstalk applications, where one is used for production and the other for testing.

For each branch, I've used the EB CLI tool to create an application instance that tracks the appropriate remote branch in code commit. The first branch I do this with (master) always works, but once I add an application to track the 'development' branch I seem to create a duplicate remote called 'codecommit-origin', which I do not have access to edit. Example:

codecommit-origin   https://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (fetch)
codecommit-origin   https://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (push)
origin  ssh://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (fetch)
origin  ssh://git-codecommit.us-region-1.amazonaws.com/v1/repos/some_repo (push)

I do not have permission to access the 'codecommit-origin' remote, and removing it removes my ability to deploy the application, throwing this error:

ERROR: AttributeError :: 'NoneType' object has no attribute 'split'

For obvious reasons, this makes deploying updates to my application pretty painful. I essentially have to reset my remote with "git remote add origin [url]", push my commits, run "eb init" again, deploy, then remove the "codecommit-origin" it creates every time I want to change something.

Is there a better way to manage this workflow of deploying two elastic beanstalk applications from two branches in a single code commit repo?

DGaffneyDC
  • 152
  • 1
  • 2
  • 12
  • 1
    When you mention Applications do you mean Environments? EB CLI does support managing the CodeCommit branches each environment is tied to. Try using `eb use env_name` to switch which working environment you are on. Using `eb codesource` you should be able to set the default repo/branch for the current environment you are working with. – nbalas Mar 14 '17 at 00:18
  • Yes, environments, not applications. Thanks for the comment, I'll give it a try! The problem really seems to be occurring when I'm using [eb init] to link the branch to the environment in the first place. It keeps adding a duplicate remote repo for my local to track/deploy from, but I can only deploy that remote, I can't push to it.... this is harder to describe than I thought it would be. – DGaffneyDC Mar 14 '17 at 00:29
  • The EB CLI creates that remote to try to stay out of the way of any other remotes they may have been set. I think I may understand what your problem is, are you using OSX by chance? If so, you are most likely experiencing a known issue with CodeCommit. You can check out [this post](http://stackoverflow.com/questions/41433772/aws-eb-cli-codecommit-git-status-incorrectly-shows-branch-out-of-sync-after-d/41598699#41598699) to understand what is going on and how to fix it. – nbalas Mar 14 '17 at 18:23

1 Answers1

1

For master branch to deploy a beanstalk application, you can use the way eb init, ed create and eb deply.

To add development branch and environment, you need to use below steps:

git checkout development
# commit some changes
eb create
eb use --source

More detail, you can refer config additional branches and environments.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74