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 NewClient(url, accessToken string, skipVerify bool) *client.Client
- type Gitlab
- func (g *Gitlab) Activate(user *model.User, repo *model.Repo, k *model.Key, 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, bool, 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
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.
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 (*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 that can be used to clone private repositories from a remote system.
func (*Gitlab) Oauth2Transport ¶
¯\_(ツ)_/¯