gitlab

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2015 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultScope = "api"
)

Variables

This section is empty.

Functions

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, client *gogitlab.Gitlab, owner, name string) (projectId string, err error)

func GetUserEmail

func GetUserEmail(client *gogitlab.Gitlab, defaultURL string) (*gogitlab.Gitlab, error)

func IsAdmin

func IsAdmin(proj *gogitlab.Project) bool

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

func IsRead

func IsRead(proj *gogitlab.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 *gogitlab.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) *gogitlab.Gitlab

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
	Search      bool
}

func Load

func Load(env envconfig.Env) *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) GetOpen

func (g *Gitlab) GetOpen() bool

Accessor method, to open field.

func (*Gitlab) GetOrgs

func (g *Gitlab) GetOrgs() []string

Accessor method, to allowed remote organizations field.

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) Scope

func (g *Gitlab) Scope() string

return default scope for GitHub

func (*Gitlab) Script

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

GetScript fetches the build script (.drone.yml) from the remote repository and returns in string format.

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.

Jump to

Keyboard shortcuts

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