Selecting other branch instead of master as a source repository on AWS CodeBuild

bravokeyl picture bravokeyl · Dec 5, 2016 · Viewed 10.3k times · Source

How to specify different branch instead of master branch on AWS code deploy while using Github as source provider ? I see there is no option to select in the console to select branch(may be I missed).

I tried to checkout to different branch while we are in the pre_build phase, but it failed in the Download Source phase itself as the master branch doesn't have YAML file.

version: 0.1
phases:
  install:
    commands:
      - apt-get update -y
  pre_build:
    commands:
      - git checkout testbranch

Answer

Clare Liguori picture Clare Liguori · Dec 5, 2016

You can specify the branch in the "source version" field when you start a build. It will accept anything that "git checkout" accepts: commit ID, branch, tag, etc.