Respect directory option for steps again (#4319)

This commit is contained in:
6543
2024-11-06 23:21:56 +01:00
committed by GitHub
parent c9752bb735
commit bf5405b6cc
10 changed files with 96 additions and 61 deletions

View File

@@ -183,7 +183,7 @@ func podContainer(step *types.Step, podName, goos string, options BackendOptions
container := v1.Container{
Name: podName,
Image: step.Image,
WorkingDir: step.WorkspaceBase,
WorkingDir: step.WorkingDir,
Ports: containerPorts(step.Ports),
SecurityContext: containerSecurityContext(options.SecurityContext, step.Privileged),
}
@@ -193,9 +193,12 @@ func podContainer(step *types.Step, podName, goos string, options BackendOptions
}
if len(step.Commands) > 0 {
scriptEnv, command := common.GenerateContainerConf(step.Commands, goos)
scriptEnv, command := common.GenerateContainerConf(step.Commands, goos, step.WorkingDir)
container.Command = command
maps.Copy(step.Environment, scriptEnv)
// step.WorkingDir will be respected by the generated script
container.WorkingDir = step.WorkspaceBase
}
if len(step.Entrypoint) > 0 {
container.Command = step.Entrypoint