Documentation
¶
Overview ¶
Package resourcegroups implements MCP tools for GitLab CI/CD resource group operations.
The package wraps the GitLab Resource groups API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func FormatCurrentJobMarkdown(out CurrentJobOutput) string
- func FormatGroupMarkdown(g ResourceGroupItem) string
- func FormatJobsMarkdown(out ListUpcomingJobsOutput) string
- func FormatListMarkdown(out ListOutput) string
- type CurrentJobInput
- type CurrentJobOutput
- type EditInput
- type GetInput
- type JobItem
- type JobPipelineItem
- type ListInput
- type ListOutput
- type ListUpcomingJobsInput
- type ListUpcomingJobsOutput
- type ResourceGroupItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionSpecs ¶
func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
ActionSpecs returns canonical specs for resource group actions.
func FormatCurrentJobMarkdown ¶ added in v3.3.0
func FormatCurrentJobMarkdown(out CurrentJobOutput) string
FormatCurrentJobMarkdown renders the job holding a resource group's lock as the card of one job, or says that no job holds it when GitLab named none. The row leaves a job's timing and user to job.get, which the first hint names.
func FormatGroupMarkdown ¶
func FormatGroupMarkdown(g ResourceGroupItem) string
FormatGroupMarkdown renders one resource group as the card of a single object.
func FormatJobsMarkdown ¶
func FormatJobsMarkdown(out ListUpcomingJobsOutput) string
FormatJobsMarkdown renders the jobs waiting on a resource group as a Markdown table.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a project's resource groups as a Markdown table.
The two next steps are named separately: reading one group and changing its process mode are different actions, and one hint offering both named a tool that only reads.
Types ¶
type CurrentJobInput ¶ added in v3.3.0
type CurrentJobInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Key string `json:"key" jsonschema:"Resource group key,required"`
}
CurrentJobInput defines parameters for reading the job that holds a resource group's lock.
type CurrentJobOutput ¶ added in v3.3.0
type CurrentJobOutput struct {
toolutil.HintableOutput
Job *JobItem `json:"job,omitempty"`
}
CurrentJobOutput is the job holding a resource group's lock, in the row the group's queue uses, or no job when none holds it. GitLab answers that case with a 200 whose body is null: Ci::ResourceGroup#current_processable finds no resource with a job, and Grape renders the nil it presents as null.
func CurrentJob ¶ added in v3.3.0
func CurrentJob(ctx context.Context, client *gitlabclient.Client, input CurrentJobInput) (CurrentJobOutput, error)
CurrentJob reads the job that holds a resource group's lock (GET /projects/:id/resource_groups/:key/current_job), a route GitLab added in 18.6.
type EditInput ¶
type EditInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Key string `json:"key" jsonschema:"Resource group key,required"`
ProcessMode string `json:"process_mode" jsonschema:"Process mode: unordered, oldest_first, newest_first, or newest_ready_first,required"`
}
EditInput defines parameters for the edit operation.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Key string `json:"key" jsonschema:"Resource group key,required"`
}
GetInput defines parameters for the get operation.
type JobItem ¶
type JobItem struct {
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Stage string `json:"stage"`
Ref string `json:"ref,omitempty"`
Tag bool `json:"tag,omitempty"`
AllowFailure bool `json:"allow_failure,omitempty"`
Pipeline *JobPipelineItem `json:"pipeline,omitempty"`
WebURL string `json:"web_url,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
JobItem is one job waiting on a resource group, as a compact row: what the job is, where it comes from and whether its failure would block the pipeline. GitLab answers the queue with Ci::JobBasic, whose other keys are job.get's: the commit, the project and the user, and the fields of a run (its start and finish, duration, coverage and failure reason), which a job that has not run yet leaves empty.
type JobPipelineItem ¶ added in v3.1.0
type JobPipelineItem struct {
ID int64 `json:"id"`
IID int64 `json:"iid,omitempty"`
ProjectID int64 `json:"project_id"`
Ref string `json:"ref"`
SHA string `json:"sha"`
Status string `json:"status"`
Source string `json:"source,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
JobPipelineItem is the pipeline a waiting job belongs to, as the job renders it (Entities::Ci::PipelineBasic): the pipeline's ID, number and project, the ref and commit it runs for, its status and what started it, when it was created and last changed, and its page. The first five are what client-go's JobPipeline models; the rest are read from the captured response (see [upcomingJobExtra]).
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
toolutil.PaginationInput
}
ListInput defines parameters for the list operation, and the page of the project's resource groups to list. client-go's GetAllResourceGroupsForAProject takes no options struct, so the page travels as a request option.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Groups []ResourceGroupItem `json:"groups"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput represents one page of a project's resource groups and the pagination GitLab sent with it.
func ListAll ¶
func ListAll(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
ListAll lists one page of a project's resource groups.
type ListUpcomingJobsInput ¶
type ListUpcomingJobsInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Key string `json:"key" jsonschema:"Resource group key,required"`
toolutil.PaginationInput
}
ListUpcomingJobsInput defines parameters for the list upcoming jobs operation, and the page of those jobs to list. client-go's ListUpcomingJobsForASpecificResourceGroup takes no options struct, so the page travels as a request option.
type ListUpcomingJobsOutput ¶
type ListUpcomingJobsOutput struct {
toolutil.HintableOutput
Jobs []JobItem `json:"jobs"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListUpcomingJobsOutput represents one page of the jobs waiting on a resource group and the pagination GitLab sent with it.
func ListUpcomingJobs ¶
func ListUpcomingJobs(ctx context.Context, client *gitlabclient.Client, input ListUpcomingJobsInput) (ListUpcomingJobsOutput, error)
ListUpcomingJobs lists one page of the jobs waiting on a resource group.
type ResourceGroupItem ¶
type ResourceGroupItem struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Key string `json:"key"`
ProcessMode string `json:"process_mode"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
ResourceGroupItem is a CI resource group as GitLab renders it (Entities::Ci::ResourceGroup): its key, the process mode that serializes the jobs sharing it, and when it was created and last changed.
func Edit ¶
func Edit(ctx context.Context, client *gitlabclient.Client, input EditInput) (ResourceGroupItem, error)
Edit edits resources for the resourcegroups package.
func Get ¶
func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (ResourceGroupItem, error)
Get retrieves resources for the resourcegroups package.