support for fast failure
This commit is contained in:
@@ -28,7 +28,6 @@ func createStep(spec *resource.Pipeline, src *resource.Step) *engine.Step {
|
||||
DNSSearch: src.DNSSearch,
|
||||
Envs: convertStaticEnv(src.Environment),
|
||||
ExtraHosts: src.ExtraHosts,
|
||||
IgnoreErr: strings.EqualFold(src.Failure, "ignore"),
|
||||
IgnoreStderr: false,
|
||||
IgnoreStdout: false,
|
||||
Network: src.Network,
|
||||
@@ -101,5 +100,14 @@ func createStep(spec *resource.Pipeline, src *resource.Step) *engine.Step {
|
||||
dst.RunPolicy = runtime.RunOnFailure
|
||||
}
|
||||
|
||||
// set the pipeline failure policy. steps can choose
|
||||
// to ignore the failure, or fail fast.
|
||||
switch src.Failure {
|
||||
case "ignore":
|
||||
dst.ErrPolicy = runtime.ErrIgnore
|
||||
case "fast", "fast-fail", "fail-fast":
|
||||
dst.ErrPolicy = runtime.ErrFailFast
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ type (
|
||||
DNSSearch []string `json:"dns_search,omitempty"`
|
||||
Entrypoint []string `json:"entrypoint,omitempty"`
|
||||
Envs map[string]string `json:"environment,omitempty"`
|
||||
ErrPolicy runtime.ErrPolicy `json:"err_policy,omitempty"`
|
||||
ExtraHosts []string `json:"extra_hosts,omitempty"`
|
||||
IgnoreErr bool `json:"ignore_err,omitempty"`
|
||||
IgnoreStdout bool `json:"ignore_stderr,omitempty"`
|
||||
IgnoreStderr bool `json:"ignore_stdout,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
@@ -151,7 +151,7 @@ func (s *Step) GetName() string { return s.Name }
|
||||
func (s *Step) GetDependencies() []string { return s.DependsOn }
|
||||
func (s *Step) GetEnviron() map[string]string { return s.Envs }
|
||||
func (s *Step) SetEnviron(env map[string]string) { s.Envs = env }
|
||||
func (s *Step) GetErrPolicy() runtime.ErrPolicy { return runtime.ErrFail }
|
||||
func (s *Step) GetErrPolicy() runtime.ErrPolicy { return s.ErrPolicy }
|
||||
func (s *Step) GetRunPolicy() runtime.RunPolicy { return s.RunPolicy }
|
||||
func (s *Step) GetSecretAt(i int) runtime.Secret { return s.Secrets[i] }
|
||||
func (s *Step) GetSecretLen() int { return len(s.Secrets) }
|
||||
|
||||
Reference in New Issue
Block a user