Documentation
¶
Overview ¶
Package deployments implements MCP tools for GitLab deployment operations.
The package wraps the GitLab Deployments API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatApproveOrRejectMarkdown(o ApproveOrRejectOutput) string
- func FormatListMarkdown(out ListOutput) string
- func FormatOutputMarkdown(d Output) string
- type ApproveOrRejectInput
- type ApproveOrRejectOutput
- type CreateInput
- type DeleteInput
- type DeployableCommitOutput
- type DeployableOutput
- type DeployablePipelineOutput
- type DeployableProjectOutput
- type DeployableRunnerOutput
- type DeployableUserOutput
- type EnvironmentOutput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- type UpdateInput
- type UserOutput
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 deployment actions.
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete deletes resources for the deployments package.
func FormatApproveOrRejectMarkdown ¶
func FormatApproveOrRejectMarkdown(o ApproveOrRejectOutput) string
FormatApproveOrRejectMarkdown renders the approve/reject result as Markdown.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a paginated list of deployments as a Markdown table.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders a single deployment as Markdown.
Types ¶
type ApproveOrRejectInput ¶
type ApproveOrRejectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
DeploymentID int `json:"deployment_id" jsonschema:"Deployment ID,required"`
Status string `json:"status" jsonschema:"Approval status: approved or rejected,required"`
Comment string `json:"comment,omitempty" jsonschema:"Optional comment for the approval or rejection"`
RepresentedAs string `` /* 130-byte string literal not displayed */
}
ApproveOrRejectInput defines parameters for approving or rejecting a blocked deployment.
type ApproveOrRejectOutput ¶
type ApproveOrRejectOutput struct {
toolutil.HintableOutput
Message string `json:"message"`
}
ApproveOrRejectOutput represents the result of approving or rejecting a deployment.
func ApproveOrReject ¶
func ApproveOrReject(ctx context.Context, client *gitlabclient.Client, input ApproveOrRejectInput) (ApproveOrRejectOutput, error)
ApproveOrReject approves or rejects a blocked deployment.
type CreateInput ¶
type CreateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Environment string `json:"environment" jsonschema:"Name of the environment to deploy to,required"`
Ref string `json:"ref" jsonschema:"Git branch or tag to deploy,required"`
SHA string `json:"sha" jsonschema:"Git SHA to deploy,required"`
Tag *bool `json:"tag,omitempty" jsonschema:"Whether the ref is a tag (default: false)"`
Status string `json:"status,omitempty" jsonschema:"Deployment status: created or running or success or failed or canceled"`
}
CreateInput contains parameters for creating a deployment.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
DeploymentID int `json:"deployment_id" jsonschema:"Deployment ID,required"`
}
DeleteInput contains parameters for deleting a deployment.
type DeployableCommitOutput ¶ added in v2.3.0
type DeployableCommitOutput struct {
ID string `json:"id"`
ShortID string `json:"short_id,omitempty"`
Title string `json:"title,omitempty"`
AuthorName string `json:"author_name,omitempty"`
AuthorEmail string `json:"author_email,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Message string `json:"message,omitempty"`
}
DeployableCommitOutput is the documented reference subset of the deployable (CI job) commit object (sourced from gl.Commit). The API documents id, short_id, title, author_name, author_email, created_at, and message. Documented reference subset per doc/api/deployments.md.
type DeployableOutput ¶ added in v2.3.0
type DeployableOutput struct {
ID int64 `json:"id"`
Status string `json:"status,omitempty"`
Stage string `json:"stage,omitempty"`
Name string `json:"name,omitempty"`
Ref string `json:"ref,omitempty"`
Tag bool `json:"tag,omitempty"`
Coverage float64 `json:"coverage,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
StartedAt string `json:"started_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
Project *DeployableProjectOutput `json:"project,omitempty"`
User *DeployableUserOutput `json:"user,omitempty"`
Commit *DeployableCommitOutput `json:"commit,omitempty"`
Pipeline *DeployablePipelineOutput `json:"pipeline,omitempty"`
Runner *DeployableRunnerOutput `json:"runner,omitempty"`
}
DeployableOutput is the documented reference subset of gl.DeploymentDeployable (the CI job backing a deployment), including its nested user, commit, pipeline, runner, and project objects. The API documents id, status, stage, name, ref, tag, coverage, created_at, started_at, finished_at, plus the nested objects; the SDK's duration field is not documented and is not surfaced. The documented deployable.project object ({ci_job_token_scope_enabled}) has no counterpart on the SDK struct (gl.DeploymentDeployable.Project does not exist) and is therefore surfaced through a raw REST superset fetch. Documented reference subset per doc/api/deployments.md.
type DeployablePipelineOutput ¶ added in v2.3.0
type DeployablePipelineOutput struct {
ID int64 `json:"id"`
SHA string `json:"sha,omitempty"`
Ref string `json:"ref,omitempty"`
Status string `json:"status,omitempty"`
WebURL string `json:"web_url,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
DeployablePipelineOutput is the documented reference subset of the deployable (CI job) pipeline object (sourced from gl.DeploymentDeployablePipeline). The API documents created_at, id, ref, sha, status, updated_at, and web_url. Documented reference subset per doc/api/deployments.md.
type DeployableProjectOutput ¶ added in v2.3.0
type DeployableProjectOutput struct {
CIJobTokenScopeEnabled bool `json:"ci_job_token_scope_enabled"`
}
DeployableProjectOutput is the documented reference subset of the deployable (CI job) project object. The Deployments API documents a single field on this object, ci_job_token_scope_enabled, indicating whether the project's CI/CD job token scope is enabled. gl.DeploymentDeployable has no Project field, so this is surfaced via a raw REST fetch (see rawGetDeployment/rawListDeployments). Documented reference subset per doc/api/deployments.md.
type DeployableRunnerOutput ¶ added in v2.3.0
type DeployableRunnerOutput struct {
ID int64 `json:"id"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
RunnerType string `json:"runner_type,omitempty"`
Status string `json:"status,omitempty"`
Online bool `json:"online,omitempty"`
Paused bool `json:"paused,omitempty"`
}
DeployableRunnerOutput is the documented reference subset of the deployable (CI job) runner object (sourced from gl.Runner). The API documents the runner key on the deployable but only ever shows a null value, so this keeps the minimal runner identity fields surfaced when a runner is present. Documented reference subset per doc/api/deployments.md.
type DeployableUserOutput ¶ added in v2.3.0
type DeployableUserOutput struct {
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state,omitempty"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Bio string `json:"bio,omitempty"`
Location string `json:"location,omitempty"`
PublicEmail string `json:"public_email,omitempty"`
Linkedin string `json:"linkedin,omitempty"`
Twitter string `json:"twitter,omitempty"`
WebsiteURL string `json:"website_url,omitempty"`
Organization string `json:"organization,omitempty"`
}
DeployableUserOutput is the documented reference subset of the deployable (CI job) user object (sourced from gl.User). The API documents the richer user payload here (profile fields such as bio, location, and the social links). Documented reference subset per doc/api/deployments.md.
type EnvironmentOutput ¶ added in v2.3.0
type EnvironmentOutput struct {
ID int64 `json:"id"`
Name string `json:"name"`
ExternalURL string `json:"external_url,omitempty"`
}
EnvironmentOutput is the documented reference subset of the deployment's environment object (sourced from gl.Environment). The API documents only id, name, and external_url on the deployment environment; the SDK's remaining scalars and back-references are intentionally not surfaced. Documented reference subset per doc/api/deployments.md.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
DeploymentID int `json:"deployment_id" jsonschema:"Deployment ID,required"`
}
GetInput contains parameters for retrieving a single deployment.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
OrderBy string `` /* 128-byte string literal not displayed */
Sort string `json:"sort,omitempty" jsonschema:"Sort order: asc or desc (default: asc)"`
Environment string `json:"environment,omitempty" jsonschema:"Filter by environment name"`
Status string `json:"status,omitempty" jsonschema:"Filter by status: created or running or success or failed or canceled"`
UpdatedAfter string `json:"updated_after,omitempty" jsonschema:"Return deployments updated after this RFC3339 timestamp (GitLab < 14 only)"`
UpdatedBefore string `json:"updated_before,omitempty" jsonschema:"Return deployments updated before this RFC3339 timestamp (GitLab < 14 only)"`
FinishedAfter string `json:"finished_after,omitempty" jsonschema:"Return deployments finished after this RFC3339 timestamp (GitLab 14+ only)"`
FinishedBefore string `json:"finished_before,omitempty" jsonschema:"Return deployments finished before this RFC3339 timestamp (GitLab 14+ only)"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput contains parameters for listing project deployments.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Deployments []Output `json:"deployments"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput represents a paginated list of deployments.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List lists resources for the deployments package.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int `json:"id"`
IID int `json:"iid"`
Ref string `json:"ref"`
SHA string `json:"sha"`
Status string `json:"status"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
User *UserOutput `json:"user,omitempty"`
Environment *EnvironmentOutput `json:"environment,omitempty"`
Deployable *DeployableOutput `json:"deployable,omitempty"`
}
Output represents a single deployment in MCP responses, reconciled 1:1 with the documented Deployments API response (doc/api/deployments.md). The nested user, environment, and deployable objects are documented reference subsets of the corresponding gl.Deployment sub-objects.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates resources for the deployments package.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update updates resources for the deployments package.
type UpdateInput ¶
type UpdateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
DeploymentID int `json:"deployment_id" jsonschema:"Deployment ID,required"`
Status string `json:"status" jsonschema:"New deployment status: created or running or success or failed or canceled,required"`
}
UpdateInput contains parameters for updating a deployment status.
type UserOutput ¶ added in v2.3.0
type UserOutput struct {
ID int64 `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
State string `json:"state"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url,omitempty"`
}
UserOutput is the documented reference subset of the deployment-level user object (sourced from gl.ProjectUser). Documented reference subset per doc/api/deployments.md.