Documentation ¶
Index ¶
- Constants
- func ExtractFromPath(str string) (string, string, error)
- func GetKeyTitle(rawurl string) (string, error)
- func GetProjectId(r *Gitlab, c *client.Client, owner, name string) (projectId string, err error)
- func GetUserAvatar(email string) string
- func GetUserEmail(c *client.Client, defaultURL string) (*client.Client, error)
- func IsAdmin(proj *client.Project) bool
- func IsRead(proj *client.Project) bool
- func IsWrite(proj *client.Project) bool
- func New(opts Opts) (remote.Remote, error)
- func NewClient(url, accessToken string, skipVerify bool) *client.Client
- type Gitlab
- func (g *Gitlab) Activate(user *model.User, repo *model.Repo, link string) error
- func (g *Gitlab) Auth(token, secret string) (string, error)
- func (g *Gitlab) Deactivate(user *model.User, repo *model.Repo, link string) error
- func (g *Gitlab) File(user *model.User, repo *model.Repo, build *model.Build, f string) ([]byte, error)
- func (g *Gitlab) Hook(req *http.Request) (*model.Repo, *model.Build, error)
- func (g *Gitlab) Login(res http.ResponseWriter, req *http.Request) (*model.User, error)
- func (g *Gitlab) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)
- func (g *Gitlab) Oauth2Transport(r *http.Request) *oauth2.Transport
- func (g *Gitlab) Perm(u *model.User, owner, name string) (*model.Perm, error)
- func (g *Gitlab) Repo(u *model.User, owner, name string) (*model.Repo, error)
- func (g *Gitlab) Repos(u *model.User) ([]*model.RepoLite, error)
- func (g *Gitlab) Status(u *model.User, repo *model.Repo, b *model.Build, link string) error
- func (g *Gitlab) TeamPerm(u *model.User, org string) (*model.Perm, error)
- func (g *Gitlab) Teams(u *model.User) ([]*model.Team, error)
- type Opts
Constants ¶
const ( StatusPending = "pending" StatusRunning = "running" StatusSuccess = "success" StatusFailure = "failed" StatusCanceled = "canceled" )
const ( DescPending = "this build is pending" DescRunning = "this buils is running" DescSuccess = "the build was successful" DescFailure = "the build failed" DescCanceled = "the build canceled" )
const DefaultScope = "api"
Variables ¶
This section is empty.
Functions ¶
func GetKeyTitle ¶
GetKeyTitle is a helper function that generates a title for the RSA public key based on the username and domain name.
func GetProjectId ¶
func GetUserAvatar ¶ added in v0.4.2
func IsAdmin ¶
IsAdmin is a helper function that returns true if the user has Admin access to the repository.
func IsRead ¶
IsRead is a helper function that returns true if the user has Read-only access to the repository.
func IsWrite ¶
IsWrite is a helper function that returns true if the user has Read-Write access to the repository.
func New ¶ added in v0.5.0
New returns a Remote implementation that integrates with Gitlab, an open source Git service. See https://gitlab.com
Types ¶
type Gitlab ¶
type Gitlab struct { URL string Client string Secret string Machine string Username string Password string PrivateMode bool SkipVerify bool HideArchives bool Search bool }
func (*Gitlab) Activate ¶
Activate activates a repository by adding a Post-commit hook and a Public Deploy key, if applicable.
func (*Gitlab) Deactivate ¶
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 ¶
ParseHook parses the post-commit hook from the Request body and returns the required data in a standard format.
func (*Gitlab) Netrc ¶
Netrc returns a netrc file capable of authenticating Gitlab requests and cloning Gitlab repositories. The netrc will use the global machine account when configured.
func (*Gitlab) Oauth2Transport ¶
¯\_(ツ)_/¯
func (*Gitlab) Status ¶
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.
type Opts ¶ added in v0.5.0
type Opts struct { URL string // Gogs server url. Client string // Oauth2 client id. Secret string // Oauth2 client secret. Username string // Optional machine account username. Password string // Optional machine account password. PrivateMode bool // Gogs is running in private mode. SkipVerify bool // Skip ssl verification. }
Opts defines configuration options.