@@ -345,7 +345,7 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
345345 return deploy , nil
346346 }
347347
348- skipRetry := options .SkipRetry || false
348+ skipRetry := options .SkipRetry
349349
350350 if err := n .uploadFiles (ctx , deploy , options .files , options .Observer , fileUpload , options .UploadTimeout , skipRetry ); err != nil {
351351 return nil , err
@@ -406,6 +406,7 @@ func (n *Netlify) WaitUntilDeployLive(ctx context.Context, d *models.Deploy) (*m
406406
407407func (n * Netlify ) uploadFiles (ctx context.Context , d * models.Deploy , files * deployFiles , observer DeployObserver , t uploadType , timeout time.Duration , skipRetry bool ) error {
408408 sharedErr := & uploadError {err : nil , mutex : & sync.Mutex {}}
409+ permanentErr := & backoff.PermanentError {Err : nil }
409410 sem := make (chan int , n .uploadLimit )
410411 wg := & sync.WaitGroup {}
411412
@@ -434,7 +435,7 @@ func (n *Netlify) uploadFiles(ctx context.Context, d *models.Deploy, files *depl
434435 select {
435436 case sem <- 1 :
436437 wg .Add (1 )
437- go n .uploadFile (ctx , d , file , observer , t , timeout , wg , sem , sharedErr , skipRetry )
438+ go n .uploadFile (ctx , d , file , observer , t , timeout , wg , sem , sharedErr , permanentErr , skipRetry )
438439 case <- ctx .Done ():
439440 log .Info ("Context terminated, aborting file upload" )
440441 return errors .Wrap (ctx .Err (), "aborted file upload early" )
@@ -454,7 +455,7 @@ func (n *Netlify) uploadFiles(ctx context.Context, d *models.Deploy, files *depl
454455 return sharedErr .err
455456}
456457
457- func (n * Netlify ) uploadFile (ctx context.Context , d * models.Deploy , f * FileBundle , c DeployObserver , t uploadType , timeout time.Duration , wg * sync.WaitGroup , sem chan int , sharedErr * uploadError , skipRetry bool ) {
458+ func (n * Netlify ) uploadFile (ctx context.Context , d * models.Deploy , f * FileBundle , c DeployObserver , t uploadType , timeout time.Duration , wg * sync.WaitGroup , sem chan int , sharedErr * uploadError , permanentErr * backoff. PermanentError , skipRetry bool ) {
458459 defer func () {
459460 wg .Done ()
460461 <- sem
@@ -549,10 +550,7 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
549550 }
550551
551552 if skipRetry && (apiErr .Code () == 400 || apiErr .Code () == 422 ) {
552- sharedErr .mutex .Lock ()
553- sharedErr .err = operationError
554- sharedErr .mutex .Unlock ()
555- return nil
553+ operationError = permanentErr
556554 }
557555 }
558556 }
0 commit comments