event_processor

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 13 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"
)

Variables

This section is empty.

Functions

This section is empty.

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 GerritEventProcessor

type GerritEventProcessor struct {
	// contains filtered or unexported fields
}

GerritEventProcessor is an implementation of Processor for Gerrit.

func NewGerritEventProcessor

func NewGerritEventProcessor(ksClient ctrlClient.Reader, logger *zap.SugaredLogger) *GerritEventProcessor

func (*GerritEventProcessor) Process

func (p *GerritEventProcessor) Process(ctx context.Context, body []byte, ns, _ string) (*EventInfo, error)

type GitHubEventProcessor

type GitHubEventProcessor struct {
	// contains filtered or unexported fields
}

func NewGitHubEventProcessor

func NewGitHubEventProcessor(
	ksClient ctrlClient.Reader,
	options *GitHubEventProcessorOptions,
) *GitHubEventProcessor

func (*GitHubEventProcessor) Process

func (p *GitHubEventProcessor) Process(ctx context.Context, body []byte, ns, eventType string) (*EventInfo, error)

type GitHubEventProcessorOptions

type GitHubEventProcessorOptions struct {
	Logger       *zap.SugaredLogger
	GitHubClient func(ctx context.Context, token string) *github.Client
}

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

type GitLabEventProcessor

type GitLabEventProcessor struct {
	// contains filtered or unexported fields
}

func NewGitLabEventProcessor

func NewGitLabEventProcessor(ksClient ctrlClient.Reader, logger *zap.SugaredLogger) *GitLabEventProcessor

func (*GitLabEventProcessor) Process

func (p *GitLabEventProcessor) Process(ctx context.Context, body []byte, ns, eventType string) (*EventInfo, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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