Skip to content

fix(hotfix): match per-component env branches in finalize trigger - #547

Merged
joshua-temple merged 2 commits into
mainfrom
fix/hotfix-finalize-monorepo-env-branch-filter
Jul 10, 2026
Merged

joshua-temple merged 2 commits into
mainfrom
fix/hotfix-finalize-monorepo-env-branch-filter

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The generated cascade-hotfix-*.yaml finalize job triggers on pull_request: types:[closed] filtered to branches: ['env/*']. GitHub Actions branch-filter * does not cross /, so it matches single-segment env/staging but NOT the two-segment per-component env branches a multi-component manifest uses (env/api/staging, env/web/prod). On a monorepo, closing a hotfix PR against env/api/staging never fires the finalize: divergence is never recorded and the component state leaf never advances. Single-component repos were unaffected (their env/staging matches env/*), which is why this surfaced only under per-component coverage.

Fix

internal/generate/hotfix.go: change the finalize branch filter to 'env/**'. Per GitHub filter-pattern semantics ** matches any depth, so 'env/**' matches both env/staging and env/api/staging. The git refspec uses of env/* (refs/heads/env/*) are unchanged: git refspec * suffix-matches across / and already fetches nested env branches correctly.

Verification

Regression test TestHotfixGenerator_FinalizeTriggerMatchesNestedEnvBranches (red before, green after) asserts the emitted trigger is env/**. Byte-identical single-component golden updated (still matches env/staging, no single-component regression). go build ./..., go test ./... (2700 pass), go test ./... -race, golangci-lint run ./... all clean.

The hotfix finalize pull_request trigger filtered branches on env/*, but a
GitHub Actions branch glob stops at a slash. Per-component env branches carry
two segments (env/api/staging), so env/* never matched them and the closed-PR
finalize never fired for a multi-component pipeline: divergence went unrecorded
and the component state leaf never advanced. Widen the filter to env/**, which
matches both env/staging and env/api/staging with no change for single-component
pipelines.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
…2e scenario

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 31200d5 into main Jul 10, 2026
20 checks passed
@joshua-temple
joshua-temple deleted the fix/hotfix-finalize-monorepo-env-branch-filter branch July 10, 2026 02:48
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.

1 participant