Make sure GitHub tags can trigger jobs #83
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 545 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #83"
general
weight: 0.35
inteon
Companion PR of:
I've pushed v1.21.0-alpha.1 this morning, but no GCB job was triggered. I can't see anything in Google Cloud Logs either that would suggest a problem. My assumption was that there was some permission issue somewhere and the github-triggered jobs wouldn't get created. But no error can be seen in Google Cloud Logs...
For context, two weeks ago, we switched from using the default GCB service account to a custom service account in https://github.com/cert-manager/infrastructure/pull/74.
When triggering a build with "Run" in the UI, I was getting:
I came across https://stackoverflow.com/questions/79508588/cloud-build-trigger-fails-with-permission-denied-permission-cloudbuild-builds. The person came across the same weird
0000-prefixed project number... So I granted the "Cloud Build Service Account" role to1021342095237@cloudbuild.gserviceaccount.com(= the default GCB service account) to see. I was now able to trigger a job with "Run".I've read the docs in https://docs.cloud.google.com/build/docs/cloud-build-service-account at least 100 times, and I still can't make sense of it. Here is a snippet:
Makes no sense to me. What I've observed instead is the following:
1. When clicking "Run" or running
gcloud builds triggers run, 1021342095237@cloudbuild.gserviceaccount.com (legacy Cloud Build SA) is used to trigger the run.2. When pushing a tag, service-1021342095237@gcp-sa-cloudbuild.iam.gserviceaccount.com (Cloud Build service agent SA) is used.
Note that in both cases, the build will be running using the least-priviledged cert-manager-release-gcb@cert-manager-release.iam.gserviceaccount.com SA.
---
Trigger builds and Legacy Cloud Build service account
We have learned that the Trigger feature in Cloud Builds never uses the authenticated user as the identity that creates the builds. It always uses a fixed service account. As explained in Cloud Build default service account change, there are three possible "trigger" service accounts:
In our case, we are forced to use the legacy Cloud Build service account before of the following policies:
| Policy (= constraint) | Value |
|--|--|
| disableCreateDefaultServiceAccount | true |
| useComputeServiceAccount (= use the new default Compute SA) | true |
| useBuildServiceAccount (= use the legacy Cloud Build SA) | true |
Since we are on an old project (pre-2024),
useComputeServiceAccountdoesn't do anything sincedisableCreateDefaultServiceAccountprevents the creation of the default Compute service account. This is why the legacy Cloud Build service account is used for creating the builds on tag push +gcloud builds triggers run+ click on "Run" in the UI. We can see which SA is used to trigger with:Trigger build vs. Execute build
The SA 1021342095237@cloudbuild.gserviceaccount.com only needs to be able to create builds, not execute them.
On the other hand, cert-manager-release-gcb@cert-manager-release.iam.gserviceaccount.com is the SA used to execute the build. We only give it the permission to write the logs as well as some other things like read the KMS public key.