runservice: set default config task working_dir

Set default task working_dir to ~/project
This commit is contained in:
Simone Gotti 2019-04-16 15:20:45 +02:00
parent 4c30a5af1c
commit ebe34ba1fa
2 changed files with 12 additions and 5 deletions

View File

@ -33,6 +33,8 @@ const (
maxRunNameLength = 100
maxTaskNameLength = 100
maxStepNameLength = 100
defaultWorkingDir = "~/project"
)
type ConfigFormat int
@ -760,7 +762,12 @@ func checkConfig(config *Config) error {
// Set defaults
for _, run := range config.Runs {
for _, task := range run.Tasks {
// Set auth type to default if not specified
// set task default working dir
if task.WorkingDir == "" {
task.WorkingDir = defaultWorkingDir
}
// set auth type to default if not specified
runtime := task.Runtime
if runtime.Auth != nil {
if runtime.Auth.Type == "" {

View File

@ -266,7 +266,7 @@ func TestParseOutput(t *testing.T) {
"ENV01": Value{Type: ValueTypeString, Value: "ENV01"},
"ENVFROMVARIABLE01": Value{Type: ValueTypeFromVariable, Value: "variable01"},
},
WorkingDir: "",
WorkingDir: defaultWorkingDir,
Shell: "",
User: "",
Steps: []interface{}{
@ -374,7 +374,7 @@ func TestParseOutput(t *testing.T) {
},
},
},
WorkingDir: "",
WorkingDir: defaultWorkingDir,
Steps: []interface{}{},
Depends: []*Depend{},
},
@ -389,7 +389,7 @@ func TestParseOutput(t *testing.T) {
},
},
},
WorkingDir: "",
WorkingDir: defaultWorkingDir,
Steps: []interface{}{},
Depends: []*Depend{},
},
@ -404,7 +404,7 @@ func TestParseOutput(t *testing.T) {
},
},
},
WorkingDir: "",
WorkingDir: defaultWorkingDir,
Steps: []interface{}{},
Depends: []*Depend{},
},