Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCP CloudBuild -> Failed to trigger build: Couldn't read commit

I have had Cloudbuild triggers working flawlessly until Dec 2022. I have two triggers, one runs another trigger. One trigger (called `src`) reads `cloudbuild.yaml` from a GitHub repository. The file has a step that will attempt to run another trigger (called `dest`):

 

  - name: gcr.io/cloud-builders/gcloud
    id: Trigger application image build
    args:
      - beta
      - builds
      - triggers
      - run
      - dest
      - --branch=^dev$

 

Each trigger has a dedicated service account. `src` trigger has `roles/cloudbuild.editor` role assigned to it as well as `ServiceAccountUser` for `dest` SA. In other words, the settings that have worked prior to Dec 2022 had not changed. But for some reason I am receiving `(gcloud.beta.builds.triggers.run) FAILED_PRECONDITION: Couldn't read commit` error message when `src` trigger is attempting to run `dest` trigger and I can't figure out what has changed. I receive the same error message if I run the same command from the terminal.

Solved Solved
0 5 6,427
1 ACCEPTED SOLUTION

for anyone who comes across this - my issue was that I was trying to run a trigger by pointing the trigger to a branch that has had RegEx in its name:

- name: gcr.io/cloud-builders/gcloud
    id: Trigger application image build
    args:
      - beta
      - builds
      - triggers
      - run
      - th-cb-test-dest
      - --branch=^dev$

this needed to be:

- name: gcr.io/cloud-builders/gcloud
    id: Trigger application image build
    args:
      - beta
      - builds
      - triggers
      - run
      - th-cb-test-dest
      - --branch=dev

Note:

- --branch=dev

 

 

 

View solution in original post

5 REPLIES 5