Documentation ¶
Index ¶
- func New(opts Opts) (forge.Forge, error)
- type GitLab
- func (g *GitLab) Activate(ctx context.Context, user *model.User, repo *model.Repo, link string) error
- func (g *GitLab) Auth(ctx context.Context, token, _ string) (string, error)
- func (g *GitLab) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error)
- func (g *GitLab) Branches(ctx context.Context, user *model.User, repo *model.Repo, p *model.ListOptions) ([]string, error)
- func (g *GitLab) Deactivate(ctx context.Context, user *model.User, repo *model.Repo, link string) error
- func (g *GitLab) Dir(ctx context.Context, user *model.User, repo *model.Repo, ...) ([]*forge_types.FileMeta, error)
- func (g *GitLab) File(ctx context.Context, user *model.User, repo *model.Repo, ...) ([]byte, error)
- func (g *GitLab) Hook(ctx context.Context, req *http.Request) (*model.Repo, *model.Pipeline, error)
- func (g *GitLab) Login(ctx context.Context, res http.ResponseWriter, req *http.Request) (*model.User, error)
- func (g *GitLab) Name() string
- func (g *GitLab) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)
- func (g *GitLab) Org(ctx context.Context, u *model.User, owner string) (*model.Org, error)
- func (g *GitLab) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error)
- func (g *GitLab) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error)
- func (g *GitLab) Refresh(ctx context.Context, user *model.User) (bool, error)
- func (g *GitLab) Repo(ctx context.Context, user *model.User, remoteID model.ForgeRemoteID, ...) (*model.Repo, error)
- func (g *GitLab) Repos(ctx context.Context, user *model.User) ([]*model.Repo, error)
- func (g *GitLab) Status(ctx context.Context, user *model.User, repo *model.Repo, ...) error
- func (g *GitLab) Teams(ctx context.Context, user *model.User) ([]*model.Team, error)
- func (g *GitLab) URL() string
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GitLab ¶
type GitLab struct { ClientID string ClientSecret string SkipVerify bool HideArchives bool Search bool // contains filtered or unexported fields }
Gitlab implements "Forge" interface
func (*GitLab) Activate ¶
func (g *GitLab) Activate(ctx context.Context, user *model.User, repo *model.Repo, link string) error
Activate activates a repository by adding a Post-commit hook and a Public Deploy key, if applicable.
func (*GitLab) Auth ¶
Auth authenticates the session and returns the forge user login for the given token
func (*GitLab) BranchHead ¶
func (g *GitLab) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (string, error)
BranchHead returns the sha of the head (latest commit) of the specified branch
func (*GitLab) Branches ¶
func (g *GitLab) Branches(ctx context.Context, user *model.User, repo *model.Repo, p *model.ListOptions) ([]string, error)
Branches returns the names of all branches for the named repository.
func (*GitLab) Deactivate ¶
func (g *GitLab) Deactivate(ctx context.Context, 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) Dir ¶
func (g *GitLab) Dir(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, path string) ([]*forge_types.FileMeta, error)
Dir fetches a folder from the forge repository
func (*GitLab) File ¶
func (g *GitLab) File(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, fileName string) ([]byte, error)
File fetches a file from the forge repository and returns in string format.
func (*GitLab) Hook ¶
Hook 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(ctx context.Context, res http.ResponseWriter, req *http.Request) (*model.User, error)
Login authenticates the session and returns the forge user details.
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) OrgMembership ¶
func (g *GitLab) OrgMembership(ctx context.Context, u *model.User, owner string) (*model.OrgPerm, error)
OrgMembership returns if user is member of organization and if user is admin/owner in this organization.
func (*GitLab) PullRequests ¶
func (*GitLab) Refresh ¶
Refresh refreshes the Gitlab oauth2 access token. If the token is refreshed the user is updated and a true value is returned.
func (*GitLab) Repo ¶
func (g *GitLab) Repo(ctx context.Context, user *model.User, remoteID model.ForgeRemoteID, owner, name string) (*model.Repo, error)
Repo fetches the repository from the forge.
func (*GitLab) Status ¶
func (g *GitLab) Status(ctx context.Context, user *model.User, repo *model.Repo, pipeline *model.Pipeline, workflow *model.Workflow) error
Status sends the commit status back to gitlab.