Skip to content

Commit 5f23577

Browse files
committed
fix: mount correct workspace path for container actions
1 parent 2c8d808 commit 5f23577

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/k8s/pod.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log/slog"
1010
"os"
1111
"path/filepath"
12+
"strings"
1213
"time"
1314

1415
"github.com/reMarkable/k8s-hook/pkg/types"
@@ -208,12 +209,17 @@ func (c *K8sClient) preparePodSpec(cont types.ContainerDefinition, podType PodTy
208209
}
209210
var name string
210211
if podType == PodTypeContainerStep {
212+
workspace := os.Getenv("GITHUB_WORKSPACE")
213+
// remove anything before _work to get the subpath
214+
i := strings.LastIndex(workspace, "_work/")
215+
workspaceRelativePath := workspace[i+len("_work/"):]
216+
211217
name = c.GetRunnerPodName() + "-step-" + podPostfix()
212218
jobContainer.VolumeMounts = append([]v1.VolumeMount{
213219
{
214220
Name: JobVolumeName,
215221
MountPath: "/github/workspace",
216-
SubPath: "_temp",
222+
SubPath: workspaceRelativePath,
217223
},
218224
{
219225
Name: JobVolumeName,

0 commit comments

Comments
 (0)