gitlab_client

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 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 {
	// contains filtered or unexported fields
}

func CreateGitlabClient

func CreateGitlabClient(cfg config.ServerConfig) (*Client, error)

func (*Client) CommitStatus

func (c *Client) CommitStatus(ctx context.Context, pr vcs.PullRequest, 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)

GetProjectByID 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) (vcs.PullRequest, error)

func (*Client) ParseHook

func (c *Client) ParseHook(r *http.Request, request []byte) (vcs.PullRequest, 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, pr vcs.PullRequest, message string) *msg.Message

func (*Client) TidyOutdatedComments

func (c *Client) TidyOutdatedComments(ctx context.Context, pr vcs.PullRequest) error

func (*Client) ToEmoji added in v1.4.3

func (c *Client) ToEmoji(s pkg.CommitState) string

ToEmoji returns a string representation of this state for use in the request

func (*Client) UpdateMessage

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

func (*Client) Username

func (c *Client) Username() string

func (*Client) VerifyHook

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

VerifyHook returns an err if the webhook isn't valid

Jump to

Keyboard shortcuts

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