feat: add repository_dispatch trigger to the rollback workflow#242
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
f334242 to
fa67f01
Compare
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.
Problem
The generated
cascade-rollback.yamlworkflow triggers onworkflow_dispatchonly. There is no way for an external system (an alerting or incident pipeline) to fire the same N-1 rollback automatically. Closes #181.Fix
Add an opt-in
rollback.repository_dispatchblock onTrunkConfig(sibling-pointer pattern, allomitempty). It reuses the existingRepositoryDispatchTriggershape, so event types are configured exactly likeextra_triggers.repository_dispatch.When enabled, the generated rollback workflow:
repository_dispatch:trigger (with the configured eventtypes) underon:, alongside the unchangedworkflow_dispatch:.${{ github.event.inputs.<x> || github.event.client_payload.<x> }}in the preflight env block, the deploy-job dry_run/deployable guard, the finalize gate, and the finalize DEPLOYABLE read. Coalesced reads inside comparisons are parenthesized so!= 'true'/== ''bind to the whole value.repository_dispatchcarries noinputs; the parameters travel inclient_payload, keyed name-for-name with the manual inputs:client_payloadkeyenvironmenttargetdeployabledry_runAn external system fires it with one dispatches API call:
OFF-state is byte-identical
Absent the block (or with an empty
rollback:), the generated workflow is byte-for-byte unchanged:workflow_dispatch-only, baregithub.event.inputs.*reads, norepository_dispatch, noclient_payload.schema_versionis not bumped; the new fields are additive (omitempty). Guarded by a dedicated unit test plus the existingTestPlan_MatchesGeneratedBytesgolden.Validation
If
rollback.repository_dispatchis present, at least one event type is required and each type must contain only[A-Za-z0-9_.-](safe to emit verbatim into YAML).Verification
go build ./cmd/... ./internal/...clean;go test ./...1638 passed;golangci-lint run ./...no issues; e2e module build + vet clean.e2e/scenarios/32-rollback-repository-dispatch.yamlPASSED under Docker: asserts the emittedrepository_dispatchtrigger + coalesced reads (realcontains/not_contains), and regenerates drift-free. Theact-based harness cannot synthesize arepository_dispatchevent with aclient_payload, so the external path is asserted structurally rather than executed; theworkflow_dispatchpath stays covered by the rollback runtime scenarios.manifest.schema.jsoncopies regenerated and content-identical.