Reputation: 141
I work with cloud build and connect with bitbucket. The trigger have been work with a few build.
But suddenly, I got the error like in the screenshot. I don't have any idea.
What is it mean?
Upvotes: 3
Views: 7303
Reputation: 1960
I have encountered this issue multiple times with a Bitbucket Cloud (Mirrored) repository. Usually, it is due to a failed sync, and resyncing the repository at https://source.cloud.google.com/ typically resolves the problem.
This time, I had to clear the repository selection from the Cloud Build trigger, select it again, and then save the trigger. After doing this, the build started successfully and identified the branch commit.
Upvotes: 0
Reputation: 260
I had the same error and in my case there was an error syncing the Bitbucket with Cloud Repositories.
So, I recommend you to check your Cloud Repositories inside GCP because we create a mirror there from an external Git (Bitbucket for example) and it can fail syncing.
In my case, I removed the repository and added it again and it worked.
Upvotes: 0
Reputation: 1
I have also observed the same error (Couldn't read commit
). The solution was updating the cloud build service account permissions.
First, we must identify the service account used in Cloud build by navigating to Cloud build -> Setting.
We can then add the required permissions to the SA in IAM section. In my case, the Cloud build editor
role was missing from the SA account.
Please note that this is the Cloud build Service account, not the SA used in triggers.
Upvotes: 0
Reputation: 1279
I had the wrong repo URI (https://source.developers.google.com/$(PROJECT)/$(REPO)
instead of https://source.developers.google.com/p/$(PROJECT)/r/$(REPO)
)
I found the problem by recreating the trigger manually and comparing the exports
gcloud alpha builds triggers export $(TRIGGERNAME) --destination=trigger.yaml
Upvotes: 1
Reputation: 985
For me it was having regex in the branch name. So instead of ^feature/cloudbuild$
when I used feature/cloudbuild
, the error did not appear.
Upvotes: 1
Reputation: 160
Try enabling cloud build api (Service: cloudbuild.googleapis.com) in GCP (This error occurs if you don't) this is the cloud build api: https://cloud.google.com/build/docs/api/reference/rest
Here's how to enable api's https://cloud.google.com/apis/docs/getting-started#enabling_apis
Upvotes: 0
Reputation: 23
I also got the same error:
Failed to trigger build: Couldn't read commit
I had placed a different project ID in the trigger template of when I created the trigger config .yaml file. If someone stumbles on this issue, make sure that the project ID that you have placed is the same as the project ID of the repository. See the following:
triggerTemplate:
branchName: ^BRANCH_NAME$
projectId: PROJECT_ID_OF_THE_SOURCE_REPO_BRANCH
repoName: SOURCE_REPO_NAME
See documentation here:
Upvotes: 1
Reputation: 458
There is a limitation issue that Cloud Build connects to the bitbucket repo. it only allows the one connection per repo from Cloud Build. Please check if you have more connections to the repo? please remove the duplicate, and try again
Upvotes: 0