Help us shape the future of Go! Take the 2026 Go Developer Survey

gitlab

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPending  = "pending"
	StatusRunning  = "running"
	StatusSuccess  = "success"
	StatusFailure  = "failed"
	StatusCanceled = "canceled"
)
View Source
const (
	DescPending  = "this build is pending"
	DescRunning  = "this buils is running"
	DescSuccess  = "the build was successful"
	DescFailure  = "the build failed"
	DescCanceled = "the build canceled"
)
View Source
const (
	DefaultScope = "api"
)

Variables

This section is empty.

Functions

func ExtractFromPath added in v0.4.2

func ExtractFromPath(str string) (string, string, error)

func GetKeyTitle

func GetKeyTitle(rawurl string) (string, error)

GetKeyTitle is a helper function that generates a title for the RSA public key based on the username and domain name.

func GetProjectId

func GetProjectId(r *Gitlab, c *client.Client, owner, name string) (projectId string, err error)

func GetUserAvatar added in v0.4.2

func GetUserAvatar(email string) string

func GetUserEmail

func GetUserEmail(c *client.Client, defaultURL string) (*client.Client, error)

func IsAdmin

func IsAdmin(proj *client.Project) bool

IsAdmin is a helper function that returns true if the user has Admin access to the repository.

func IsRead

func IsRead(proj *client.Project) bool

IsRead is a helper function that returns true if the user has Read-only access to the repository.

func IsWrite

func IsWrite(proj *client.Project) bool

IsWrite is a helper function that returns true if the user has Read-Write access to the repository.

func NewClient

func NewClient(url, accessToken string, skipVerify bool) *client.Client

NewClient is a helper function that returns a new GitHub client using the provided OAuth token.

Types

type Gitlab

type Gitlab struct {
	URL          string
	Client       string
	Secret       string
	AllowedOrgs  []string
	CloneMode    string
	Open         bool
	PrivateMode  bool
	SkipVerify   bool
	HideArchives bool
	Search       bool
}

func Load

func Load(config string) *Gitlab

func (*Gitlab) Activate

func (g *Gitlab) Activate(user *model.User, repo *model.Repo, k *model.Key, link string) error

Activate activates a repository by adding a Post-commit hook and a Public Deploy key, if applicable.

func (*Gitlab) Auth

func (g *Gitlab) Auth(token, secret string) (string, error)

func (*Gitlab) Deactivate

func (g *Gitlab) Deactivate(user *model.User, repo *model.Repo, link string) error

Deactivate removes a repository by removing all the post-commit hooks which are equal to link and removing the SSH deploy key.

func (*Gitlab) File added in v0.4.2

func (g *Gitlab) File(user *model.User, repo *model.Repo, build *model.Build, f string) ([]byte, error)

File fetches a file from the remote repository and returns in string format.

func (*Gitlab) Hook

func (g *Gitlab) Hook(req *http.Request) (*model.Repo, *model.Build, error)

ParseHook parses the post-commit hook from the Request body and returns the required data in a standard format.

func (*Gitlab) Login

func (g *Gitlab) Login(res http.ResponseWriter, req *http.Request) (*model.User, bool, error)

Login authenticates the session and returns the remote user details.

func (*Gitlab) Netrc

func (g *Gitlab) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

Netrc returns a .netrc file that can be used to clone private repositories from a remote system.

func (*Gitlab) Oauth2Transport

func (g *Gitlab) Oauth2Transport(r *http.Request) *oauth2.Transport

¯\_(ツ)_/¯

func (*Gitlab) Perm

func (g *Gitlab) Perm(u *model.User, owner, name string) (*model.Perm, error)

Perm fetches the named repository from the remote system.

func (*Gitlab) Repo

func (g *Gitlab) Repo(u *model.User, owner, name string) (*model.Repo, error)

Repo fetches the named repository from the remote system.

func (*Gitlab) Repos

func (g *Gitlab) Repos(u *model.User) ([]*model.RepoLite, error)

Repos fetches a list of repos from the remote system.

func (*Gitlab) Status

func (g *Gitlab) Status(u *model.User, repo *model.Repo, b *model.Build, link string) error

NOTE Currently gitlab doesn't support status for commits and events,

also if we want get MR status in gitlab we need implement a special plugin for gitlab,
gitlab uses API to fetch build status on client side. But for now we skip this.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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