You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using cached-privileged-kubernetes mode, actions that require access to $GITHUB_EVENT_PATH (like Docker Buildx) fail because /github/workflow/event.json does not exist.
Error:
ERROR: failed to read GITHUB_EVENT_PATH "/github/workflow/event.json": open /github/workflow/event.json: no such file or directory
Root Cause
The GitHub Actions runner-container-hooks package has a bug where the prepare script (which copies GitHub workspace directories from /__w/_temp/ to /github/) only executes when userMountVolumes are defined.
PR #27 attempted to work around this by adding a dummy user mount volume to trigger the userMountVolumes.length check. However, this approach did not solve the problem - the error still occurs in the latest workflow run.
Proposed Solution: Init Container
Add an init container to the hook extension template that explicitly copies the GitHub workspace directories before the main container starts.
Implementation
In pkg/templates/templates/overlay.yaml, add an init container to the pod spec:
# After defining the main container specinitContainers = [{"name": "prepare-github-workspace","image": "${RUNNER_IMAGE}", # Use the same runner image"command": ["/bin/sh", "-c"],"args": [""" set -e echo "Preparing GitHub workspace directories..."cp -R /__w/_temp/_github_home /github/home 2>/dev/null || echo "No _github_home to copy"cp -R /__w/_temp/_github_workflow /github/workflow 2>/dev/null || echo "No _github_workflow to copy"echo "GitHub workspace preparation complete"""" ],"volumeMounts": [{"name": "work", "mountPath": "/__w"},{"name": "github", "mountPath": "/github"}]}]
Why This Works
Runs before the main container - Init containers execute sequentially before the main container starts
Has access to both volumes - Can read from /__w/_temp/ and write to /github/
Independent of hook logic - Doesn't rely on the buggy conditional prepare script
Explicit and testable - Clear responsibility and easy to verify
Graceful degradation - Uses || true to handle cases where source directories don't exist
Problem
When using
cached-privileged-kubernetesmode, actions that require access to$GITHUB_EVENT_PATH(like Docker Buildx) fail because/github/workflow/event.jsondoes not exist.Error:
Root Cause
The GitHub Actions
runner-container-hookspackage has a bug where the prepare script (which copies GitHub workspace directories from/__w/_temp/to/github/) only executes whenuserMountVolumesare defined.Code location:
packages/k8s/src/hooks/prepare-job.tslines 101-104The prepare script is responsible for:
Without this script running, the
/githubvolume remains empty even though:/githubEmptyDir volume is created by the k8s-novolume hooks/__w/_temp/_github_workflow/directory exists with content/github/workflow/Previous Attempt: Dummy Volume (#27)
PR #27 attempted to work around this by adding a dummy user mount volume to trigger the
userMountVolumes.lengthcheck. However, this approach did not solve the problem - the error still occurs in the latest workflow run.Proposed Solution: Init Container
Add an init container to the hook extension template that explicitly copies the GitHub workspace directories before the main container starts.
Implementation
In
pkg/templates/templates/overlay.yaml, add an init container to the pod spec:Why This Works
/__w/_temp/and write to/github/|| trueto handle cases where source directories don't existBenefits Over Dummy Volume Approach
Testing Plan
/github/workflow/event.json:Implementation Checklist
workandgithubvolumesRelated Issues
Future Work
Once this workaround is implemented and verified:
actions/runner-container-hooks