ci: restrict Develocity cache writes to trusted events - #37
Conversation
Follow-up to #36, which shipped with cache writes gated only on CI plus a non-empty DEVELOCITY_ACCESS_KEY. A same-repository pull request DOES receive repository secrets, so PR builds on this repo are currently writing entries into the shared cache that main and the merge queue then read. The self-hosted HttpBuildCache that #36 replaced gated on GITHUB_EVENT_NAME and excluded pull_request; that protection was lost in the port. Restore it. Cache population is unaffected — push and merge_group runs still write, and those are the runs whose outputs correspond to code that actually landed. pull_request runs become pull-only and keep the full read benefit. Verified against a CI-shaped environment: CI=true GITHUB_EVENT_NAME=pull_request -> pull-only CI=true GITHUB_EVENT_NAME=push -> writes enabled CI=true GITHUB_EVENT_NAME=merge_group -> writes enabled Local builds are excluded by isCI; fork PRs have no key at all. Signed-off-by: James Rich <james.a.rich@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Develocity configuration now enables remote build-cache writes only for CI ChangesRemote cache push policy
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #36. This repo's
mainis currently letting pull-request buildswrite to the shared Develocity build cache.
The gap
#36 gated cache writes on CI plus a non-empty access key:
A same-repository pull request does receive repository secrets, so
pull_requestruns satisfy both conditions and push entries thatmainand themerge queue then read. Unmerged code can serve build outputs to trusted builds.
The self-hosted
HttpBuildCachethat #36 replaced had this right:The gate was lost in the port to
remote(develocity.buildCache). My fault — itwas caught in review on the sibling PRs, but #36 had already merged.
The fix
Also require
GITHUB_EVENT_NAMEto bepushormerge_group.Cache population is unaffected. Push-to-
mainand merge-queue runs remaintrusted writers, and they are the runs whose outputs correspond to code that
actually landed — which is what the cache should hold.
pull_requestrunsbecome pull-only and keep the full read benefit.
Verification
Org-wide
The same gap was found and fixed in every sibling repo before merge —
meshtastic/gradle-flatpak-sources#28, meshtastic/MQTTastic-Client-KMP#118,
meshtastic/meshtastic-sdk#91, meshtastic/protobufs#1027,
meshtastic/TAKPacket-SDK#124 — and in Meshtastic-Android, which had the original
(meshtastic/Meshtastic-Android#6550). kzstd is the only one where the onboarding
merged first, so it needs this follow-up.
Existing
pull_request-written entries are keyed by their own input hashes andwill age out; no purge is needed unless you'd prefer to clear the cache node.
Summary by CodeRabbit