Add os hook for interrupt signal while waiting for service to converge.
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
55c7aca3c0
commit
1208438cba
|
@ -5,6 +5,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -454,6 +456,10 @@ func WaitOnService(ctx context.Context, cl *dockerClient.Client, serviceID, appN
|
||||||
errChan := make(chan error, 1)
|
errChan := make(chan error, 1)
|
||||||
pipeReader, pipeWriter := io.Pipe()
|
pipeReader, pipeWriter := io.Pipe()
|
||||||
|
|
||||||
|
sigintChannel := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sigintChannel, os.Interrupt)
|
||||||
|
defer signal.Stop(sigintChannel)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
errChan <- progress.ServiceProgress(ctx, cl, serviceID, pipeWriter)
|
errChan <- progress.ServiceProgress(ctx, cl, serviceID, pipeWriter)
|
||||||
}()
|
}()
|
||||||
|
@ -465,6 +471,26 @@ func WaitOnService(ctx context.Context, cl *dockerClient.Client, serviceID, appN
|
||||||
select {
|
select {
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
return err
|
return err
|
||||||
|
case <-sigintChannel:
|
||||||
|
return fmt.Errorf(fmt.Sprintf(`
|
||||||
|
The wait for %s to converge was interrupted.
|
||||||
|
|
||||||
|
This does not necessarily mean your deployment has stopped, but we aren't
|
||||||
|
monitoring it anymore
|
||||||
|
|
||||||
|
You can track latest deployment status with:
|
||||||
|
|
||||||
|
abra app ps --watch %s
|
||||||
|
|
||||||
|
And inspect the logs with:
|
||||||
|
|
||||||
|
abra app logs %s
|
||||||
|
|
||||||
|
If a service is failing to even start, try to smoke out the error with:
|
||||||
|
|
||||||
|
abra app errors --watch %s
|
||||||
|
|
||||||
|
`, appName, appName, appName, appName))
|
||||||
case <-time.After(timeout):
|
case <-time.After(timeout):
|
||||||
return fmt.Errorf(fmt.Sprintf(`
|
return fmt.Errorf(fmt.Sprintf(`
|
||||||
%s has not converged (%s second timeout reached).
|
%s has not converged (%s second timeout reached).
|
||||||
|
@ -481,7 +507,7 @@ And inspect the logs with:
|
||||||
|
|
||||||
abra app logs %s
|
abra app logs %s
|
||||||
|
|
||||||
If a service is failing to even start, try smoke out the error with:
|
If a service is failing to even start, try to smoke out the error with:
|
||||||
|
|
||||||
abra app errors --watch %s
|
abra app errors --watch %s
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue