From a35147bc63a56ad856d5d01bbf7e446f73217169 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 1 Dec 2020 16:26:01 +0100 Subject: [PATCH] Detect push failure and break Signed-off-by: Nicolas De Loof --- local/compose.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/local/compose.go b/local/compose.go index cf67117d..407d239e 100644 --- a/local/compose.go +++ b/local/compose.go @@ -132,6 +132,9 @@ func (s *composeService) Push(ctx context.Context, project *types.Project) error } return err } + if jm.Error != nil { + return errors.New(jm.Error.Message) + } toProgressEvent(service.Name, jm, w) } return nil @@ -142,13 +145,13 @@ func (s *composeService) Push(ctx context.Context, project *types.Project) error func toProgressEvent(prefix string, jm jsonmessage.JSONMessage, w progress.Writer) { if jm.ID == "" { + // skipped return } var ( text string status = progress.Working ) - if jm.Status == "Pull complete" || jm.Status == "Already exists" { status = progress.Done } @@ -160,7 +163,7 @@ func toProgressEvent(prefix string, jm jsonmessage.JSONMessage, w progress.Write text = jm.Progress.String() } w.Event(progress.Event{ - ID: fmt.Sprintf("%s: %s", prefix, jm.ID), + ID: fmt.Sprintf("Pushing %s: %s", prefix, jm.ID), Text: jm.Status, Status: status, StatusText: text,