Selecting other branch instead of master as a source repository on AWS CodeBuild
Solution 1
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.
Solution 2
If you want to change the default branch (when not supplying a version in the individual build) from master to something else you have to use the AWS CLI as there is apparently no option in the UI:
aws codebuild update-project --name your_project_name --source-version your_default_branch
Adding a new source version at build time will still override this value per the docs:
If sourceVersion is specified at the project level, then this sourceVersion (at the build level) takes precedence.
Related videos on Youtube
Comments
-
bravokeyl almost 4 years
How to specify different branch instead of
master
branch on AWS code deploy while usingGithub
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 themaster
branch doesn't have YAML file.version: 0.1 phases: install: commands: - apt-get update -y pre_build: commands: - git checkout testbranch
-
bravokeyl over 7 years
aws-codebuild
will be a prefect tag for this, but I don;t have enough rep to create it. -
Sachin Vairagi over 3 yearsCan you please post complete answer? accepted answer is not working for me. Thanks!
-
-
bravokeyl over 7 yearsWhere is this source version field, I'm unable to find?
-
Illiax about 7 yearsThis doesn't work for me, it only accepts commit ids
-
Illiax about 7 years@ClareLiguori It started working. I think it was that i was using 'enter key' after typing the branch instead of clicking in continue below.
-
Matthew Hegarty over 3 yearsDoesn't work for me either. branches are ok, but tags or ids don't work. Issue raised here
-
Sachin Vairagi over 3 yearsI just entered branch name in Source version but the build is triggering even I am pushing codes on different branch