gitlab

package
v0.0.0-...-f9d9e7f Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewGitlabClient func(accessToken, baseUrl string) (*GitlabClient, error) = newGitlabClient

Allow mocking for tests

View Source
var NewGitlabClientWithBasicAuth func(username, password, baseUrl string) (*GitlabClient, error) = newGitlabClientWithBasicAuth

Functions

func GetBaseUrl

func GetBaseUrl(repoUrl string) (string, error)

Types

type FailedToParseUrlError

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

func (FailedToParseUrlError) Error

func (e FailedToParseUrlError) Error() string

type GitlabClient

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

func (*GitlabClient) DeleteBranch

func (g *GitlabClient) DeleteBranch(repoUrl, branchName string) (bool, error)

DeleteBranch deletes given branch from repository

func (*GitlabClient) DeletePaCWebhook

func (g *GitlabClient) DeletePaCWebhook(repoUrl, webhookUrl string) error

DeletePaCWebhook deletes Pipelines as Code webhook in the given repository

func (*GitlabClient) EnsurePaCMergeRequest

func (g *GitlabClient) EnsurePaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)

EnsurePaCMergeRequest creates or updates existing (if needed) Pipelines as Code configuration proposal merge request. Returns the merge request web URL. If there is no error and web URL is empty, it means that the merge request is not needed (main branch is up to date).

func (*GitlabClient) FindUnmergedPaCMergeRequest

func (g *GitlabClient) FindUnmergedPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (*gp.MergeRequest, error)

FindUnmergedPaCMergeRequest searches for existing Pipelines as Code configuration proposal merge request

func (*GitlabClient) GetBranchSha

func (g *GitlabClient) GetBranchSha(repoUrl, branchName string) (string, error)

GetBranchSha returns SHA of top commit in the given branch

func (g *GitlabClient) GetBrowseRepositoryAtShaLink(repoUrl, sha string) string

GetBrowseRepositoryAtShaLink returns web URL of repository state at given SHA

func (*GitlabClient) GetConfiguredGitAppName

func (g *GitlabClient) GetConfiguredGitAppName() (string, string, error)

func (*GitlabClient) GetDefaultBranch

func (g *GitlabClient) GetDefaultBranch(repoUrl string) (string, error)

GetDefaultBranch returns name of default branch in the given repository

func (*GitlabClient) IsFileExist

func (g *GitlabClient) IsFileExist(repoUrl, branchName, filePath string) (bool, error)

IsFileExist check whether given file exists in the given branch of the reposiotry. If branch is empty string, default branch is used.

func (*GitlabClient) IsRepositoryPublic

func (g *GitlabClient) IsRepositoryPublic(repoUrl string) (bool, error)

IsRepositoryPublic returns true if the repository could be accessed without authentication

func (*GitlabClient) SetupPaCWebhook

func (g *GitlabClient) SetupPaCWebhook(repoUrl, webhookUrl, webhookSecret string) error

SetupPaCWebhook creates Pipelines as Code webhook in the given repository

func (*GitlabClient) UndoPaCMergeRequest

func (g *GitlabClient) UndoPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)

UndoPaCMergeRequest creates or updates existing Pipelines as Code configuration removal merge request. Returns the merge request web URL. If there is no error and web URL is empty, it means that the merge request is not needed (the configuraton has already been deleted).

type MissingHostError

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

func (MissingHostError) Error

func (e MissingHostError) Error() string

type MissingSchemaError

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

func (MissingSchemaError) Error

func (e MissingSchemaError) Error() string

Jump to

Keyboard shortcuts

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