Documentation ¶
Index ¶
- func EnableMergePipelineProtection(ctx context.Context, gitlabClient *goGitLab.Client, projectID int) error
- func EncryptAuthInfo(oauthResp *OauthSuccessResponse, gitLabApp *App) (string, error)
- func FetchMrInfo(client *gitlab.Client, projectID int, mergeID int) (*gitlab.MergeRequest, error)
- func FetchMrParticipants(client *gitlab.Client, projectID int, mergeID int) ([]*gitlab.User, error)
- func GetDefaultBranch(client *gitlab.Client, projectID int) (*gitlab.Branch, error)
- func GetGroupByFullPath(ctx context.Context, client *goGitLab.Client, fullPath string) (*goGitLab.Group, error)
- func GetGroupByID(ctx context.Context, client *goGitLab.Client, groupID int) (*goGitLab.Group, error)
- func GetGroupByName(ctx context.Context, client *goGitLab.Client, name string) (*goGitLab.Group, error)
- func GetGroupProjectListByGroupID(ctx context.Context, client *goGitLab.Client, groupID int) ([]*goGitLab.Project, error)
- func GetGroupsListAll(ctx context.Context, client *goGitLab.Client, ...) ([]*goGitLab.Group, error)
- func GetLatestCommit(client *gitlab.Client, projectID int, mergeID int) (*gitlab.Commit, error)
- func GetProjectByID(ctx context.Context, client *goGitLab.Client, gitLabProjectID int) (*goGitLab.Project, error)
- func GetProjectListAll(ctx context.Context, client *goGitLab.Client) ([]*goGitLab.Project, error)
- func GetProjectListByOrgName(ctx context.Context, client *goGitLab.Client, organizationName string) ([]*goGitLab.Project, error)
- func GetUserByName(ctx context.Context, client *goGitLab.Client, name string) (*goGitLab.User, error)
- func ListGroupMembers(ctx context.Context, client *goGitLab.Client, groupID int) ([]*goGitLab.GroupMember, error)
- func NewGitlabOauthClient(authInfo string, gitLabApp *App) (*goGitLab.Client, error)
- func NewGitlabOauthClientFromAccessToken(accessToken string) (*goGitLab.Client, error)
- func RemoveWebHook(gitLabClient *gitlab.Client, hookURL string, projectID int) error
- func SetCommitStatus(client *gitlab.Client, projectID int, commitSha string, ...) error
- func SetMrComment(client *gitlab.Client, projectID int, mergeID int, message string) error
- func SetOrCreateBranchProtection(ctx context.Context, client *gitlab.Client, projectID int, ...) error
- func SetWebHook(gitLabClient *gitlab.Client, hookURL string, projectID int, token string) error
- type App
- type OauthSuccessResponse
- type UserGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableMergePipelineProtection ¶
func EnableMergePipelineProtection(ctx context.Context, gitlabClient *goGitLab.Client, projectID int) error
EnableMergePipelineProtection enables the pipeline protection on given project, by default it's turned off and when a new MR is raised users can merge requests bypassing the pipelines. With this setting gitlab disables the Merge button if any of the pipelines are failing
func EncryptAuthInfo ¶
func EncryptAuthInfo(oauthResp *OauthSuccessResponse, gitLabApp *App) (string, error)
EncryptAuthInfo encrypts the oauth response into a string
func FetchMrInfo ¶
FetchMrInfo is responsible for fetching the MR info for given project
func FetchMrParticipants ¶
FetchMrParticipants is responsible to get unique mr participants
func GetDefaultBranch ¶
GetDefaultBranch finds the default branch for the given project
func GetGroupByFullPath ¶
func GetGroupByFullPath(ctx context.Context, client *goGitLab.Client, fullPath string) (*goGitLab.Group, error)
GetGroupByFullPath gets a gitlab Group by the given full path
func GetGroupByID ¶
func GetGroupByID(ctx context.Context, client *goGitLab.Client, groupID int) (*goGitLab.Group, error)
GetGroupByID gets a gitlab Group by the given name
func GetGroupByName ¶
func GetGroupByName(ctx context.Context, client *goGitLab.Client, name string) (*goGitLab.Group, error)
GetGroupByName gets a gitlab Group by the given name
func GetGroupProjectListByGroupID ¶
func GetGroupProjectListByGroupID(ctx context.Context, client *goGitLab.Client, groupID int) ([]*goGitLab.Project, error)
GetGroupProjectListByGroupID returns a list of GitLab projects under the specified Organization
func GetGroupsListAll ¶
func GetGroupsListAll(ctx context.Context, client *goGitLab.Client, minAccessLevel goGitLab.AccessLevelValue) ([]*goGitLab.Group, error)
GetGroupsListAll returns a complete list of GitLab groups for which the client as authorization/visibility
func GetLatestCommit ¶
func GetProjectByID ¶
func GetProjectByID(ctx context.Context, client *goGitLab.Client, gitLabProjectID int) (*goGitLab.Project, error)
GetProjectByID returns the GitLab project for the specified ID
func GetProjectListAll ¶
GetProjectListAll returns a complete list of GitLab projects for which the client as authorization/visibility
func GetProjectListByOrgName ¶
func GetProjectListByOrgName(ctx context.Context, client *goGitLab.Client, organizationName string) ([]*goGitLab.Project, error)
GetProjectListByOrgName returns a list of GitLab projects under the specified Organization
func GetUserByName ¶
func GetUserByName(ctx context.Context, client *goGitLab.Client, name string) (*goGitLab.User, error)
GetUserByName gets a gitlab user object by the given name
func ListGroupMembers ¶
func ListGroupMembers(ctx context.Context, client *goGitLab.Client, groupID int) ([]*goGitLab.GroupMember, error)
ListGroupMembers lists the members of a given groupID
func NewGitlabOauthClient ¶
NewGitlabOauthClient creates a new gitlab client from the given oauth info, authInfo is encrypted
func NewGitlabOauthClientFromAccessToken ¶
NewGitlabOauthClientFromAccessToken creates a new gitlab client from the given access token
func RemoveWebHook ¶
RemoveWebHook removes existing webhook from the given project
func SetCommitStatus ¶
func SetCommitStatus(client *gitlab.Client, projectID int, commitSha string, state gitlab.BuildStateValue, message string, targetURL string) error
SetCommitStatus is responsible for setting the MR status for commit sha
func SetMrComment ¶
SetMrComment is responsible for setting the comment body for project and merge id
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is a wrapper for the GitLab configuration items
func (*App) GetAppPrivateKey ¶
GetAppPrivateKey returns the GitLab application private key
func (*App) GetAppSecret ¶
GetAppSecret returns the GitLab application secret
type OauthSuccessResponse ¶
type OauthSuccessResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` CreatedAt int `json:"created_at"` }
OauthSuccessResponse is success response from Gitlab
func DecryptAuthInfo ¶
func DecryptAuthInfo(authInfoEncoded string, gitLabApp *App) (*OauthSuccessResponse, error)
DecryptAuthInfo decrypts the auth info into OauthSuccessResponse data structure
func FetchOauthCredentials ¶
func FetchOauthCredentials(code string) (*OauthSuccessResponse, error)
FetchOauthCredentials is responsible for fetching the credentials from gitlab for alredy started Oauth process (access_token, refresh_token)
func RefreshOauthToken ¶
func RefreshOauthToken(refreshToken string) (*OauthSuccessResponse, error)
RefreshOauthToken common routine to refresh the GitLab token