Google Run always build from master branch

I use Google Run to deploy my project. I have set it up so that google build is connected to my repository and then builds the project with the dockerfile. i have two branches a master branch and another one named X. I have selected branch X in google build, but whenever I push to master, it uses master for the build. How can I make sure that it only builds branch X when pushing to it.

2 2 142
2 REPLIES 2

Hi @ishakhagi,

Welcome to Google Cloud Community!

You want to configure Google Run to only build branch X when you push to it, even though you have another branch called master. Here's a summary of what I suggested:

  • Double-check your build trigger configuration: Make sure the "Branch" field is explicitly set to "branch X" and there are no typos.
  • Consider separate triggers: If you want builds for different branches to be independent, create a new trigger specifically for branch X.
  • Use a Cloud Build configuration file: Define the branch in the branch field within your cloudbuild.yaml file.
  • Check inherited triggers: If the trigger is inherited from another resource, override the branch setting at the specific level where you need it.
  • Verify permissions and access: Ensure Cloud Build can access your repository and branch X.
  • Inspect build logs: Look for clues in the build logs if the issue persists.

There is no `Branch` field in the build config schema.

https://cloud.google.com/build/docs/build-config-file-schema

I also found the same as the OP that regardless of what branch I set as trigger the build system uses the master branch. It seems the Google Cloud services are in still stuck in the forever alpha/beta stage. Even to post this reply I had to post it twice because after login/authentication the post is lost.