config: make runtime type pod the default
In this way users are not forced to always set it in the config file.
This commit is contained in:
parent
c0a165de31
commit
7658c44694
|
@ -685,8 +685,10 @@ func checkConfig(config *Config) error {
|
|||
}
|
||||
|
||||
r := task.Runtime
|
||||
if r.Type != RuntimeTypePod {
|
||||
return errors.Errorf("task %q runtime: wrong type %q", task.Name, r.Type)
|
||||
if r.Type != "" {
|
||||
if r.Type != RuntimeTypePod {
|
||||
return errors.Errorf("task %q runtime: wrong type %q", task.Name, r.Type)
|
||||
}
|
||||
}
|
||||
if len(r.Containers) == 0 {
|
||||
return errors.Errorf("task %q runtime: at least one container must be defined", task.Name)
|
||||
|
@ -801,6 +803,12 @@ func checkConfig(config *Config) error {
|
|||
task.WorkingDir = defaultWorkingDir
|
||||
}
|
||||
|
||||
// set task runtime type to pod if empty
|
||||
r := task.Runtime
|
||||
if r.Type == "" {
|
||||
r.Type = RuntimeTypePod
|
||||
}
|
||||
|
||||
// set steps defaults
|
||||
for i, s := range task.Steps {
|
||||
switch step := s.(type) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
rstypes "github.com/sorintlab/agola/internal/services/runservice/types"
|
||||
"github.com/sorintlab/agola/internal/services/types"
|
||||
"github.com/sorintlab/agola/internal/util"
|
||||
|
||||
errors "golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue