Skip to content

chore(ci): bridge fork CI coverage to Codecov for the PR - #20475

Draft
voonhous wants to merge 3 commits into
apache:masterfrom
voonhous:ci-codecov-bridge
Draft

voonhous wants to merge 3 commits into
apache:masterfrom
voonhous:ci-codecov-bridge

Conversation

@voonhous

Copy link
Copy Markdown
Member

Describe the issue this Pull Request addresses

With fork CI, a fork PR's tests run on the fork, which cannot use apache/hudi's Codecov token and is not linked to the PR, so the Codecov comment disappears from fork PRs during review.

Part of #20471. Stacked on the fork CI PR (and #20473): review the top commit only.

Summary and Changelog

  • New upload-coverage action replaces the 12 Codecov steps. In apache/hudi it uploads exactly as before; on a fork it saves jacoco-report.xml as an artifact named by commit, job and flag.
  • New fork_coverage_bridge.yml, every 15 minutes: matches each open fork PR's head commit to the fork's finished CI run, downloads its coverage artifacts with its own GITHUB_TOKEN, uploads them to Codecov for that PR and commit under the same flags, and records a Coverage (fork) check so each run uploads once.
Trust model and smaller changes
  • Artifacts are untrusted data: names must match a strict pattern and a flag allowlist, sizes are capped, only the one XML member is extracted, and no fork code is checked out or executed. A fork can still forge its own coverage; coverage does not gate merges.
  • Codecov maps JaCoCo package paths through the uploader's file list, so the bridge loads the PR head's file list with a tree-only fetch from apache/hudi (no file contents).
  • A workflow's own GITHUB_TOKEN can download another public repository's artifacts: probe run (302 with the token, 401 without).
  • 15 node tests of the selection and recording scripts run in validate-pr-and-source.

Impact

Fork PRs get the Codecov comment back, up to about 15 minutes after their fork run finishes. Nothing changes for runs in apache/hudi.

Risk Level

low. The upload path in apache/hudi is unchanged; the bridge only reads public artifacts and writes Codecov uploads and one check per run.

Documentation Update

.github/workflows/README.md updated.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

Prepares Java CI for a GitHub merge queue (apache#20471, apache#19612). The queue
itself is enabled later through .asf.yaml.

- New ci.yml owns the triggers (pull_request, merge_group, push,
  workflow_dispatch) and calls bot.yml and java_ci_engines.yml as
  reusable workflows. Its Required Checks job reports on every PR and
  queue run, and fails unless both called workflows succeed.
- Only push keeps the path filter: a required check must report on
  every PR, and a selector job would add a second runner wait.
- Concurrency moves to ci.yml. Pushes are keyed by SHA so queue merge
  bursts never replace a pending master run; only PR runs cancel.
- Codecov steps skip merge_group runs, which would file coverage under
  master for commits that may never land.
- validate_source.yml also reports on merge_group, and never cancels
  queue runs.
Second part of apache#20471, following apache/arrow-rs. Fork PRs to master
run the Java CI suites on the fork's own runners when the contributor
pushes; the upstream PR run skips them, and the merge queue runs them
on ASF runners before merge.

- ci.yml runs on every branch push. Upstream it skips pushes to
  branches other than master, release-* and branch-0.x, and skips both
  suites on fork PRs to master. Release-branch PRs keep upstream
  testing. Fork pushes cancel the older run of the same branch.
- Required Checks accepts skipped suites only on a fork PR to master,
  and links the fork run from the job summary.
- New fork_ci_status.yml, adapted from arrow-rs: posts the fork run's
  result on the PR as the informational CI (fork) check.
- Node tests of the bridge script and of ci.yml's routing run in
  validate-pr-and-source.
- .github/workflows/README.md gains "Pull requests from forks".
Third part of apache#20471. Fork runs cannot use apache/hudi's Codecov token
and are not linked to the PR, so fork PRs lost the coverage comment
during review.

- New upload-coverage action replaces the 12 Codecov steps: in
  apache/hudi it uploads as before, on a fork it saves
  jacoco-report.xml as an artifact named by commit, job and flag.
- New fork_coverage_bridge.yml polls every 15 minutes: it matches each
  open fork PR's head to the fork's finished CI run, downloads the
  artifacts with its own GITHUB_TOKEN and uploads them to Codecov for
  that PR and commit, then records a Coverage (fork) check so each run
  uploads once.
- Artifacts are untrusted data: names, flags and sizes are validated,
  only the XML is extracted, and no fork code is checked out or run.
  Codecov's path mapping gets the PR head's file list from a tree-only
  fetch of apache/hudi.
- Node tests of the selection and recording scripts run next to the
  fork_ci_status.yml tests.

This branch has not been deployed

No deployments
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