event_processor

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitProviderGitHub = "github"
	GitProviderGitLab = "gitlab"
	GitProviderGerrit = "gerrit"

	GerritEventTypeCommentAdded = "comment-added"
	GitHubEventTypeCommentAdded = "issue_comment"
	GitLabEventTypeCommentAdded = "Note Hook"

	EventTypeReviewComment = "comment"
	EventTypeMerge         = "merge"
)
View Source
const (
	CodebaseListLimit = 1000
)

Variables

This section is empty.

Functions

func ContainsPipelineRecheck added in v0.12.0

func ContainsPipelineRecheck(s string) bool

func ConvertRepositoryPath added in v0.12.0

func ConvertRepositoryPath(repo string) string

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.

Types

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

func (e *EventInfo) IsReviewCommentEvent() bool

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"`
}

GitLabCommentEvent represents GitLab comment event.

type GitLabCommit

type GitLabCommit struct {
	ID      string `json:"id"`
	Message string `json:"message"`
}

type GitLabMergeRequest

type GitLabMergeRequest struct {
	TargetBranch string       `json:"target_branch"`
	Title        string       `json:"title"`
	LastCommit   GitLabCommit `json:"last_commit"`
	SourceBranch string       `json:"source_branch"`
	ChangeNumber int          `json:"iid"`
}

type GitLabMergeRequestsEvent

type GitLabMergeRequestsEvent struct {
	Project          GitLabProject      `json:"project"`
	ObjectAttributes GitLabMergeRequest `json:"object_attributes"`
}

GitLabMergeRequestsEvent represents GitLab merge request event.

type GitLabProject

type GitLabProject struct {
	PathWithNamespace string `json:"path_with_namespace"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL