special exit code 78

pull/54/head
Brad Rydzewski 5 years ago
parent 5ed4613f59
commit 8c5fd677e0

@ -10,6 +10,7 @@ steps:
- name: test
image: golang:1.11
commands:
- go vet ./...
- go test -v --cover ./...
...

@ -2,9 +2,9 @@ Copyright 2019 Drone.IO, Inc.
Source code in this repository is variously licensed under the
Apache License Version 2.0, an Apache compatible license, or the
Drone Community License. Source code in a given file is licensed
under the Drone Community License unless otherwise noted at the
beginning of the file.
Drone Non-Commercial License. Source code in a given file is
licensed under the Drone Non-Commercial License unless otherwise
noted at the beginning of the file.
-----------------------------------------------------------------

@ -117,6 +117,12 @@ func (r *Runtime) execGraph(ctx context.Context) error {
return ErrCancel
default:
}
r.mu.Lock()
skip := r.error == ErrInterrupt
r.mu.Unlock()
if skip {
return nil
}
err := r.exec(step)
if err != nil {
r.mu.Lock()
@ -138,6 +144,14 @@ func (r *Runtime) execAll(group []*engine.Step) <-chan error {
var g errgroup.Group
done := make(chan error)
// if a previous step returned error code 78
// the pipeline process skips all subsequent
// pipeline steps.
if r.error == ErrInterrupt {
close(done)
return done
}
for _, step := range group {
step := step
g.Go(func() error {
@ -237,6 +251,8 @@ func (r *Runtime) exec(step *engine.Step) error {
Name: step.Metadata.Name,
Code: wait.ExitCode,
}
} else if wait.ExitCode == 78 {
err = ErrInterrupt
} else if wait.ExitCode != 0 {
err = &ExitError{
Name: step.Metadata.Name,

Loading…
Cancel
Save