Skip to content

Commit c0803a4

Browse files
author
Test User
committed
fix: remove duplicate cache volumes from hook extension patch
The hook extension was redefining cache volumes that are already in the runner template. When ARC merges the hook extension with the pod spec, duplicate volume definitions cause Kubernetes validation to fail. Cache volumes are already defined in the runner template and will be merged automatically, so we only need to mount them in the job container. We only define the system volumes (sys, cgroup, proc, dev, dev-pts, shm) that are specifically needed for the privileged job container.
1 parent 98e3a1c commit c0803a4

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

internal/runner/runner.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,17 @@ data:
588588
- name: shm
589589
mountPath: /dev/shm`
590590

591-
// Add cache path volume mounts
591+
// Add cache path volume mounts to job container
592+
// Note: These volumes are already defined in the runner template, so we just mount them here
592593
if len(installation.CachePaths) > 0 {
593594
for i := range installation.CachePaths {
594595
hookExtension += fmt.Sprintf("\n - name: cache-%d\n mountPath: %s",
595596
i, installation.CachePaths[i].MountPath)
596597
}
597598
}
598599

599-
// Add volume definitions (only for host path mounts, not work which is already in runner template)
600+
// Add volume definitions (only for system mounts needed by job container, NOT cache volumes)
601+
// Cache volumes are already defined in the runner template and will be merged automatically
600602
hookExtension += `
601603
volumes:
602604
- name: sys
@@ -624,22 +626,8 @@ data:
624626
path: /dev/shm
625627
type: Directory`
626628

627-
// Add cache path volumes
628-
if len(installation.CachePaths) > 0 {
629-
for i, path := range installation.CachePaths {
630-
hostPath := path.HostPath
631-
if hostPath == "" {
632-
// Generate instance-specific cache path for multi-instance setups
633-
if instanceNum > 0 {
634-
hostPath = fmt.Sprintf("/tmp/github-runner-cache/%s-%d/cache-%d", installation.Name, instanceNum, i)
635-
} else {
636-
hostPath = fmt.Sprintf("/tmp/github-runner-cache/%s/cache-%d", installation.Name, i)
637-
}
638-
}
639-
hookExtension += fmt.Sprintf("\n - name: cache-%d\n hostPath:\n path: %s\n type: DirectoryOrCreate",
640-
i, hostPath)
641-
}
642-
}
629+
// NOTE: We do NOT include cache volumes here as they are already defined in the runner template
630+
// and will be merged with this patch by ARC. Including them would cause validation errors.
643631

644632
return hookExtension
645633
}

0 commit comments

Comments
 (0)