Skip to content

Commit

Permalink
Improve deployer logs
Browse files Browse the repository at this point in the history
  • Loading branch information
wille committed Aug 23, 2024
1 parent 11d67e1 commit e40f1fa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/webhook/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package webhook

import (
"context"
"errors"
"fmt"
"net/http"
"time"
Expand Down Expand Up @@ -108,7 +109,7 @@ func createOrUpdatePullRequest(

attempts := 0
for {
bothDone := true
finished := true

select {
case <-ctx.Done():
Expand Down Expand Up @@ -139,13 +140,14 @@ func createOrUpdatePullRequest(
}

if !done {
bothDone = false
finished = false
log.Info("Deployment in progress: " + status)
}

writeFlush(w, status)
}

if bothDone {
if finished {
break
}

Expand All @@ -156,7 +158,8 @@ func createOrUpdatePullRequest(
if attempts > 600 {
log.Info("Timeout waiting for deployments to be ready")
http.Error(w, "Timeout waiting for deployments to be ready", http.StatusRequestTimeout)
break

return nil, errors.New("Timeout waiting for deployments to be ready")
}

time.Sleep(1 * time.Second)
Expand Down

0 comments on commit e40f1fa

Please sign in to comment.