ci: show the Cloud Build website preview as a GitHub Deployment #4852
All Vouch review confidence checks passed
Residual risk 0.39 = Change Risk (0.66) × (1 − Review Confidence (0.40)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 385 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.356
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #4852"
general
weight: 0.35
markmandel
What type of PR is this?
/kind feature
What this PR does / Why we need it:
This is phase 1 of #4850: a first step towards replacing agones-bot with a GitHub Action, and useful
on its own.
It adds a Cloud Build complete workflow (
.github/workflows/cloud_build_complete.yaml). Theworkflow runs when the Cloud Build PR build check (
agones-dev-pull-request-build) completes. It isnamed for the trigger rather than this first job, so the PR comment from phase 2 can be added as
another job without renaming anything.
Its
website-previewjob runsbuild/scripts/cloud-build-complete, a small Go program with its ownmodule that uses
go-github. The program:1. Reads the build ID from the check run's summary (
Build <id> successful|failed).2. Downloads the public build log from
gs://agones-build-logs, retrying while it becomes available.3. Looks in the log for the
deploy-site-staticstep'sDeployed service [preview] to [<url>]line.4. If the preview was deployed, it creates a transient
website-previewDeployment on the PR's headcommit, with a success status whose
environment_urlis the preview and whoselog_urlis theCloud Build page. That way the preview shows on the PR, including for failed builds that got as
far as deploying it.
5. If the preview wasn't deployed, it adds a notice and a job summary to the workflow run instead.
It needs no Google Cloud credentials, only
contents: readanddeployments: writeonGITHUB_TOKEN.Which issue(s) this PR fixes:
Work on #4850
Did you use AI tools in preparing this PR?:
Y.
Special notes for your reviewer:
main.check_runworkflows only run from thedefault branch. Merging this answers the two open questions in #4850: whether
check_runfires forthe Cloud Build app's check runs, and whether a Deployment on a fork PR's head SHA is accepted and
shows on the PR. If either fails, the run's job log will show where. A failure here never affects
PR checks, because the workflow's own result is attached to
main's head commit.that it loads, because App Engine returns 200 for versions that don't exist.
-
auto_merge: falsestops GitHub mergingmaininto the ref.-
required_contexts: []skips waiting on the commit's other checks.-
transient_environment: truestops each new deployment marking other PRs' previews inactive.- If a
website-previewdeployment already exists for the SHA, the job skips it, so rebuildsdon't create duplicates.
mainwith a sparse checkout of just the program, and neverchecks out or runs PR code.
GitHub API.
make test-build-scriptsruns them, andmake lintlints the module, like the otherbuild scripts.
make -C build lint test-build-scriptspasses.