Skip to content

feat(e2e): plumb act event payload and env/* branch fetch#112

Merged
joshua-temple merged 1 commit into
mainfrom
test/e2e-act-event-payload
Jun 11, 2026
Merged

feat(e2e): plumb act event payload and env/* branch fetch#112
joshua-temple merged 1 commit into
mainfrom
test/e2e-act-event-payload

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

Two harness gaps blocked the hotfix e2e flow:

  1. RunOpts.EventJSON was declared in act.go but never plumbed into the act invocation - the event payload was silently dropped on every run.
  2. SyncRepoToActContainer only fetched origin main; act jobs that inspect env/* branches or tags (plan/apply/finalize) could not see them.

Changes

  • act.go: When RunOpts.EventJSON is set, write the payload to /tmp/cascade-event.json inside the act container via CopyToContainer, then pass -e /tmp/cascade-event.json to the act invocation. Applies to both act run paths (RunWorkflow and RunWorkflowFromRepo). Flag construction is factored into a pure eventFileArgs helper for unit testing.
  • harness.go (SyncRepoToActContainer): after the load-bearing git fetch origin main && git reset --hard origin/main, also fetch +refs/heads/env/*:refs/remotes/origin/env/* and --tags, mirroring the fetch step in the generated hotfix workflow. The extra fetch is non-fatal (|| true) so the bounded-retry and lost-commit guarantees are preserved.
  • harness.go (localizeWorkflows): confirmed the existing yaml glob covers cascade-hotfix.yaml; added a comment noting the workflow name: field is only suffixed (not rewritten), preserving future workflow_files assertions over hotfix job/trigger content.
  • act_test.go: table-driven unit tests verifying -e <file> appears in the act command when an event payload is written and is omitted otherwise.

Apply-job strategy (recorded, not implemented here)

The generated apply job shells out to gh pr create/gh pr merge --auto, which does not speak Gitea's API. Therefore the apply job is not run under act. A later unit will drive the cherry-pick/PR/merge via harness primitives (real git cherry-pick + Gitea PRs), and then fire the merged-PR event payload (assembled by this EventJSON plumbing) so act runs the context/build/deploy/finalize jobs for real.

Verification

  • go build ./... and go vet ./... pass for both root and e2e modules.
  • TestMultiStepScenarios/Two_Environment and Three_Environment pass (no regression).
  • New eventFileArgs/buildActArgs unit tests pass.
  • golangci-lint run ./e2e/... clean.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit 0ad57b6 into main Jun 11, 2026
6 checks passed
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