Skip to content

ci: reuse builds only from this repository's own runs - #165

Merged
chriskearney merged 1 commit into
integration/aurorafrom
ci/trusted-reuse
Oct 20, 2026
Merged

chriskearney merged 1 commit into
integration/aurorafrom
ci/trusted-reuse

Conversation

@chriskearney

Copy link
Copy Markdown
Collaborator

Closes the gap @maralcbr found in #160's build reuse before CI becomes a merge gate.

lookup-build.py reused the newest artifact with a matching name from any run in the repository. Artifact names are chosen by the workflow that uploads them, and a fork's pull request runs its own copy of the workflow files; the build key leaves .github and tools/aurora-ci out. So a fork PR that changed only CI files could upload a kernel-package-<key> and kernel-verified-<key> under the current tree's key. The next push or merge queue run with that tree would then reuse the planted package, skip KUnit and boot, and attest it. The comparison baseline (kernel-metadata-<id>) had the same hole.

Now an artifact is reused only when its run is:

  • the kernel CI (kernel-ci.yml or kernel-ci-label.yml),
  • on a push, merge_group, schedule, workflow_dispatch or pull_request event,
  • with both the run's repository and its head repository being this one.

Pushing a branch here needs write access, so a fork's run never qualifies. The check uses the artifact's workflow_run.head_repository_id, then confirms against the run itself.

Tested

  • 3 new unit tests (109 in total):
    • a newer fork artifact under the same name is skipped, and its run isn't even fetched;
    • a run that claims this repository but is a fork head, another workflow, or pull_request_target is rejected;
    • every trusted event and the label workflow are accepted.
  • Against omacom's real artifacts (read-only): the package, verification and baseline from ci: build, test and boot the kernel in GitHub Actions #160's labelled run on its own branch are still found.

🤖 Generated with Claude Code

lookup-build.py took the newest artifact with a matching name from any run
in the repository. Artifact names are chosen by the workflow that uploads
them, and a pull request from a fork runs its own copy of the workflow
files; the build key leaves .github and tools/aurora-ci out. So a fork pull
request that changes only CI files could upload a kernel-package-<key> and
a kernel-verified-<key> under the key of the current tree, and the next
push or merge queue run with that tree would reuse the package, skip KUnit
and the boot test, and attest it. The same applies to the baseline a later
pull request is compared with.

Accept an artifact only when its run is the kernel CI (kernel-ci.yml or
kernel-ci-label.yml), on a push, merge group, schedule, manual run or pull
request event, and both the run's repository and its head repository are
this one. Pushing a branch here needs write access, so a fork's run never
qualifies.

Reported-by: Marcelo Alcantara <[email protected]>
Signed-off-by: Chris Kearney <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chriskearney
chriskearney merged commit 24840d4 into integration/aurora Oct 20, 2026
12 checks passed
chriskearney added a commit that referenced this pull request Oct 21, 2026
…hecks

Two follow-ups from running the CI on the Namespace runner.

Reuse (follow-up to #165): a reused kernel-package or kernel-verified
artifact is now accepted only from a push, merge_group, schedule or
workflow_dispatch run (REUSE_EVENTS), never a pull_request. A CI-only pull
request from a writer has the same build key as the branch tip and could
otherwise plant a package or verification record that a later queue or push
run reuses before anyone reviews it. A comparison baseline (kernel-metadata)
is only read, never substituted, so a pull_request run is still fine there
(BASELINE_EVENTS).

Package checks: inspect-package.py resolves module symbols with depmod and
unpacks with tar --zstd, which the Namespace builder image does not ship.
Install kmod and zstd in the package job when they are missing.

Signed-off-by: Chris Kearney <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
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