git_provider

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64ToStringPtr added in v1.7.0

func DecodeBase64ToStringPtr(encoded string) (*string, error)

func ExtractLabelsId added in v1.7.0

func ExtractLabelsId(labels []*gitlab.EventLabel) []string

func FixRepoNames added in v1.7.0

func FixRepoNames(c *GitlabClientImpl) error

func GetBitbucketTokenScopes

func GetBitbucketTokenScopes(client *bitbucket.Client, cfg *conf.GlobalConfig) ([]string, error)

func GetProjectId added in v1.7.0

func GetProjectId(ctx context.Context, c *GitlabClientImpl, repo *string) (*int, error)

func GetScopes

func GetScopes(ctx context.Context, client *github.Client) ([]string, error)

func IsGroupWebhookEnabled added in v1.7.0

func IsGroupWebhookEnabled(ctx context.Context, c *GitlabClientImpl) (*gitlab.GroupHook, bool)

func IsProjectWebhookEnabled added in v1.7.0

func IsProjectWebhookEnabled(ctx context.Context, c *GitlabClientImpl, projectId int) (*gitlab.ProjectHook, bool)

func ValidateBitbucketPermissions

func ValidateBitbucketPermissions(client *bitbucket.Client, cfg *conf.GlobalConfig) error

func ValidateGitlabPermissions added in v1.7.0

func ValidateGitlabPermissions(ctx context.Context, client *gitlab.Client, cfg *conf.GlobalConfig) error

func ValidatePayload added in v1.7.0

func ValidatePayload(r *http.Request, secret []byte) ([]byte, error)

func ValidatePermissions

func ValidatePermissions(ctx context.Context, client *github.Client, cfg *conf.GlobalConfig) error

Types

type BitbucketClientImpl

type BitbucketClientImpl struct {
	HooksHashTable map[string]int64
	// contains filtered or unexported fields
}

func (BitbucketClientImpl) GetCorrelatingEvent added in v1.8.0

func (b BitbucketClientImpl) GetCorrelatingEvent(ctx context2.Context, workflowEvent *v1alpha1.WorkflowPhase) (string, error)

func (BitbucketClientImpl) GetFile

func (b BitbucketClientImpl) GetFile(ctx context2.Context, repo string, branch string, path string) (*CommitFile, error)

func (BitbucketClientImpl) GetFiles

func (b BitbucketClientImpl) GetFiles(ctx context2.Context, repo string, branch string, paths []string) ([]*CommitFile, error)

func (BitbucketClientImpl) HandlePayload

func (b BitbucketClientImpl) HandlePayload(ctx context2.Context, request *http.Request, secret []byte) (*WebhookPayload, error)

func (BitbucketClientImpl) ListFiles

func (b BitbucketClientImpl) ListFiles(ctx context2.Context, repo string, branch string, path string) ([]string, error)

func (BitbucketClientImpl) PingHook

func (b BitbucketClientImpl) PingHook(ctx context2.Context, hook *HookWithStatus) error

func (BitbucketClientImpl) SetStatus

