2

I have followed this guide:

https://blogs.aws.amazon.com/application-management/post/Tx33XKAKURCCW83/Automatically-Deploy-from-GitHub-Using-AWS-CodeDeploy

It mentions that it will push the default branch from GitHub.

What about all the other branches one might have in the same repo?

Can I somehow specify which branch to deploy?

2 Answers 2

5

Here is how you can accomplish branch-specific deploy scenarios using AWS Code Deploy and AWS CodePipeline:

  1. Assuming you've already set up an application and deploy group with Code Deploy, create one group for your "Dev" branch, and another deploy group for "qa" or "stage".
  2. Enable CodePipeline in your AWS Console.
  3. Create a new pipeline by authorizing your Github account and providing access to the repository and branches you desire.
  4. In the BETA section of your new pipeline, edit it, authorize github again, and choose the specific branch you wish to deploy when changes are made.
  5. Now your system will automatically deploy based on a specific branch.
Sign up to request clarification or add additional context in comments.

Comments

-1

After scratching and cursing and researching and out of the box thinking...I managed to do it like this.

As long as CodeDeploy plays nicely only with the default branch, let's manipulate that one from the GitHUb API [you can do it also from the settings of the GH UI].

This is the code to change/update the default branch from your repo.

I have confirmed that CodeDeploy had no problem deploying the new branch! :]

1 Comment

I don't think this is the right answer. I'm also new to Code Deploy and was disheartened to find that I cannot set up deployment groups using my Dev or Stage branches. Ideally, the solution is to be able to say: Dev Branch -> Deploy to Dev Group. Stage Branch -> Deploy to Stage Group. Prod Branch -> Deploy to Prod Group.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.