fix: stage apko cache as a tree artifact (follow-up to #294)#302
Merged
xnox merged 1 commit intoApr 27, 2026
Merged
Conversation
…#294) After some more testing we noticed that the per-file cp staging introduced in chainguard-dev#294 - which replaced ctx.actions.symlink to fix Bazel 9 sandbox issues - regresses on remote execution. apko's cache is URL-keyed, so when a cached resource's URL ends in its own filename - typical for keyrings, e.g. https://packages.wolfi.dev/os/wolfi-signing.rsa.pub the cache key equals the filename and the entry lands at: .../wolfi-signing.rsa.pub/wolfi-signing.rsa.pub Some remote-execution backends reject declared output paths whose basename equals their parent directory name as REv2 validation failures, so cache staging fails on RBE even though the cp command itself succeeds. Declare the whole cache as a single tree artifact (via ctx.actions.declare_directory) and populate it in one ctx.actions.run_shell. apko sees the identical files at the identical relative paths, but the problematic paths are now contents of the tree artifact rather than individually declared outputs, so per-output validation no longer sees them. copy_to_workdir grows a list-of-Files branch for this; the lockfile, config, and apko binary continue through the existing single-file and directory paths unchanged.
tiborv
force-pushed
the
fix/bb-rbe-output-validation-setup-script
branch
from
April 27, 2026 20:47
f3404d6 to
34ed4c6
Compare
xnox
reviewed
Apr 27, 2026
xnox
left a comment
Member
There was a problem hiding this comment.
Ack! thank you!
note I only use apko locally, or via terraform provider apko, and never with remote executors.
It would be interesting how to setup remote executors in github actiona for testing. Do I need to sign up for some service, or can this be mocked with docker or some such?
as ideally all the issues you are seeing should be tested in our CI.
xnox
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After some more testing we noticed that the per-file cp staging introduced in #294 - which replaced ctx.actions.symlink to fix Bazel 9 sandbox issues - regresses on remote execution.
apko's cache is URL-keyed, so when a cached resource's URL ends in its own filename - typical for keyrings, e.g.
the cache key equals the filename and the entry lands at:
Some remote-execution backends reject declared output paths whose basename equals their parent directory name as REv2 validation failures, so cache staging fails on RBE even though the cp command itself succeeds.
Declare the whole cache as a single tree artifact (via ctx.actions.declare_directory) and populate it in one ctx.actions.run_shell. apko sees the identical files at the identical relative paths, but the problematic paths are now contents of the tree artifact rather than individually declared outputs, so per-output validation no longer sees them.
copy_to_workdir grows a list-of-Files branch for this; the lockfile, config, and apko binary continue through the existing single-file and directory paths unchanged.