Documentation ¶
Index ¶
- func GetLogFileLocation(fileLocation string) string
- func NewBool(b bool) *bool
- func NewInt(n int) *int
- func NewInt32(n int32) *int32
- func NewInt64(n int64) *int64
- func NewString(s string) *string
- func PingEventFromJSON(data io.Reader) *github.PingEvent
- func SetupLogging(c *Config) error
- type ChecksService
- type CloudRepository
- type Config
- type E2ECancelError
- type E2ETestDesktopError
- type E2ETestDesktopTriggerInfo
- type E2ETestError
- type E2ETestFromLabelError
- type E2ETestMobileError
- type E2ETestMobileTriggerInfo
- type E2ETestTriggerInfo
- type GitLabClient
- type GitService
- type GithubClient
- type Integration
- type IssuesService
- type LabelResponse
- type MetricsProvider
- type MetricsTransport
- type OrganizationsService
- type Payload
- type PipelinesService
- type PullRequestsService
- type RateLimitTransport
- type RepositoriesService
- type Repository
- type Server
- func (s *Server) AutoMergePR() error
- func (s *Server) CheckPRActivity()
- func (s *Server) CleanOutdatedPRs()
- func (s *Server) CleanUpLabels(pr *model.PullRequest)
- func (s *Server) GetIssueFromGithub(ctx context.Context, ghIssue *github.Issue) (*model.Issue, error)
- func (s *Server) GetPullRequestFromGithub(ctx context.Context, pullRequest *github.PullRequest, action string) (*model.PullRequest, error)
- func (s *Server) GetUpdateChecks(ctx context.Context, owner, repoName string, prNumber int) (*model.PullRequest, error)
- func (s *Server) IsBotUserFromCLAExclusionsList(user string) bool
- func (s *Server) IsInBotBlockList(user string) bool
- func (s *Server) IsOrgMember(user string) bool
- func (s *Server) RefreshMembers()
- func (s *Server) Start()
- func (s *Server) Stop() error
- func (s *Server) Tick()
- type TeamsService
- type WebhookValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLogFileLocation ¶
func SetupLogging ¶
Types ¶
type ChecksService ¶
type ChecksService interface {
ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *github.ListCheckRunsOptions) (*github.ListCheckRunsResults, *github.Response, error)
}
type CloudRepository ¶ added in v0.16.10
type Config ¶
type Config struct { ListenAddress string MattermodURL string GithubAccessToken string GitHubTokenReserve int GithubUsername string GithubEmail string GitConfigMergeRenameLimit string GithubAccessTokenCherryPick string GitHubWebhookSecret string Org string Username string AutoAssignerTeam string AutoAssignerTeamID int64 CircleCIToken string GitLabInternalURL string GitLabInternalToken string TickRateMinutes int DriverName string DataSource string Repositories []*Repository CloudRepositories []*CloudRepository BlockPRMergeLabels []string AutoPRMergeLabel string BuildAppTag string BuildAppInitMessage string BuildAppDoneMessage string BuildAppFailedMessage string BuildAppBranchPrefix string E2EDockerRepo string E2EGitLabProject string E2EWebappRef string E2EServerRef string E2EWebappReponame string E2EServerReponame string E2EWebappStatusContext string E2EServerStatusContext string E2ETriggerLabel []string E2ETestAutomationDashboardURL string E2EMobileCoreReponame string E2EMobileGitLabProject string E2EMobileGitLabProjectRefForPR string E2EDesktopCoreReponame string E2EDesktopGitLabProject string E2EDesktopGitLabProjectRefForPR string EnterpriseReponame string EnterpriseTriggerReponame string EnterpriseWebappReponame string EnterpriseTriggerLabel string EnterpriseGithubStatusContext string EnterpriseGithubStatusTETests string EnterpriseGithubStatusEETests string EnterpriseWorkflowName string TranslationsMattermostWebhookURL string TranslationsMattermostMessage string TranslationsBot string TranslationsDoNotMergeLabel string TranslationsMergedMessage string TranslationsMergeFailureMessage string TranslationsMergePolicy string StartLoadtestTag string StartLoadtestMessage string CLAExclusionsList []string CLAGithubStatusContext string SignedCLAURL string PRWelcomeMessage string PrLabels []LabelResponse IssueLabels []LabelResponse IssueLabelsToCleanUp []string BlockListPathsGlobal []string BlockListPathsPerRepo map[string][]string // BlockListPathsPerRepo is a per repository list of blocked files BlockListBots []string // List of bots who are part of the org, but are not allowed to run slash commands. MattermostWebhookURL string LogSettings struct { ConsoleLevel string FileLevel string FileLocation string EnableConsole bool EnableColor bool ConsoleJSON bool EnableFile bool FileJSON bool } DaysUntilStale int ExemptStaleLabels []string StaleLabel string StaleComment string MetricsServerPort string RepoFolder string // folder containing local checkouts of repositories for cherry-picking ScriptsFolder string // folder containing the cherry-pick.sh script }
nolint:govet
type E2ECancelError ¶ added in v0.14.0
type E2ECancelError struct {
// contains filtered or unexported fields
}
func (*E2ECancelError) Error ¶ added in v0.14.0
func (e *E2ECancelError) Error() string
type E2ETestDesktopError ¶ added in v0.16.13
type E2ETestDesktopError struct {
// contains filtered or unexported fields
}
func (*E2ETestDesktopError) Error ¶ added in v0.16.13
func (e *E2ETestDesktopError) Error() string
type E2ETestDesktopTriggerInfo ¶ added in v0.16.13
type E2ETestError ¶ added in v0.14.0
type E2ETestError struct {
// contains filtered or unexported fields
}
func (*E2ETestError) Error ¶ added in v0.14.0
func (e *E2ETestError) Error() string
type E2ETestFromLabelError ¶ added in v0.16.2
type E2ETestFromLabelError struct {
// contains filtered or unexported fields
}
func (*E2ETestFromLabelError) Error ¶ added in v0.16.2
func (e *E2ETestFromLabelError) Error() string
type E2ETestMobileError ¶ added in v0.16.12
type E2ETestMobileError struct {
// contains filtered or unexported fields
}
func (*E2ETestMobileError) Error ¶ added in v0.16.12
func (e *E2ETestMobileError) Error() string
type E2ETestMobileTriggerInfo ¶ added in v0.16.12
type E2ETestTriggerInfo ¶ added in v0.14.0
type GitLabClient ¶ added in v0.14.0
type GitLabClient struct { Pipelines PipelinesService // contains filtered or unexported fields }
func NewGitLabClient ¶ added in v0.14.0
func NewGitLabClient(accessToken string, baseURL string) (*GitLabClient, error)
type GitService ¶
type GitService interface { CreateRef(ctx context.Context, owner string, repo string, ref *github.Reference) (*github.Reference, *github.Response, error) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*github.Response, error) GetRef(ctx context.Context, owner string, repo string, ref string) (*github.Reference, *github.Response, error) GetCommit(ctx context.Context, owner string, repo string, ref string) (*github.Commit, *github.Response, error) ListMatchingRefs(ctx context.Context, owner string, repo string, opts *github.ReferenceListOptions) ([]*github.Reference, *github.Response, error) }
type GithubClient ¶
type GithubClient struct { Checks ChecksService Git GitService Issues IssuesService Organizations OrganizationsService PullRequests PullRequestsService Repositories RepositoriesService Teams TeamsService // contains filtered or unexported fields }
GithubClient wraps the github.Client with relevant interfaces.
func NewGithubClient ¶
func NewGithubClient(accessToken string, limitTokens int, metrics MetricsProvider) (*GithubClient, error)
NewGithubClient returns a new Github client that will use a fixed 10 req/sec / 10 burst tokens rate limiter configuration
func NewGithubClientWithLimiter ¶
func NewGithubClientWithLimiter(accessToken string, limit rate.Limit, burstTokens int, metricsProvider MetricsProvider) *GithubClient
NewGithubClientWithLimiter returns a new Github client with the provided limit and burst tokens that will be used by the rate limit transport.
func (*GithubClient) RateLimits ¶
func (c *GithubClient) RateLimits(ctx context.Context) (*github.RateLimits, *github.Response, error)
type Integration ¶
type IssuesService ¶
type IssuesService interface { AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*github.Issue, *github.Response, error) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error) CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*github.Response, error) Edit(ctx context.Context, owner string, repo string, number int, issue *github.IssueRequest) (*github.Issue, *github.Response, error) Get(ctx context.Context, owner string, repo string, number int) (*github.Issue, *github.Response, error) ListByRepo(ctx context.Context, owner string, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) ListComments(ctx context.Context, owner string, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opt *github.ListOptions) ([]*github.Label, *github.Response, error) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*github.Response, error) }
type LabelResponse ¶
type MetricsProvider ¶
type MetricsProvider interface { // ObserverHTTPRequestDuration stores the elapsed time for an HTTP request ObserveHTTPRequestDuration(method, handler, statusCode string, elapsed float64) // IncreaseWebhookRequest increases the counter for the webhook requests // identified by name IncreaseWebhookRequest(name string) // IncreaseWebhookErrors stores the number of errors identified by name IncreaseWebhookErrors(name string) // ObserveGithubRequestDuration stores the elapsed time for github requests ObserveGithubRequestDuration(method, handler, statusCode string, elapsed float64) // IncreaseGithubCacheHits stores the number of cache hits when a github request // is done. The information is stored using the HTTP method and the request handler IncreaseGithubCacheHits(method, handler string) // IncreaseGithubCacheMisses stores the number of cache misses when a github request // is done. The information is stored using the HTTP method and the request handler IncreaseGithubCacheMisses(method, handler string) // IncreaseRateLimiterErrors stores the number of errors received when trying to // rate limit the requests IncreaseRateLimiterErrors() // ObserverCronTaskDuration stores the elapsed time for a cron task ObserveCronTaskDuration(name string, elapsed float64) // IncreaseCronTaskErrors stores the number of errors for a cron task IncreaseCronTaskErrors(name string) }
MetricsProvider is the interface that exposes the communication with the metrics system this interface should be implemented by the different providers we want to include
type MetricsTransport ¶
type MetricsTransport struct { Base http.RoundTripper // contains filtered or unexported fields }
Transport is an HTTP transport that would check the requests and increase some metrics, cache errors, etc based on the requests and responses
func NewMetricsTransport ¶
func NewMetricsTransport(base http.RoundTripper, metrics MetricsProvider) *MetricsTransport
NewTransport returns a transport using a provided http.RoundTripper as the base and a metrics provider
func (*MetricsTransport) Client ¶
func (t *MetricsTransport) Client() *http.Client
Client returns a new http.Client using Transport as the default transport
type OrganizationsService ¶
type OrganizationsService interface { GetOrgMembership(ctx context.Context, user, org string) (*github.Membership, *github.Response, error) IsMember(ctx context.Context, org, user string) (bool, *github.Response, error) ListMembers(ctx context.Context, org string, opts *github.ListMembersOptions) ([]*github.User, *github.Response, error) }
type PipelinesService ¶ added in v0.14.0
type PipelinesService interface { CancelPipelineBuild(pid interface{}, pipeline int, options ...gitlab.RequestOptionFunc) (*gitlab.Pipeline, *gitlab.Response, error) CreatePipeline(pid interface{}, opt *gitlab.CreatePipelineOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Pipeline, *gitlab.Response, error) GetPipeline(pid interface{}, pipeline int, options ...gitlab.RequestOptionFunc) (*gitlab.Pipeline, *gitlab.Response, error) GetPipelineVariables(pid interface{}, pipeline int, options ...gitlab.RequestOptionFunc) ([]*gitlab.PipelineVariable, *gitlab.Response, error) ListProjectPipelines(pid interface{}, opt *gitlab.ListProjectPipelinesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.PipelineInfo, *gitlab.Response, error) }
PipelinesService exposes an interface of GitLabCI client. Useful to mock in tests.
type PullRequestsService ¶
type PullRequestsService interface { Get(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error) List(ctx context.Context, owner string, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) ListFiles(ctx context.Context, owner string, repo string, number int, opts *github.ListOptions) ([]*github.CommitFile, *github.Response, error) ListReviewers(ctx context.Context, owner, repo string, number int, opts *github.ListOptions) (*github.Reviewers, *github.Response, error) ListReviews(ctx context.Context, owner, repo string, number int, opts *github.ListOptions) ([]*github.PullRequestReview, *github.Response, error) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *github.PullRequestOptions) (*github.PullRequestMergeResult, *github.Response, error) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers github.ReviewersRequest) (*github.PullRequest, *github.Response, error) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *github.PullRequestBranchUpdateOptions) (*github.PullRequestBranchUpdateResponse, *github.Response, error) CreateReview(ctx context.Context, owner, repo string, number int, review *github.PullRequestReviewRequest) (*github.PullRequestReview, *github.Response, error) }
type RateLimitTransport ¶
type RateLimitTransport struct {
// contains filtered or unexported fields
}
RateLimitTransport will provide a layer based on http.RounTripper interface that provided rate limiting capability
func NewRateLimitTransport ¶
func NewRateLimitTransport(limit rate.Limit, tokens int, base http.RoundTripper, metrics MetricsProvider) *RateLimitTransport
NewRateLimitTransport will return a new transport that provides rate limiting capability based on the provided limit and burst tokens. It also needs the base RountTripper that will be called in case the rate limit is not needed
type RepositoriesService ¶
type RepositoriesService interface { CreateStatus(ctx context.Context, owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, *github.Response, error) Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error) GetBranch(ctx context.Context, owner, repo, branch string, followRedirects bool) (*github.Branch, *github.Response, error) ListBranches(ctx context.Context, owner string, repo string, opts *github.BranchListOptions) ([]*github.Branch, *github.Response, error) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *github.ListOptions) (*github.CombinedStatus, *github.Response, error) ListTeams(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.Team, *github.Response, error) ListStatuses(ctx context.Context, owner, repo, ref string, opts *github.ListOptions) ([]*github.RepoStatus, *github.Response, error) }
type Repository ¶
type Repository struct { Owner string Name string BuildStatusContext string InstanceSetupScript string InstanceSetupUpgradeScript string JobName string GreetingTeam string // GreetingTeam is the GitHub team responsible for triaging non-member PRs for this repo. GreetingLabels []string // GreetingLabels are the labels applied automatically to non-member PRs for this repo. }
func GetRepository ¶
func GetRepository(repositories []*Repository, owner, name string) (*Repository, bool)
type Server ¶
type Server struct { Config *Config Store store.Store GithubClient *GithubClient GitLabCIClientV4 *GitLabClient OrgMembers []string StartTime time.Time Metrics MetricsProvider // contains filtered or unexported fields }
Server is the mattermod server. nolint:govet
func (*Server) AutoMergePR ¶
func (*Server) CheckPRActivity ¶
func (s *Server) CheckPRActivity()
func (*Server) CleanOutdatedPRs ¶
func (s *Server) CleanOutdatedPRs()
func (*Server) CleanUpLabels ¶
func (s *Server) CleanUpLabels(pr *model.PullRequest)
func (*Server) GetIssueFromGithub ¶
func (*Server) GetPullRequestFromGithub ¶
func (s *Server) GetPullRequestFromGithub(ctx context.Context, pullRequest *github.PullRequest, action string) (*model.PullRequest, error)
func (*Server) GetUpdateChecks ¶
func (*Server) IsBotUserFromCLAExclusionsList ¶
func (*Server) IsInBotBlockList ¶ added in v0.16.16
func (*Server) IsOrgMember ¶
func (*Server) RefreshMembers ¶
func (s *Server) RefreshMembers()
type TeamsService ¶ added in v0.5.8
type WebhookValidationError ¶
type WebhookValidationError struct {
// contains filtered or unexported fields
}
WebhookValidationError contains an error in the webhook payload.
func (*WebhookValidationError) Error ¶
func (e *WebhookValidationError) Error() string
Error implements the error interface.
Source Files ¶
- auto_merge.go
- autoassign.go
- block_pr_merge.go
- cherry_pick.go
- cla.go
- community.go
- config.go
- e2e_cancel.go
- e2e_test_command.go
- e2e_test_desktop_command.go
- e2e_test_from_label.go
- e2e_test_mobile_command.go
- github.go
- github_client.go
- gitlab.go
- issue_comment_handler.go
- issue_handler.go
- metrics.go
- pr_from_issue_handler.go
- pull_request_handler.go
- rate_limit.go
- response_writer_wrapper.go
- review.go
- server.go
- translations.go
- update_branch.go
- utils.go
- validate_signature.go
- webhook.go