Skip to content

Commit 867a251

Browse files
committed
e2e,failures: Include links to the failed prow jobs for each test lane in the failure board
Having the failed job links included makes these metrics more actionable as the relevant SIGs can quickly check the failures. Signed-off-by: Brian Carey <[email protected]>
1 parent 54ea103 commit 867a251

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

pkg/sigretests/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type SigRetests struct {
3030
SigStorageSuccess int
3131
SigOperatorSuccess int
3232
FailedJobNames []string
33+
FailedJobURLs []string
3334
SuccessJobNames []string
3435
}
3536

@@ -55,7 +56,7 @@ func filterJobs(node *html.Node) (jobs []job) {
5556
for _, href := range node.FirstChild.Attr {
5657
if strings.Contains(href.Val, "e2e") {
5758
e2eJob.failure = true
58-
e2eJob.buildURL = href.Val
59+
e2eJob.buildURL = fmt.Sprintf("https://prow.ci.kubevirt.io/%s", href.Val)
5960
buildLogUrl := strings.Split(href.Val, "/")
6061
e2eJob.jobName = buildLogUrl[len(buildLogUrl)-2]
6162
e2eJob.buildNumber = buildLogUrl[len(buildLogUrl)-1]
@@ -160,6 +161,7 @@ func getJobsForLatestCommit(org string, repo string, prNumber string) (jobsLastC
160161
func sortJobNamesOnResult(job job, sigRetests SigRetests) (jobCounts SigRetests) {
161162
if job.failure == true {
162163
sigRetests.FailedJobNames = append(sigRetests.FailedJobNames, job.jobName)
164+
sigRetests.FailedJobURLs = append(sigRetests.FailedJobURLs, job.buildURL)
163165
} else {
164166
sigRetests.SuccessJobNames = append(sigRetests.SuccessJobNames, job.jobName)
165167
}

pkg/stats/stats.go

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"math"
66
"slices"
77
"strconv"
8+
"strings"
89
"time"
910

1011
"github.com/kubevirt/ci-health/pkg/chatops"
@@ -256,6 +257,7 @@ func (h *Handler) mergedPRsProcessor(results *types.Results) (*types.Results, er
256257
func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, error) {
257258
currentTime, err := time.Parse(constants.DateFormat, results.EndDate)
258259
var failedJobNames []string
260+
var failedJobURLs []string
259261
var successJobNames []string
260262
if err != nil {
261263
return results, err
@@ -290,6 +292,7 @@ func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, e
290292
})
291293
failedJobNames = slices.Concat(failedJobNames, jobsPerSIG.FailedJobNames)
292294
successJobNames = slices.Concat(successJobNames, jobsPerSIG.SuccessJobNames)
295+
failedJobURLs = slices.Concat(failedJobURLs, jobsPerSIG.FailedJobURLs)
293296
}
294297
sortedFailedJobs := types.SortByMostFailed(countFailedJobs(failedJobNames))
295298
for i, job := range sortedFailedJobs {
@@ -298,6 +301,12 @@ func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, e
298301
sortedFailedJobs[i].SuccesCount++
299302
}
300303
}
304+
for _, failedJobURL := range failedJobURLs {
305+
jobNameInURL := strings.Split(failedJobURL, "/")[len(strings.Split(failedJobURL, "/"))-2]
306+
if job.JobName == jobNameInURL {
307+
sortedFailedJobs[i].FailureURLs = append(sortedFailedJobs[i].FailureURLs, failedJobURL)
308+
}
309+
}
301310
}
302311
dataItem.FailedJobLeaderBoard = sortedFailedJobs
303312
results.Data[constants.SIGRetests] = dataItem

pkg/types/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ type FailedJob struct {
215215
JobName string
216216
FailureCount int
217217
SuccesCount int
218+
FailureURLs []string
218219
}
219220

220221
type FailedJobs []FailedJob
@@ -227,7 +228,7 @@ func SortByMostFailed(countFailedJobs map[string]int) FailedJobs {
227228
fl := make(FailedJobs, len(countFailedJobs))
228229
i := 0
229230
for j, f := range countFailedJobs {
230-
fl[i] = FailedJob{j, f, 0}
231+
fl[i] = FailedJob{j, f, 0, nil}
231232
i++
232233
}
233234
sort.Sort(sort.Reverse(fl))

0 commit comments

Comments
 (0)