Documentation ¶
Index ¶
- func CheckGHIssuesFailures(issueJenkinsURLFails map[int]GHIssue, testFailure Test, ...) (int, float64)
- func GHIssueComment(prNumber int, similarity float64, failure BuildFailure) (string, string, error)
- func GHIssueDescription(failure BuildFailure) (string, string, error)
- func IsJenkinsFailure(state, description string) bool
- func IsSimilarFlake(test1, test2 Test, flakeSimilarity float64) float64
- func PRCommentFailure(failure BuildFailure) (string, error)
- func PRCommentKnownFlakes(jobName string, issues map[int][]string) (string, error)
- func PRCommentNewGHIssues(issues []int) (string, error)
- func PRCommentUnknownFlakes(jobName string, failures []BuildFailure, issues map[int][]string) (string, error)
- func SplitJobNameNumber(link string) (string, int64)
- type BuildFailure
- type FlakeConfig
- type GHIssue
- type JenkinsClient
- func (jc *JenkinsClient) GetJobFailure(ctx context.Context, jobName string, buildNumber int64) (int, []BuildFailure, error)
- func (jc *JenkinsClient) GetJobFrom(ctx context.Context, jobName string, ...) (JenkinsFailures, error)
- func (jc *JenkinsClient) GetTestResults(ctx context.Context, jobName string) (JenkinsFailures, error)
- type JenkinsFailures
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckGHIssuesFailures ¶
func CheckGHIssuesFailures(issueJenkinsURLFails map[int]GHIssue, testFailure Test, flakeSimilarity float64) (int, float64)
CheckGHIssuesFailures checks if the given testFailure is similar to any of the GH issues from 'issueJenkinsURLFails'. If found, returns the issue number and its similarity.
func GHIssueComment ¶
GHIssueComment returns an issue comment that can be used in GH issues to track which PRs are hitting certain flakes.
func GHIssueDescription ¶
func GHIssueDescription(failure BuildFailure) (string, string, error)
GHIssueDescription returns an issue description that can be used when creating a new GH issue flake.
func IsJenkinsFailure ¶
func IsSimilarFlake ¶
IsSimilarFlake checks if test1 and test2 have a similarity greater than 'flakeSimilarity'. If they have, it returns the similarity of both tests if they don't have returns -1.
func PRCommentFailure ¶
func PRCommentFailure(failure BuildFailure) (string, error)
func PRCommentKnownFlakes ¶
func PRCommentNewGHIssues ¶
func PRCommentUnknownFlakes ¶
func SplitJobNameNumber ¶
Types ¶
type BuildFailure ¶
type BuildFailure struct { BuildNumber int64 `json:"build-number"` JobName string `json:"job-name"` // Artifacts is a list of URLs for such artifacts Artifacts []string `json:"artifacts"` // URL is the URL for the BuildFailure URL string `json:"url"` Test }
func FilterFlakes ¶
func FilterFlakes(log *zerolog.Logger, flakeCfg FlakeConfig, jobFailures []BuildFailure, jobFailURL string) []BuildFailure
FilterFlakes filters the given flakes accordingly the configuration set in flakeConfig. If the number of flakes is greater than the maximum possible flakes per test, it will print a warning message in the logs and return nil.
type FlakeConfig ¶
type GHIssue ¶
func ParseGHIssue ¶
type JenkinsClient ¶
func NewJenkinsClient ¶
NewJenkinsClient creates a new JenkinsClient. If 'serverMode' is set, UX log messages are not printed, for example loading bars.
func (*JenkinsClient) GetJobFailure ¶
func (jc *JenkinsClient) GetJobFailure(ctx context.Context, jobName string, buildNumber int64) (int, []BuildFailure, error)
GetJobFailure returns the PR number, or 0 if not found and a list of BuildFailures for the given buildNumber of the jobName. If the Build no longer exists no errors are returned and the list of BuildFailures is also nil.
func (*JenkinsClient) GetJobFrom ¶
func (jc *JenkinsClient) GetJobFrom(ctx context.Context, jobName string, filterFlakes func(jobFailures []BuildFailure, jobFailURL string) []BuildFailure) (JenkinsFailures, error)
GetJobFrom returns all failures filtered by 'filterFlakes' from the given jenkins URL.
func (*JenkinsClient) GetTestResults ¶
func (jc *JenkinsClient) GetTestResults(ctx context.Context, jobName string) (JenkinsFailures, error)
GetTestResults returns all test results of a job.
type JenkinsFailures ¶
type JenkinsFailures map[int][]BuildFailure
JenkinsFailures maps a PR to a slice of BuildFailures