Skip to content

feat(backstage-template-execution): pitch run checkpoints to homerun2 - #68

Merged
patrick-hermann-sva merged 1 commit into
mainfrom
feat/template-execution-homerun
Oct 21, 2026
Merged

patrick-hermann-sva merged 1 commit into
mainfrom
feat/template-execution-homerun

Conversation

@patrick-hermann-sva

Copy link
Copy Markdown
Contributor

Closes #55.

What: backstage-template-execution pitches every checkpoint of a run to homerun2's omni-pitcher, so request-vm / request-vm-deletion runs reach Teams through notification-catcher (system: backstage-template-execution) the way cluster builds do.

Checkpoint Severity
started info
scaffolder-failed (call failed / task failed or cancelled / task did not finish) error
build-started (watched run appeared; PR number + run link) info
build-failed error
build-succeeded (says whether auto-merge follows) success
merged success
merge-refused (gate refusal names the checks) error
watch-failed error
timeout error

Title e.g. VM cutover2: merged (#3897), VM cutover2 deletion: build-failed (#3901); message carries template, lab/cloud/size/profile, PR, run and Backstage task links; url = PR, else run, else task. Not done: the name of the failed job (needs an extra jobs API call per failure) — the run link leads there.

How:

  • homerun.go: same env contract as cluster-build-watch's sink (HOMERUN_PITCH_URL, HOMERUN_AUTH_TOKEN_FILE over HOMERUN_AUTH_TOKEN, empty = off, token only over https, token scrubbed, URL dropped from transport errors). A copy with a pointer to the twin: the workflows are separate Go modules.
  • Best effort: the Pitch activity is retried 3× (10 s, 20 s); pitch() has no error return, so no checkpoint can change a run's result.
  • Always scheduled: the activity, not the workflow, reads HOMERUN_PITCH_URL — switching the sink on never changes a history.
  • FetchGitHubRun now returns the run's PR number (pull_requests[0]).
  • deploy/main.k: optional -D homerunPitchURL / -D homerunTokenSecret, as in cluster-build-watch's deploy (default render unchanged).
  • README: section "homerun2".

Tests: go vet ./... clean, go test ./... ok — subject/title/link mapping, off switch, bearer from file over env, https refusal with token (nothing sent), plain http without token, 502 with the token echoed back → error without the token, unreachable URL not leaked, PR number parsed.

Rollout caution: the workflow now schedules extra activities. An instance that is IN FLIGHT when the new image starts replays against a history without them — roll out when no BackstageTemplateRun is running (kubectl -n backstage-workflows get backstagetemplaterun, worker logs idle).

Follow-ups: release → argocd pin bump + chart wiring (stuttgart-things/argocd PR linked below) → catcher routing on sthings-app.

🤖 Generated with Claude Code

https://claude.ai/code/session_016TtmNGbCHXQGtqnrT926ZN

…#55)

Every checkpoint of a template run -- started, scaffolder-failed,
build-started, build-failed, build-succeeded, merged, merge-refused,
watch-failed, timeout -- goes to omni-pitcher as a homerun.Message with
system backstage-template-execution, so request-vm / request-vm-deletion
runs reach Teams through notification-catcher like cluster builds do.

Same env contract as cluster-build-watch's sink (HOMERUN_PITCH_URL,
HOMERUN_AUTH_TOKEN_FILE over HOMERUN_AUTH_TOKEN, https for a token, token
scrubbed); a copy, the workflows are separate modules. Best effort: the
Pitch activity is retried three times and its error dropped, and it is
always scheduled so the history never depends on the env. The watched
run now carries its PR number (pull_requests[0]) for title and link.

deploy/main.k: optional -D homerunPitchURL / -D homerunTokenSecret, as in
cluster-build-watch's deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016TtmNGbCHXQGtqnrT926ZN
@patrick-hermann-sva
patrick-hermann-sva merged commit b83ee5d into main Oct 21, 2026
8 checks passed
@patrick-hermann-sva
patrick-hermann-sva deleted the feat/template-execution-homerun branch October 21, 2026 05:43

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(backstage-template-execution): pitch build progress to homerun2 (like cluster-build-watch)

1 participant