gitlab_client

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const GitlabCommitStatusContext = "kubechecks"
View Source
const GitlabTokenHeader = "X-Gitlab-Token"
View Source
const MaxCommentLength = 1_000_000

Variables

This section is empty.

Functions

func CheckForValidChanges

func CheckForValidChanges(ctx context.Context, changes []*Changes, paths []string, fileTypes []string) bool

Types

type Changes

type Changes struct {
	OldPath     string `json:"old_path"`
	NewPath     string `json:"new_path"`
	AMode       string `json:"a_mode"`
	BMode       string `json:"b_mode"`
	Diff        string `json:"diff"`
	NewFile     bool   `json:"new_file"`
	RenamedFile bool   `json:"renamed_file"`
	DeletedFile bool   `json:"deleted_file"`
}

type Client

type Client struct {
	*gitlab.Client
	// contains filtered or unexported fields
}

func CreateGitlabClient

func CreateGitlabClient() (*Client, error)

func (*Client) CommitStatus

func (c *Client) CommitStatus(ctx context.Context, repo *repo.Repo, state pkg.CommitState) error

func (*Client) CreateHook

func (c *Client) CreateHook(ctx context.Context, repoName, webhookUrl, webhookSecret string) error

func (*Client) Email

func (c *Client) Email() string

func (*Client) GetHookByUrl

func (c *Client) GetHookByUrl(ctx context.Context, repoName, webhookUrl string) (*vcs.WebHookConfig, error)

func (*Client) GetLastPipelinesForCommit

func (c *Client) GetLastPipelinesForCommit(projectName string, commitSHA string) *gitlab.PipelineInfo

func (*Client) GetMergeChanges

func (c *Client) GetMergeChanges(ctx context.Context, projectId int, mergeReqId int) ([]*Changes, error)

func (*Client) GetName

func (c *Client) GetName() string

func (*Client) GetPipelinesForCommit

func (c *Client) GetPipelinesForCommit(projectName string, commitSHA string) ([]*gitlab.PipelineInfo, error)

func (*Client) GetProjectByID

func (c *Client) GetProjectByID(project int) (*gitlab.Project, error)

GetProjectByIDorName gets a project by the given Project Name or ID

func (*Client) GetRepoConfigFile

func (c *Client) GetRepoConfigFile(ctx context.Context, projectId int, mergeReqId int) ([]byte, error)

func (*Client) LoadHook

func (c *Client) LoadHook(ctx context.Context, id string) (*repo.Repo, error)

func (*Client) ParseHook

func (c *Client) ParseHook(r *http.Request, request []byte) (*repo.Repo, error)

ParseHook parses and validates a webhook event; return an err if this isn't valid

func (*Client) PostMessage

func (c *Client) PostMessage(ctx context.Context, repo *repo.Repo, mergeRequestID int, msg string) *pkg.Message

func (*Client) TidyOutdatedComments

func (c *Client) TidyOutdatedComments(ctx context.Context, repo *repo.Repo) error

func (*Client) UpdateMessage

func (c *Client) UpdateMessage(ctx context.Context, m *pkg.Message, msg string) error

func (*Client) Username

func (c *Client) Username() string

func (*Client) VerifyHook

func (c *Client) VerifyHook(r *http.Request, secret string) ([]byte, error)

Each client has a different way of verifying their payloads; return an err if this isnt valid

Jump to

Keyboard shortcuts

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