Fix: Add dummy volume to force k8s-novolume hook prepare script execution#27
Open
Fix: Add dummy volume to force k8s-novolume hook prepare script execution#27
Conversation
…tion Add a dummy EmptyDir volume mount to the cached-privileged-kubernetes container mode to work around a bug in GitHub's runner-container-hooks that prevents /github/workflow/event.json from being populated. The bug is in the k8s-novolume hook's prepare-job.ts where the prepare script (which copies /github/workflow and /github/home content) only gets created and executed if there are userMountVolumes. Without any user volumes, the prepare script is never run, leaving /github/workflow empty and causing Docker Buildx and other actions to fail. This workaround adds a dummy volume mount at /tmp/dummy-prepare to trigger the conditional logic that creates the prepare script. The prepare script itself handles the case where userMountVolumes exist and performs the necessary GitHub workspace directory copies as a side effect. Fixes #26
7 tasks
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.
Summary
Add a dummy EmptyDir volume mount to the
cached-privileged-kubernetescontainer mode to work around a bug in GitHub'srunner-container-hooksthat prevents/github/workflow/event.jsonfrom being populated.Fixes #26
Problem
When using
cached-privileged-kubernetesmode, the "Set up Docker Buildx" action fails because/github/workflow/event.jsondoes not exist. This file is required by Docker Buildx to read the$GITHUB_EVENT_PATHenvironment variable.Root Cause
The bug is in GitHub's
runner-container-hookspackage atpackages/k8s/src/hooks/prepare-job.ts:The prepare script (which copies
/github/workflowand/github/homecontent) only gets created and executed if there areuserMountVolumes. Without any user volumes, the prepare script is never run, leaving/github/workflowempty.Solution
This PR adds a dummy volume mount at
/tmp/dummy-prepareto trigger the conditional logic that creates the prepare script. The prepare script itself copies the GitHub workspace directories as a side effect.Changes
/pkg/templates/templates/overlay.yamlAdded dummy volume mount (after line 77):
Added dummy volume (after line 110):
Testing
dindorkubernetesmodesScope
cached-privileged-kubernetesonlydindandkubernetesare unaffectedFuture Work
actions/runner-container-hooksrepository