Revert "Use existing WorkingDir for clone steps (#5023)" (#5047)

This commit is contained in:
Robert Kaussow
2025-04-02 09:21:26 +02:00
committed by GitHub
parent 807fa4289a
commit b4020072b6
5 changed files with 10 additions and 27 deletions

View File

@@ -96,7 +96,7 @@ func TestCompilerCompile(t *testing.T) {
OnSuccess: true,
Failure: "fail",
Volumes: []string{defaultVolume.Name + ":/woodpecker"},
WorkingDir: "/woodpecker",
WorkingDir: "/woodpecker/src/github.com/octocat/hello-world",
WorkspaceBase: "/woodpecker",
Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"clone"}}},
ExtraHosts: []backend_types.HostAlias{},

View File

@@ -96,7 +96,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, workflow *yaml
detached = true
}
workingDir = c.stepWorkingDir(container, stepType)
workingDir = c.stepWorkingDir(container)
getSecretValue := func(name string) (string, error) {
name = strings.ToLower(name)
@@ -185,7 +185,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, workflow *yaml
}, nil
}
func (c *Compiler) stepWorkingDir(container *yaml_types.Container, stepType backend_types.StepType) string {
func (c *Compiler) stepWorkingDir(container *yaml_types.Container) string {
if path.IsAbs(container.Directory) {
return container.Directory
}
@@ -193,9 +193,6 @@ func (c *Compiler) stepWorkingDir(container *yaml_types.Container, stepType back
if container.IsPlugin() {
base = pluginWorkspaceBase
}
if stepType == backend_types.StepTypeClone {
return base
}
return path.Join(base, c.workspacePath, container.Directory)
}