Skip to content

fix(ci): enable e2e for fork PRs via pull_request_target#680

Closed
johntmyers wants to merge 1 commit intomainfrom
fix/e2e-skip-fork-prs
Closed

fix(ci): enable e2e for fork PRs via pull_request_target#680
johntmyers wants to merge 1 commit intomainfrom
fix/e2e-skip-fork-prs

Conversation

@johntmyers
Copy link
Copy Markdown
Collaborator

@johntmyers johntmyers commented Mar 30, 2026

Summary

Enable full e2e test pipeline for fork PRs by switching to pull_request_target and adding ref input to reusable workflows.

Related Issue

Observed on PR #672 — fork PRs can't push to GHCR due to read-only GITHUB_TOKEN.

Why not local-build?

Attempted a single-job local-build approach (build images with --load, use local registry, no GHCR push). It failed because:

  • --network host conflicts with Actions' auto-created container network
  • host.docker.internal doesn't resolve in Linux CI containers
  • The CI container can't configure the host Docker daemon's insecure registry list (it accesses Docker via socket mount, not daemon config)

Changes

branch-e2e.yml: pull_request -> pull_request_target. Passes github.event.pull_request.head.sha as explicit ref to all child workflows. The test:e2e label requirement is the security gate.

docker-build.yml: New ref input overrides checkout ref and IMAGE_TAG. Defaults to empty (falls back to github.sha), so existing callers (release-tag.yml, release-dev.yml) are unaffected.

e2e-test.yml: New ref input for checkout.

github.sha under pull_request_target

Under pull_request_target, github.sha is the base branch HEAD. Without the ref override, the workflow would build and test main instead of the PR. The explicit ref fixes this.

Checklist

@johntmyers johntmyers requested a review from a team as a code owner March 30, 2026 16:58
@johntmyers johntmyers force-pushed the fix/e2e-skip-fork-prs branch from d49c40e to a5f94ef Compare March 30, 2026 17:00
pimlock
pimlock previously approved these changes Mar 30, 2026
@johntmyers johntmyers force-pushed the fix/e2e-skip-fork-prs branch from a5f94ef to 76ae655 Compare March 30, 2026 17:09
@johntmyers johntmyers changed the title fix(ci): skip e2e docker builds for fork PRs fix(ci): enable e2e tests for fork PRs via pull_request_target Mar 30, 2026
@johntmyers johntmyers force-pushed the fix/e2e-skip-fork-prs branch from 76ae655 to 8d654f9 Compare March 30, 2026 17:47
@johntmyers johntmyers changed the title fix(ci): enable e2e tests for fork PRs via pull_request_target fix(ci): run e2e as a single local job without GHCR push Mar 30, 2026
@johntmyers johntmyers self-assigned this Mar 30, 2026
@johntmyers johntmyers added test:e2e Requires end-to-end coverage labels Mar 30, 2026
@johntmyers johntmyers force-pushed the fix/e2e-skip-fork-prs branch 6 times, most recently from e26aead to 50d7bc2 Compare March 30, 2026 18:31
The local-build approach (single job, no GHCR push) is not feasible
because the CI container cannot configure the host Docker daemon's
insecure registry list, and container networking prevents access to
the local registry on the host loopback.

Switch to pull_request_target instead, which runs in the base repo
context with write permissions to GHCR. The existing three-job pipeline
(build-gateway, build-cluster, e2e) works unchanged.

Security: the test:e2e label is a maintainer trust gate — only org
members can apply it, signalling the PR code has been reviewed.

Add ref input to docker-build.yml and e2e-test.yml so callers can
pass github.event.pull_request.head.sha for checkout and image tagging,
since github.sha points to the base branch under pull_request_target.
@johntmyers johntmyers force-pushed the fix/e2e-skip-fork-prs branch from 50d7bc2 to 30956e1 Compare March 30, 2026 18:32
@johntmyers johntmyers changed the title fix(ci): run e2e as a single local job without GHCR push fix(ci): enable e2e for fork PRs via pull_request_target Mar 30, 2026
@johntmyers johntmyers closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants