mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
33 lines
572 B
Go
33 lines
572 B
Go
package transform
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/drone/drone/yaml"
|
|
)
|
|
|
|
// WorkspaceTransform transforms ...
|
|
func WorkspaceTransform(c *yaml.Config, base, path string) error {
|
|
if c.Workspace == nil {
|
|
c.Workspace = &yaml.Workspace{}
|
|
}
|
|
|
|
if c.Workspace.Base == "" {
|
|
c.Workspace.Base = base
|
|
}
|
|
if c.Workspace.Path == "" {
|
|
c.Workspace.Path = path
|
|
}
|
|
if !filepath.IsAbs(c.Workspace.Path) {
|
|
c.Workspace.Path = filepath.Join(
|
|
c.Workspace.Base,
|
|
c.Workspace.Path,
|
|
)
|
|
}
|
|
|
|
for _, p := range c.Pipeline {
|
|
p.WorkingDir = c.Workspace.Path
|
|
}
|
|
return nil
|
|
}
|