@@ -311,7 +311,7 @@ func (n *Netlify) waitForState(ctx context.Context, d *models.Deploy, timeout ti
311
311
context .GetLogger (ctx ).WithFields (logrus.Fields {
312
312
"deploy_id" : d .ID ,
313
313
"state" : resp .Payload .State ,
314
- }).Debug ("Waiting until deploy ready" )
314
+ }).Debugf ("Waiting until deploy state in %s" , states )
315
315
316
316
for _ , state := range states {
317
317
if resp .Payload .State == state {
@@ -331,6 +331,7 @@ func (n *Netlify) waitForState(ctx context.Context, d *models.Deploy, timeout ti
331
331
return d , nil
332
332
}
333
333
334
+ // WaitUntilDeployReady blocks until the deploy is in the "prepared" or "ready" state.
334
335
func (n * Netlify ) WaitUntilDeployReady (ctx context.Context , d * models.Deploy , timeout time.Duration ) (* models.Deploy , error ) {
335
336
if timeout <= 0 {
336
337
timeout = preProcessingTimeout
@@ -339,6 +340,15 @@ func (n *Netlify) WaitUntilDeployReady(ctx context.Context, d *models.Deploy, ti
339
340
return n .waitForState (ctx , d , timeout , "prepared" , "ready" )
340
341
}
341
342
343
+ // WaitUntilDeployLive blocks until the deploy is in the or "ready" state. At this point, the deploy is ready to recieve traffic.
344
+ func (n * Netlify ) WaitUntilDeployLive (ctx context.Context , d * models.Deploy , timeout time.Duration ) (* models.Deploy , error ) {
345
+ if timeout <= 0 {
346
+ timeout = preProcessingTimeout
347
+ }
348
+
349
+ return n .waitForState (ctx , d , timeout , "ready" )
350
+ }
351
+
342
352
func (n * Netlify ) uploadFiles (ctx context.Context , d * models.Deploy , files * deployFiles , observer DeployObserver , t uploadType , timeout time.Duration ) error {
343
353
sharedErr := & uploadError {err : nil , mutex : & sync.Mutex {}}
344
354
sem := make (chan int , n .uploadLimit )
0 commit comments