Repository navigation
fix(generate): invoke the configured deploy and rollback callbacks in the hotfix workflow - #696
Merged
Merged
Conversation
… the hotfix workflow (#678) The generated cascade-hotfix.yaml deploy and rollback jobs printed the deploy they stood in for and succeeded, so a green hotfix run cherry-picked, built, and finalized (state, tag, release) but never shipped the fix unless the operator ran the configured deploy workflow by hand. Each deploy job now invokes the configured deploy callback as a reusable workflow on the resolution pull request's merge commit SHA, and each paired rollback job re-invokes the same callback keyed on the pre-hotfix (N-1) SHA the context job resolves from the manifest, behind the existing failed-deploy gate. Both thread the callback contract's environment, sha, and dry_run inputs, each gated on the inputs the callee declares -- the rule the hotfix build jobs already follow, so a call never passes an input GitHub would reject at parse -- with a cross-repo callback falling back to the standard contract set. Per-callback permissions and secrets carry over to both caller jobs. The caller jobs are uses: jobs, which cannot carry a job-level environment: key, so the run-time-resolved target environment is threaded as the environment input and protection rules apply through the environment: key the callback declares on its own job, the same contract the promote and rollback workflows' deploy calls rely on. Every configured deploy is a reusable workflow: validation rejects inline run:/shell: callbacks and requires workflow: (#161), so both lanes are always uses: calls. Operator inputs and env_inputs stay unthreaded on the hotfix deploy path: env_inputs key on a target environment the hotfix resolves at run time from the merged pull request's base ref, so no generation-time value exists to emit, and no hotfix lane sources plain inputs. The golden, the determinism deploy stub, and the two docs caution blocks are updated with the placeholder they described gone. Fixes #678. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…ck re-deploys the N-1 sha The generator change had no runtime evidence: nothing a reviewer could turn red by reverting the invocation alone. hotfix_merged gains ExpectFailure, mirroring PromoteStep/RollbackStep, so a deliberately failing deploy callback can prove the failure propagates to the whole run: a success conclusion becomes the error, the step's expect.jobs and expect_log assertions still evaluate against the stored failed run, and state is re-synced from Gitea so a state assertion stays falsifiable when finalize is skipped. The new hotfix-deploy-failure-rollback.yaml scenario seeds a deploy stub that discriminates its lanes by the sha it receives, keyed on two markers the harness exports on every hotfix_merged run: the resolution pull request's merge SHA and the target environment's recorded N-1 SHA. Setup runs see neither marker and succeed; the merged-hotfix run fails at the merge SHA on purpose and succeeds only at the N-1 SHA. The run-level failure, the skipped finalize, the unchanged env pointer, and each lane's log marker pin the merge-SHA deploy, the propagated failure, and the rollback re-deploy of the N-1 sha. A replayed merge asserts the rollback lane's marker and that the failure is deterministic on rerun. hotfix-prod-gate.yaml and hotfix-rollback-runtime.yaml move from asserting the placeholder scaffolding to asserting the invocation and sha threading, and point at the new scenario for the runtime behavior they cannot stage. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
This was referenced Dec 1, 2026
Open
joshua-temple
approved these changes
Dec 1, 2026
joshua-temple
approved these changes
Dec 1, 2026
The new scenario's step 9 asserted a rollback-lane log marker that can never appear. act v0.2.99 aborts a plan when a reusable-workflow callee fails: handleFailure in pkg/runner/runner.go returns an error, and that error stops every later stage of the parent plan. The rollback jobs are a later stage, gated on always() && needs.deploy-<name>.result == 'failure', so under act the gate is never evaluated and the rollback lane never runs. CI (run 46715232982) showed exactly that split: step 8's deploy-failure assertions all passed and only step 9's rollback marker was missing, on every attempt and rerun. The scenario now asserts the trigger boundary, the same boundary promote/promote-rollback-runtime.yaml settles for. Step 8 is unchanged: the deploy lane is invoked at the merge sha, the run fails, finalize is skipped, and the env pointer stays at the pre-hotfix deployment. Step 9 is a deterministic replay of the same merged event: the deploy marker prints again, the run fails again (expect_failure), finalize is skipped again, and state is still held. The rollback-lane marker assertion and the stub branch that printed it are removed - the branch was unreachable under act - and with no consumer left, the harness stops exporting the N-1 marker on hotfix_merged runs. The scenario is renamed to Hotfix Deploy Failure Fails the Run and Holds State (file: hotfix-deploy-failure-holds-state.yaml) so the name claims only what it proves, and its description documents the act limit with the version and the mechanism, plus where the rollback lane's proof does live: the hotfix-rollback-runtime.yaml wiring assertions, the internal/generate tests that pin the emitted rollback call, and the live fleet. hotfix-prod-gate.yaml and hotfix-rollback-runtime.yaml no longer say the e2e suite executes the rollback callback at the N-1 sha at runtime, and the harness comment that promised both lanes were assertable through their markers is corrected the same way. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
This was referenced Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The
deploy-<name>androllback-<name>jobs in the generatedcascade-hotfix.yamlwere placeholders. Each held the target's GitHubenvironment:gate, printed the deploy it stood in for, and succeeded. So a green hotfix run cherry-picked, built and finalized (state, tag, release) but deployed nothing, and running the configured deploy against the hotfix merge SHA was a manual follow-up. The rollback job only printed a message too, so a failed hotfix had no automatic way back to the environment's pre-hotfix deployment.What changed
uses:) on the resolution pull request's merge SHA. The paired rollback job calls the same workflow on the pre-hotfix (N-1) SHA that the context job reads from the manifest, behind the existing failed-deploy gate.environment,shaanddry_runinputs, each only when the callee declares it, which is the rule the hotfix build jobs already follow. A cross-repo callback falls back to the standard contract set. Each callback'spermissions:andsecrets:apply to both lanes.uses:job can't carry a job-levelenvironment:key. The target environment, resolved at run time, is passed as theenvironmentinput instead, and protection rules apply through theenvironment:key the callback declares on its own job. Promote's and rollback's deploy calls rely on the same contract.env_inputsare deliberately not passed on the hotfix deploy path, and the reference says so.image_tagis tracked separately.How it's tested
New generator tests pin:
uses:with the merge SHA and with the N-1 SHA;dry_runpass-through;run:deploys, so both lanes are alwaysuses:calls.The updated prod-gate test pins that the environment is passed as an input, with no job-level
environment:key. Five of these tests fail on main.The regenerated golden and the determinism baseline match byte for byte.
actionlint is clean over the generated workflows, including the hotfix deploy and rollback call sites with real callback stubs.
A new e2e scenario,
hotfix/hotfix-deploy-failure-holds-state.yaml, runs the merged-hotfix path under act. Its deploy stub fails at the merge SHA on purpose, and the scenario checks that:finalizeis skipped;To support this,
hotfix_mergedgainsexpect_failure, as the promote and rollback steps already have.The rollback lane can't run under act. When a reusable-workflow callee fails, act v0.2.99 aborts every later stage of the parent plan, and the rollback job is a later stage. The scenario documents that limit. The rollback lane's N-1 call is pinned by the
hotfix-rollback-runtime.yamlwiring assertions and the generator tests, and runs for real in the fleet.go test ./...,go test -short ./...in e2e,gofmt -l .and golangci-lint all pass.Fixes #678