diff --git a/internal/config/config.go b/internal/config/config.go index 4912e43..e040541 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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) { diff --git a/internal/runconfig/runconfig.go b/internal/runconfig/runconfig.go index 6747285..e948cf7 100644 --- a/internal/runconfig/runconfig.go +++ b/internal/runconfig/runconfig.go @@ -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" )