fix(k8s): always copy GitHub workspace directories regardless of userMountVolumes#300
Conversation
…MountVolumes
**Problem:**
The prepare script that copies GitHub workspace directories (/_github_workflow,
/_github_home) from /__w/_temp/ to /github/ was only created and executed when
userMountVolumes were defined. This caused failures when actions tried to access
$GITHUB_EVENT_PATH=/github/workflow/event.json in environments without user mounts.
**Root Cause:**
The conditional logic at line 102 tied the creation of the prepare script to the
presence of userMountVolumes:
```typescript
if (args.container?.userMountVolumes?.length) {
prepareScript = prepareJobScript(args.container.userMountVolumes || [])
}
```
However, the prepare script ALWAYS needs to run to copy GitHub directories - these
are required for GitHub Actions to function correctly. The user mounts are optional.
**Impact:**
This bug affected:
- Kubernetes mode runners without user-defined mount volumes
- Kubernetes-novolume mode in all configurations
- Actions that access workflow metadata (e.g., Docker Buildx reading event.json)
**Solution:**
- Remove the conditional logic - always create and execute the prepare script
- The prepareJobScript function already handles empty userMountVolumes gracefully
- Separate the concerns: GitHub directory copying (required) vs user mount setup (optional)
**Testing:**
This fix has been validated in production with deskrun's cached-privileged-kubernetes
runners, where actions like Docker Buildx can now successfully access event.json.
Fixes actions#299
Related: rkoster/deskrun#28, rkoster/rubionic-workspace#226
nikola-jokic
left a comment
There was a problem hiding this comment.
We need to conditionali mkdir in prepareJobgScript
|
I tried to run this PR with conditional I suspect the script step is somehow messup with the setup but i'm not sure |
|
Hi, any news on this? Thank you |
|
Hi, Any chance this PR can be merged ? this would really help |
|
@copilot do you think you can apply @nikola-jokic comment? EDIT: Copilot is lazy today |
|
We had this issue and tested this too, but had to open #393 which targets the same problem, but fixes it at step time rather than prepare-job time. While testing we found that always running One other thing to watch: with no #393 instead provisions |
Problem:
The prepare script that copies GitHub workspace directories (/_github_workflow, /_github_home) from /__w/_temp/ to /github/ was only created and executed when userMountVolumes were defined. This caused failures when actions tried to access $GITHUB_EVENT_PATH=/github/workflow/event.json in environments without user mounts.
Root Cause:
The conditional logic at line 102 tied the creation of the prepare script to the presence of userMountVolumes:
However, the prepare script ALWAYS needs to run to copy GitHub directories - these are required for GitHub Actions to function correctly. The user mounts are optional.
Impact:
This bug affected:
Solution:
Testing:
This fix has been validated in production with deskrun's cached-privileged-kubernetes runners, where actions like Docker Buildx can now successfully access event.json.
Fixes #299
Related: rkoster/deskrun#28