Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib/restarter/workflowRestarter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func (wr *WorkflowRestarter) RequestRestart(ctx context.Context, workflowRunId i
// requests and triggers restarts when workflows have completed with failure.
func (wr *WorkflowRestarter) StartPoller(ctx context.Context) {
const pollInterval = 30 * time.Second
const requestTTL = 1 * time.Hour
// Must exceed the longest expected workflow run: a job preempted early in
// a run can only be re-run after the whole run completes.
const requestTTL = 6 * time.Hour

logger := log.WithField("component", "restarterPoller")

Expand Down
8 changes: 5 additions & 3 deletions src/lib/scaleSetPoller/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ func (cs *catteryScaler) HandleJobStarted(ctx context.Context, jobInfo *scaleset

jobID, _ := strconv.ParseInt(jobInfo.JobID, 10, 64)
workflowName := parseWorkflowName(jobInfo.JobWorkflowRef)
repo := fullRepoName(jobInfo.OwnerName, jobInfo.RepositoryName)

tray, err := cs.poller.trayManager.SetJob(ctx, jobInfo.RunnerName, jobID, jobInfo.WorkflowRunID, repo, jobInfo.JobDisplayName, workflowName)
// The tray stores the bare repository name: the restarter passes it to
// GitHub API calls that take the owner separately. Storing the full name
// here broke the restarter (duplicated owner in the API URL).
tray, err := cs.poller.trayManager.SetJob(ctx, jobInfo.RunnerName, jobID, jobInfo.WorkflowRunID, jobInfo.RepositoryName, jobInfo.JobDisplayName, workflowName)
if err != nil {
cs.poller.logger.Errorf("Failed to set job on tray %s: %v", jobInfo.RunnerName, err)
return err
Expand All @@ -186,7 +188,7 @@ func (cs *catteryScaler) HandleJobStarted(ctx context.Context, jobInfo *scaleset
Time: time.Now(),
Kind: MessageKindJobStarted,
TrayType: cs.poller.trayType.Name,
Repository: repo,
Repository: fullRepoName(jobInfo.OwnerName, jobInfo.RepositoryName),
WorkflowRunID: jobInfo.WorkflowRunID,
JobID: jobID,
JobDisplayName: jobInfo.JobDisplayName,
Expand Down
9 changes: 8 additions & 1 deletion src/server/handlers/statusHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"html/template"
"net/http"
"strings"
"time"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -193,7 +194,13 @@ func buildJobURL(repo string, workflowRunID int64) string {
}

func jobURL(t *trays.Tray) string {
return buildJobURL(t.Repository, t.WorkflowRunId)
// The tray stores the bare repository name; trays written by Cattery
// 0.3.0-0.3.2 may still hold the full "owner/repo" one.
repo := t.Repository
if repo != "" && !strings.Contains(repo, "/") {
repo = t.GitHubOrgName + "/" + repo
}
return buildJobURL(repo, t.WorkflowRunId)
}

func messageJobURL(m *scaleSetPoller.Message) string {
Expand Down
Loading