Documentation
¶
Index ¶
- Constants
- func ContainsPipelineRecheck(s string) bool
- func ContainsPipelineRecheckPrefix(s string) bool
- func ConvertRepositoryPath(repo string) string
- func GetCodebaseByRepoPath(ctx context.Context, client ctrlClient.Reader, ns, repoPath string) (*codebaseApi.Codebase, error)
- func GetGitServerToken(ctx context.Context, client ctrlClient.Reader, codebase *codebaseApi.Codebase) (string, error)
- type BitbucketAuthor
- type BitbucketBranch
- type BitbucketComment
- type BitbucketCommentContent
- type BitbucketCommentEvent
- type BitbucketCommit
- type BitbucketEvent
- type BitbucketPullRequest
- type BitbucketPullRequestDest
- type BitbucketPullRequestSrc
- type BitbucketRepository
- type EventInfo
- type GerritEvent
- type GitLabComment
- type GitLabCommentEvent
- type GitLabCommit
- type GitLabMergeRequest
- type GitLabMergeRequestsEvent
- type GitLabProject
- type GitLabUser
- type Processor
- type PullRequest
Constants ¶
const ( GitProviderGitHub = "github" GitProviderGitLab = "gitlab" GitProviderGerrit = "gerrit" GitProviderBitbucket = "bitbucket" GerritEventTypeCommentAdded = "comment-added" GitHubEventTypeCommentAdded = "issue_comment" GitLabEventTypeCommentAdded = "Note Hook" BitbucketEventTypeCommentAdded = "pullrequest:comment_created" EventTypeReviewComment = "comment" EventTypeMerge = "merge" RecheckComment = "/recheck" OkToTestComment = "/ok-to-test" )
const (
CodebaseListLimit = 1000
)
const GitServerTokenField = "token"
Variables ¶
This section is empty.
Functions ¶
func ContainsPipelineRecheck ¶ added in v0.12.0
ContainsPipelineRecheck checks if the comment contains the pipeline recheck or ok to test comment. It's used for Gerrit because its comments are in the format: "Patch Set 2:\n\n/recheck".
func ContainsPipelineRecheckPrefix ¶ added in v0.19.0
ContainsPipelineRecheckPrefix checks if the comment starts with the pipeline recheck or ok to test comment.
func ConvertRepositoryPath ¶ added in v0.12.0
ConvertRepositoryPath converts repository path to the format which is used in codebase.
func GetCodebaseByRepoPath ¶ added in v0.12.0
func GetCodebaseByRepoPath(ctx context.Context, client ctrlClient.Reader, ns, repoPath string) (*codebaseApi.Codebase, error)
GetCodebaseByRepoPath returns codebase by repository path.
func GetGitServerToken ¶ added in v0.13.0
func GetGitServerToken(ctx context.Context, client ctrlClient.Reader, codebase *codebaseApi.Codebase) (string, error)
Types ¶
type BitbucketAuthor ¶ added in v0.20.0
type BitbucketBranch ¶ added in v0.13.0
type BitbucketBranch struct {
Name string `json:"name"`
}
type BitbucketComment ¶ added in v0.13.0
type BitbucketComment struct {
Content BitbucketCommentContent `json:"content"`
}
type BitbucketCommentContent ¶ added in v0.13.0
type BitbucketCommentContent struct {
Raw string `json:"raw"`
}
type BitbucketCommentEvent ¶ added in v0.13.0
type BitbucketCommentEvent struct {
BitbucketEvent
Comment BitbucketComment `json:"comment"`
}
type BitbucketCommit ¶ added in v0.13.0
type BitbucketCommit struct {
Hash string `json:"hash"`
}
type BitbucketEvent ¶ added in v0.13.0
type BitbucketEvent struct {
Repository BitbucketRepository `json:"repository"`
PullRequest BitbucketPullRequest `json:"pullrequest"`
}
type BitbucketPullRequest ¶ added in v0.13.0
type BitbucketPullRequest struct {
ID int `json:"id"`
Title string `json:"title"`
Source BitbucketPullRequestSrc `json:"source"`
Destination BitbucketPullRequestDest `json:"destination"`
LastCommit BitbucketCommit `json:"last_commit"`
Author BitbucketAuthor `json:"author"`
Links struct {
Html struct {
Href string `json:"href"`
} `json:"html"`
} `json:"links"`
}
type BitbucketPullRequestDest ¶ added in v0.13.0
type BitbucketPullRequestDest struct {
Branch BitbucketBranch `json:"branch"`
Commit BitbucketCommit `json:"commit"`
}
type BitbucketPullRequestSrc ¶ added in v0.13.0
type BitbucketPullRequestSrc struct {
Branch BitbucketBranch `json:"branch"`
Commit BitbucketCommit `json:"commit"`
}
type BitbucketRepository ¶ added in v0.13.0
type BitbucketRepository struct {
FullName string `json:"full_name"`
}
type EventInfo ¶
type EventInfo struct {
GitProvider string
RepoPath string
TargetBranch string
Type string
Codebase *codebaseApi.Codebase
HasPipelineRecheck bool
PullRequest *PullRequest
}
EventInfo represents information about an event.
func (*EventInfo) IsReviewCommentEvent ¶
IsReviewCommentEvent returns true if the event is a review comment event.
type GerritEvent ¶
type GerritEvent struct {
Project struct {
Name string `json:"name"`
} `json:"project"`
Change struct {
Branch string `json:"branch"`
} `json:"change"`
Comment string `json:"comment"`
Type string `json:"type"`
}
GerritEvent represents a Gerrit event.
type GitLabComment ¶
type GitLabComment struct {
Note string `json:"note"`
}
type GitLabCommentEvent ¶
type GitLabCommentEvent struct {
Project GitLabProject `json:"project"`
MergeRequest GitLabMergeRequest `json:"merge_request"`
ObjectAttributes GitLabComment `json:"object_attributes"`
User GitLabUser `json:"user"`
}
GitLabCommentEvent represents GitLab comment event.
type GitLabCommit ¶
type GitLabMergeRequest ¶
type GitLabMergeRequestsEvent ¶
type GitLabMergeRequestsEvent struct {
Project GitLabProject `json:"project"`
ObjectAttributes GitLabMergeRequest `json:"object_attributes"`
User GitLabUser `json:"user"`
}
GitLabMergeRequestsEvent represents GitLab merge request event.
type GitLabProject ¶
type GitLabProject struct {
PathWithNamespace string `json:"path_with_namespace"`
}
type GitLabUser ¶ added in v0.20.0
type Processor ¶
type Processor interface {
Process(ctx context.Context, body []byte, ns, eventType string) (*EventInfo, error)
}
Processor is an interface for event processors.
type PullRequest ¶
type PullRequest struct {
HeadRef string `json:"headRef"`
HeadSha string `json:"headSha"`
Title string `json:"title"`
ChangeNumber int `json:"changeNumber"`
LastCommitMessage string `json:"lastCommitMessage"`
Author string `json:"author"`
AuthorAvatarUrl string `json:"authorAvatarUrl"`
Url string `json:"url"`
}