Documentation
¶
Index ¶
- type GitlabProvider
- func (g *GitlabProvider) GetJobTrace(ctx context.Context, project string, jobID int, ...) (string, bool, error)
- func (g *GitlabProvider) GetRepository(ctx context.Context, owner, repo string, settings krci.GitServerSettings) (*models.Repository, error)
- func (g *GitlabProvider) ListBranches(ctx context.Context, owner, repo string, settings krci.GitServerSettings, ...) ([]models.Branch, error)
- func (g *GitlabProvider) ListPipelineJobs(ctx context.Context, project string, pipelineID int, ...) ([]models.PipelineJob, error)
- func (g *GitlabProvider) ListPipelines(ctx context.Context, project string, settings krci.GitServerSettings, ...) (*models.PipelinesResponse, error)
- func (g *GitlabProvider) ListPullRequests(ctx context.Context, owner, repo string, settings krci.GitServerSettings, ...) (*models.PullRequestsResponse, error)
- func (g *GitlabProvider) ListRepositories(ctx context.Context, owner string, settings krci.GitServerSettings, ...) ([]models.Repository, error)
- func (g *GitlabProvider) ListUserOrganizations(ctx context.Context, settings krci.GitServerSettings) ([]models.Organization, error)
- func (g *GitlabProvider) TriggerPipeline(ctx context.Context, project string, ref string, ...) (*models.PipelineResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitlabProvider ¶
type GitlabProvider struct{}
func NewGitlabProvider ¶
func NewGitlabProvider() *GitlabProvider
func (*GitlabProvider) GetJobTrace ¶ added in v0.6.0
func (g *GitlabProvider) GetJobTrace( ctx context.Context, project string, jobID int, settings krci.GitServerSettings, ) (string, bool, error)
GetJobTrace returns the raw trace (log) text of a GitLab CI job and whether it was truncated to maxTraceBytes.
We deliberately bypass go-gitlab's Jobs.GetTraceFile: that helper buffers the entire response into memory (bytes.Buffer) before returning a reader, so an io.LimitReader over its result would cap only the copied string, not the allocation — a multi-hundred-MB log would still be fully resident. Instead we issue the documented GET /projects/:id/jobs/:job_id/trace request and stream resp.Body through an io.LimitReader, so at most maxTraceBytes+1 bytes are ever read off the socket. The extra byte lets us detect truncation authoritatively rather than inferring it from length.
func (*GitlabProvider) GetRepository ¶
func (g *GitlabProvider) GetRepository( ctx context.Context, owner, repo string, settings krci.GitServerSettings, ) (*models.Repository, error)
func (*GitlabProvider) ListBranches ¶
func (g *GitlabProvider) ListBranches( ctx context.Context, owner, repo string, settings krci.GitServerSettings, _ models.ListOptions, ) ([]models.Branch, error)
ListBranches implements BranchesProvider for GitlabService.
func (*GitlabProvider) ListPipelineJobs ¶ added in v0.6.0
func (g *GitlabProvider) ListPipelineJobs( ctx context.Context, project string, pipelineID int, settings krci.GitServerSettings, ) ([]models.PipelineJob, error)
ListPipelineJobs lists the jobs of a GitLab CI pipeline, ordered by job ID ascending. It fetches up to maxJobsTotal jobs using autopagination; a warning is logged if the cap is hit.
func (*GitlabProvider) ListPipelines ¶ added in v0.3.0
func (g *GitlabProvider) ListPipelines( ctx context.Context, project string, settings krci.GitServerSettings, opts models.PipelineListOptions, ) (*models.PipelinesResponse, error)
ListPipelines lists CI/CD pipelines for a GitLab project.
func (*GitlabProvider) ListPullRequests ¶ added in v0.2.0
func (g *GitlabProvider) ListPullRequests( ctx context.Context, owner, repo string, settings krci.GitServerSettings, opts models.PullRequestListOptions, ) (*models.PullRequestsResponse, error)
ListPullRequests returns merge requests for a GitLab project.
func (*GitlabProvider) ListRepositories ¶
func (g *GitlabProvider) ListRepositories( ctx context.Context, owner string, settings krci.GitServerSettings, listOptions models.ListOptions, ) ([]models.Repository, error)
func (*GitlabProvider) ListUserOrganizations ¶
func (g *GitlabProvider) ListUserOrganizations( ctx context.Context, settings krci.GitServerSettings, ) ([]models.Organization, error)
ListUserOrganizations returns organizations for the authenticated user
func (*GitlabProvider) TriggerPipeline ¶ added in v0.2.0
func (g *GitlabProvider) TriggerPipeline( ctx context.Context, project string, ref string, variables []models.PipelineVariable, settings krci.GitServerSettings, ) (*models.PipelineResponse, error)
TriggerPipeline triggers a CI/CD pipeline in GitLab