@@ -345,7 +345,7 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
345
345
return deploy , nil
346
346
}
347
347
348
- skipRetry := options .SkipRetry || false
348
+ skipRetry := options .SkipRetry
349
349
350
350
if err := n .uploadFiles (ctx , deploy , options .files , options .Observer , fileUpload , options .UploadTimeout , skipRetry ); err != nil {
351
351
return nil , err
@@ -406,6 +406,7 @@ func (n *Netlify) WaitUntilDeployLive(ctx context.Context, d *models.Deploy) (*m
406
406
407
407
func (n * Netlify ) uploadFiles (ctx context.Context , d * models.Deploy , files * deployFiles , observer DeployObserver , t uploadType , timeout time.Duration , skipRetry bool ) error {
408
408
sharedErr := & uploadError {err : nil , mutex : & sync.Mutex {}}
409
+ permanentErr := & backoff.PermanentError {Err : nil }
409
410
sem := make (chan int , n .uploadLimit )
410
411
wg := & sync.WaitGroup {}
411
412
@@ -434,7 +435,7 @@ func (n *Netlify) uploadFiles(ctx context.Context, d *models.Deploy, files *depl
434
435
select {
435
436
case sem <- 1 :
436
437
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 )
438
439
case <- ctx .Done ():
439
440
log .Info ("Context terminated, aborting file upload" )
440
441
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
454
455
return sharedErr .err
455
456
}
456
457
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 ) {
458
459
defer func () {
459
460
wg .Done ()
460
461
<- sem
@@ -549,10 +550,7 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
549
550
}
550
551
551
552
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
556
554
}
557
555
}
558
556
}
0 commit comments