deployments

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package deployments implements MCP tool handlers for GitLab deployment operations including list, get, create, update, and delete. It wraps the Deployments service from client-go v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func FormatOutputMarkdown(d Output) string

FormatOutputMarkdown renders a single deployment as Markdown.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlab.Client)

RegisterTools registers the five deployment management tools with the MCP server.

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"`
}

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 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               `json:"order_by,omitempty"     jsonschema:"Order by id or iid or created_at or updated_at or finished_at or ref (default: id)"`
	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"`
	toolutil.PaginationInput
}

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"`
	UserName        string `json:"user_name,omitempty"`
	EnvironmentName string `json:"environment_name,omitempty"`
	CreatedAt       string `json:"created_at,omitempty"`
	UpdatedAt       string `json:"updated_at,omitempty"`
}

Output represents a single deployment in MCP responses.

func Create

func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)

Create creates resources for the deployments package.

func Get

func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

Get retrieves 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL