Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e,failures: Include links to the failed prow jobs for each test lane in the failure board #68

Merged
merged 3 commits into from
Sep 19, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
run: |
echo -n $GITHUB_TOKEN > $(pwd)/token

bazelisk test ... --action_env GITHUB_TOKEN_PATH=$(pwd)/token
bazelisk test ... --action_env GITHUB_TOKEN_PATH=$(pwd)/token --test_timeout=600
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Top failed lanes:

![failedjob10](https://kubevirt.io/ci-health/output/kubevirt/kubevirt/failedjob10.svg)

The links to each of these failed jobs can be found in the [latest execution data](https://kubevirt.io/ci-health/output/kubevirt/kubevirt/results.json)
under the SIGRetests section

## Historical data evolution

These plots will be updated every week.
Expand Down
4 changes: 3 additions & 1 deletion pkg/sigretests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type SigRetests struct {
SigStorageSuccess int
SigOperatorSuccess int
FailedJobNames []string
FailedJobURLs []string
SuccessJobNames []string
}

Expand All @@ -55,7 +56,7 @@ func filterJobs(node *html.Node) (jobs []job) {
for _, href := range node.FirstChild.Attr {
if strings.Contains(href.Val, "e2e") {
e2eJob.failure = true
e2eJob.buildURL = href.Val
e2eJob.buildURL = fmt.Sprintf("https://prow.ci.kubevirt.io/%s", href.Val)
buildLogUrl := strings.Split(href.Val, "/")
e2eJob.jobName = buildLogUrl[len(buildLogUrl)-2]
e2eJob.buildNumber = buildLogUrl[len(buildLogUrl)-1]
Expand Down Expand Up @@ -160,6 +161,7 @@ func getJobsForLatestCommit(org string, repo string, prNumber string) (jobsLastC
func sortJobNamesOnResult(job job, sigRetests SigRetests) (jobCounts SigRetests) {
if job.failure == true {
sigRetests.FailedJobNames = append(sigRetests.FailedJobNames, job.jobName)
sigRetests.FailedJobURLs = append(sigRetests.FailedJobURLs, job.buildURL)
} else {
sigRetests.SuccessJobNames = append(sigRetests.SuccessJobNames, job.jobName)
}
Expand Down
9 changes: 9 additions & 0 deletions pkg/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math"
"slices"
"strconv"
"strings"
"time"

"github.com/kubevirt/ci-health/pkg/chatops"
Expand Down Expand Up @@ -256,6 +257,7 @@ func (h *Handler) mergedPRsProcessor(results *types.Results) (*types.Results, er
func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, error) {
currentTime, err := time.Parse(constants.DateFormat, results.EndDate)
var failedJobNames []string
var failedJobURLs []string
var successJobNames []string
if err != nil {
return results, err
Expand Down Expand Up @@ -290,6 +292,7 @@ func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, e
})
failedJobNames = slices.Concat(failedJobNames, jobsPerSIG.FailedJobNames)
successJobNames = slices.Concat(successJobNames, jobsPerSIG.SuccessJobNames)
failedJobURLs = slices.Concat(failedJobURLs, jobsPerSIG.FailedJobURLs)
}
sortedFailedJobs := types.SortByMostFailed(countFailedJobs(failedJobNames))
for i, job := range sortedFailedJobs {
Expand All @@ -298,6 +301,12 @@ func (h *Handler) sigRetestsProcessor(results *types.Results) (*types.Results, e
sortedFailedJobs[i].SuccesCount++
}
}
for _, failedJobURL := range failedJobURLs {
jobNameInURL := strings.Split(failedJobURL, "/")[len(strings.Split(failedJobURL, "/"))-2]
if job.JobName == jobNameInURL {
sortedFailedJobs[i].FailureURLs = append(sortedFailedJobs[i].FailureURLs, failedJobURL)
}
}
}
dataItem.FailedJobLeaderBoard = sortedFailedJobs
results.Data[constants.SIGRetests] = dataItem
Expand Down
3 changes: 2 additions & 1 deletion pkg/types/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ type FailedJob struct {
JobName string
FailureCount int
SuccesCount int
FailureURLs []string
}

type FailedJobs []FailedJob
Expand All @@ -227,7 +228,7 @@ func SortByMostFailed(countFailedJobs map[string]int) FailedJobs {
fl := make(FailedJobs, len(countFailedJobs))
i := 0
for j, f := range countFailedJobs {
fl[i] = FailedJob{j, f, 0}
fl[i] = FailedJob{j, f, 0, nil}
i++
}
sort.Sort(sort.Reverse(fl))
Expand Down
Loading