diff --git a/pkg/api/storage/storage.go b/pkg/api/storage/storage.go index a2a8937c..2717da1d 100644 --- a/pkg/api/storage/storage.go +++ b/pkg/api/storage/storage.go @@ -105,9 +105,17 @@ func (c *Client) Upload(ctx context.Context, fileOps *contracts.FileOps, conf *c req := c.apiClient.StorageAPI.StorageApiBucketsObjectsCreate(ctx, conf.Bucket, file).Body(fileOps.FileContent).ContentType(fileOps.MimeType) _, httpResp, err := req.Execute() if err != nil { - logger.Debug("Error while uploading file <"+fileOps.Path+"> to storage api", zap.Error(err)) + if httpResp != nil { + logger.Debug("Error while uploading file <"+fileOps.Path+"> to storage api", zap.Error(err)) + err := utils.LogAndRewindBody(httpResp) + if err != nil { + return err + } + return utils.ErrorPerStatusCode(httpResp, err) + } return utils.ErrorPerStatusCode(httpResp, err) } + return nil } diff --git a/pkg/cmd/deploy/worker.go b/pkg/cmd/deploy/worker.go index 67cfd7f1..a97747c7 100644 --- a/pkg/cmd/deploy/worker.go +++ b/pkg/cmd/deploy/worker.go @@ -38,14 +38,14 @@ func worker(jobs <-chan contracts.FileOps, results chan<- error, currentFile *in if err != nil { continue } - results <- nil - atomic.AddInt64(currentFile, 1) - return + break } - logger.Debug("There have been 5 retries already, quitting upload") - results <- err - return + if Retries >= 5 { + logger.Debug("There have been 5 retries already, quitting upload") + results <- err + return + } } atomic.AddInt64(currentFile, 1)