← Back to Pull requests

Make sure GitHub tags can trigger jobs #83

Closed
unknown closed this pull request without merging on Jun 08, 2026 14:08 UTC
View on GitHub
unknown unknown commented on Jun 05, 2026 11:13 UTC
Author

Companion PR of:

  • https://github.com/cert-manager/cert-manager/pull/8851

  • https://github.com/cert-manager/release/pull/310

  • https://github.com/cert-manager/cert-manager/pull/8857
  • 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:

    Failed to trigger build: Permission 'cloudbuild.builds.create' denied on resource 'projects/000000edccbb9785' (or it may not exist)
    

    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 to 1021342095237@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:

    User access to triggers [...] for user-specified service account: Any user with the Cloud Build Editor role who has the iam.serviceAccounts.actAs permission can create and directly run a trigger. For example, a user can run the trigger manually.

    > Note: If you use the same service account to trigger and run a build, then that service account must still have the iam.serviceAccount.actAs (included in the roles/iam.serviceAccountUser role) permission.

    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:

  • The legacy Cloud Build service account (that's what we are using)

  • The default Compute Build service account

  • The user-specified service account selected in the Trigger.
  • 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), useComputeServiceAccount doesn't do anything since disableCreateDefaultServiceAccount prevents 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:

    $ gcloud builds get-default-service-account
    1021342095237@cloudbuild.gserviceaccount.com
    

    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.

    Diff: 545 lines (+408 / -137) across 6 files Reviewer: inteon Review duration: 4494m
    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
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48% (MEDIUM) · Higher = larger blast radius
    48%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.0% · Safe to merge
    19.0%