func (b BitbucketClientImpl) SetStatus(ctx context2.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error

func (BitbucketClientImpl) SetWebhook

func (b BitbucketClientImpl) SetWebhook(ctx context2.Context, repo *string) (*HookWithStatus, error)

func (BitbucketClientImpl) UnsetWebhook

func (b BitbucketClientImpl) UnsetWebhook(ctx context2.Context, hook *HookWithStatus) error

type Client

type Client interface {
	ListFiles(ctx context.Context, repo string, branch string, path string) ([]string, error)
	GetFile(ctx context.Context, repo string, branch string, path string) (*CommitFile, error)
	GetFiles(ctx context.Context, repo string, branch string, paths []string) ([]*CommitFile, error)
	SetWebhook(ctx context.Context, repo *string) (*HookWithStatus, error)
	UnsetWebhook(ctx context.Context, hook *HookWithStatus) error
	HandlePayload(ctx context.Context, request *http.Request, secret []byte) (*WebhookPayload, error)
	SetStatus(ctx context.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error
	PingHook(ctx context.Context, hook *HookWithStatus) error
	GetCorrelatingEvent(ctx context.Context, workflowEvent *v1alpha1.WorkflowPhase) (string, error)
}

func NewBitbucketServerClient

func NewBitbucketServerClient(cfg *conf.GlobalConfig) (Client, error)

func NewGitProviderClient

func NewGitProviderClient(cfg *conf.GlobalConfig) (Client, error)

func NewGithubClient

func NewGithubClient(cfg *conf.GlobalConfig) (Client, error)

func NewGitlabClient added in v1.7.0

func NewGitlabClient(cfg *conf.GlobalConfig) (Client, error)

type CommitFile

type CommitFile struct {
	Path    *string `json:"path"`
	Content *string `json:"content"`
}

type GithubClientImpl

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

func (*GithubClientImpl) GetCorrelatingEvent added in v1.8.0

func (c *GithubClientImpl) GetCorrelatingEvent(ctx context.Context, workflowEvent *v1alpha1.WorkflowPhase) (string, error)

func (*GithubClientImpl) GetFile

func (c *GithubClientImpl) GetFile(ctx context.Context, repo string, branch string, path string) (*CommitFile, error)

func (*GithubClientImpl) GetFiles

func (c *GithubClientImpl) GetFiles(ctx context.Context, repo string, branch string, paths []string) ([]*CommitFile, error)

func (*GithubClientImpl) HandlePayload

func (c *GithubClientImpl) HandlePayload(ctx context.Context, request *http.Request, secret []byte) (*WebhookPayload, error)

func (*GithubClientImpl) ListFiles

func (c *GithubClientImpl) ListFiles(ctx context.Context, repo string, branch string, path string) ([]string, error)

func (*GithubClientImpl) PingHook

func (c *GithubClientImpl) PingHook(ctx context.Context, hook *HookWithStatus) error

func (*GithubClientImpl) SetStatus

func (c *GithubClientImpl) SetStatus(ctx context.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error

func (*GithubClientImpl) SetWebhook

func (c *GithubClientImpl) SetWebhook(ctx context.Context, repo *string) (*HookWithStatus, error)

func (*GithubClientImpl) UnsetWebhook

func (c *GithubClientImpl) UnsetWebhook(ctx context.Context, hook *HookWithStatus) error

type GitlabClientImpl added in v1.7.0

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

func (*GitlabClientImpl) GetCorrelatingEvent added in v1.8.0

func (c *GitlabClientImpl) GetCorrelatingEvent(ctx context.Context, workflowEvent *v1alpha1.WorkflowPhase) (string, error)

func (*GitlabClientImpl) GetFile added in v1.7.0

func (c *GitlabClientImpl) GetFile(ctx context.Context, repo string, branch string, path string) (*CommitFile, error)

func (*GitlabClientImpl) GetFiles added in v1.7.0

func (c *GitlabClientImpl) GetFiles(ctx context.Context, repo string, branch string, paths []string) ([]*CommitFile, error)

func (*GitlabClientImpl) HandlePayload added in v1.7.0

func (c *GitlabClientImpl) HandlePayload(ctx context.Context, request *http.Request, secret []byte) (*WebhookPayload, error)

func (*GitlabClientImpl) ListFiles added in v1.7.0

func (c *GitlabClientImpl) ListFiles(ctx context.Context, repo string, branch string, path string) ([]string, error)

func (*GitlabClientImpl) PingHook added in v1.7.0

func (c *GitlabClientImpl) PingHook(ctx context.Context, hook *HookWithStatus) error

func (*GitlabClientImpl) SetStatus added in v1.7.0

func (c *GitlabClientImpl) SetStatus(ctx context.Context, repo *string, commit *string, linkURL *string, status *string, message *string) error

func (*GitlabClientImpl) SetWebhook added in v1.7.0

func (c *GitlabClientImpl) SetWebhook(ctx context.Context, repo *string) (*HookWithStatus, error)

func (*GitlabClientImpl) UnsetWebhook added in v1.7.0

func (c *GitlabClientImpl) UnsetWebhook(ctx context.Context, hook *HookWithStatus) error

type HookWithStatus

type HookWithStatus struct {
	HookID       int64
	Uuid         string
	HealthStatus bool
	RepoName     *string
}

type WebhookPayload

type WebhookPayload struct {
	Event            string   `json:"event"`
	Action           string   `json:"action"`
	Repo             string   `json:"repoName"`
	Branch           string   `json:"branch"`
	Commit           string   `json:"commit"`
	User             string   `json:"user"`
	UserEmail        string   `json:"user_email"`
	PullRequestURL   string   `json:"pull_request_url"`
	PullRequestTitle string   `json:"pull_request_title"`
	DestBranch       string   `json:"dest_branch"`
	Labels           []string `json:"labels"`
	HookID           int64    `json:"hookID"`
	OwnerID          int64    `json:"ownerID"`
}

Jump to

Keyboard shortcuts

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