fix: step container workdir and mounts (#93)

* fix: step container workdir and mounts
* avoid perm issues and do not mount tool_cache
This commit is contained in:
ChristopherHX
2025-04-26 14:14:52 +02:00
committed by GitHub
parent eddc77f3e0
commit a3c8116dee
8 changed files with 77 additions and 2 deletions

View File

@@ -382,13 +382,18 @@ func newStepContainer(ctx context.Context, step step, image string, cmd []string
binds, mounts := rc.GetBindsAndMounts()
networkMode := fmt.Sprintf("container:%s", rc.jobContainerName())
var workdir string
if rc.IsHostEnv(ctx) {
networkMode = "default"
ext := container.LinuxContainerEnvironmentExtensions{}
workdir = ext.ToContainerPath(rc.Config.Workdir)
} else {
workdir = rc.JobContainer.ToContainerPath(rc.Config.Workdir)
}
stepContainer := container.NewContainer(&container.NewContainerInput{
Cmd: cmd,
Entrypoint: entrypoint,
WorkingDir: rc.JobContainer.ToContainerPath(rc.Config.Workdir),
WorkingDir: workdir,
Image: image,
Username: rc.Config.Secrets["DOCKER_USERNAME"],
Password: rc.Config.Secrets["DOCKER_PASSWORD"],