diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go index 994da63dd..9ee729075 100644 --- a/pipeline/frontend/yaml/compiler/convert.go +++ b/pipeline/frontend/yaml/compiler/convert.go @@ -18,7 +18,6 @@ import ( "fmt" "maps" "path" - "path/filepath" "strings" "github.com/google/uuid" @@ -212,8 +211,8 @@ func (c *Compiler) createProcess(name string, container *yaml_types.Container, s } func (c *Compiler) stepWorkdir(container *yaml_types.Container) string { - if filepath.IsAbs(container.Directory) { + if path.IsAbs(container.Directory) { return container.Directory } - return filepath.Join(c.base, c.path, container.Directory) + return path.Join(c.base, c.path, container.Directory) } diff --git a/pipeline/frontend/yaml/compiler/option.go b/pipeline/frontend/yaml/compiler/option.go index d451ef6b4..bd8355358 100644 --- a/pipeline/frontend/yaml/compiler/option.go +++ b/pipeline/frontend/yaml/compiler/option.go @@ -16,7 +16,7 @@ package compiler import ( "net/url" - "path/filepath" + "path" "strings" "github.com/woodpecker-ci/woodpecker/pipeline/frontend/metadata" @@ -105,12 +105,12 @@ func WithWorkspace(base, path string) Option { // WithWorkspaceFromURL configures the compiler with the workspace // base and path based on the repository url. func WithWorkspaceFromURL(base, link string) Option { - path := "src" + srcPath := "src" parsed, err := url.Parse(link) if err == nil { - path = filepath.Join(path, parsed.Hostname(), parsed.Path) + srcPath = path.Join(srcPath, parsed.Hostname(), parsed.Path) } - return WithWorkspace(base, path) + return WithWorkspace(base, srcPath) } // WithEscalated configures the compiler to automatically execute