Documentation ¶
Index ¶
- Constants
- func GetKeyTitle(rawurl string) (string, error)
- func GetProjectId(r *Gitlab, client *gogitlab.Gitlab, owner, name string) (projectId string, err error)
- func GetUserEmail(client *gogitlab.Gitlab, defaultURL string) (*gogitlab.Gitlab, error)
- func IsAdmin(proj *gogitlab.Project) bool
- func IsRead(proj *gogitlab.Project) bool
- func IsWrite(proj *gogitlab.Project) bool
- func NewClient(url, accessToken string, skipVerify bool) *gogitlab.Gitlab
- 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) GetOpen() bool
- func (g *Gitlab) GetOrgs() []string
- 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) Scope() string
- func (g *Gitlab) Script(user *model.User, repo *model.Repo, build *model.Build) ([]byte, []byte, error)
- func (g *Gitlab) Status(u *model.User, repo *model.Repo, b *model.Build, link string) error
Constants ¶
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 GetUserEmail ¶
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.
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 (*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) 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 ¶
¯\_(ツ)_/¯
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.