mirror of
https://github.com/thegeeklab/drone-yaml.git
synced 2024-11-22 10:00:39 +00:00
fix workspace issues
This commit is contained in:
parent
b8bb780285
commit
4706608ba0
@ -9,6 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -60,9 +61,6 @@ func Convert(d []byte, remote string) ([]byte, error) {
|
|||||||
pipeline := droneyaml.Pipeline{}
|
pipeline := droneyaml.Pipeline{}
|
||||||
pipeline.Name = "default"
|
pipeline.Name = "default"
|
||||||
pipeline.Kind = "pipeline"
|
pipeline.Kind = "pipeline"
|
||||||
if os.Getenv("DRONE_CONVERT_YAML_LEGACY_TO_KUBERNETES") == "true" {
|
|
||||||
pipeline.Type = "kubernetes"
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline.Workspace.Base = from.Workspace.Base
|
pipeline.Workspace.Base = from.Workspace.Base
|
||||||
pipeline.Workspace.Path = from.Workspace.Path
|
pipeline.Workspace.Path = from.Workspace.Path
|
||||||
@ -79,6 +77,36 @@ func Convert(d []byte, remote string) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("DRONE_CONVERT_YAML_LEGACY_TO_KUBERNETES") == "true" {
|
||||||
|
pipeline.Type = "kubernetes"
|
||||||
|
|
||||||
|
if from.Workspace.Base != "" && from.Workspace.Path != "" {
|
||||||
|
pipeline.Workspace.Base = ""
|
||||||
|
pipeline.Workspace.Path = filepath.Join(
|
||||||
|
from.Workspace.Base,
|
||||||
|
from.Workspace.Path,
|
||||||
|
)
|
||||||
|
} else if from.Workspace.Base != "" {
|
||||||
|
pipeline.Workspace.Base = ""
|
||||||
|
pipeline.Workspace.Path = filepath.Join(
|
||||||
|
from.Workspace.Base,
|
||||||
|
toWorkspacePath(remote),
|
||||||
|
)
|
||||||
|
} else if from.Workspace.Path != "" {
|
||||||
|
pipeline.Workspace.Base = ""
|
||||||
|
pipeline.Workspace.Path = filepath.Join(
|
||||||
|
"/drone",
|
||||||
|
from.Workspace.Path,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
pipeline.Workspace.Base = ""
|
||||||
|
pipeline.Workspace.Path = filepath.Join(
|
||||||
|
"/drone",
|
||||||
|
toWorkspacePath(remote),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(from.Clone.Containers) != 0 {
|
if len(from.Clone.Containers) != 0 {
|
||||||
pipeline.Clone.Disable = true
|
pipeline.Clone.Disable = true
|
||||||
for _, container := range from.Clone.Containers {
|
for _, container := range from.Clone.Containers {
|
||||||
|
Loading…
Reference in New Issue
Block a user