summaryrefslogtreecommitdiff
path: root/servers/gitlab_glab/README.md
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-05-28 15:44:40 +0200
committerDawid Rycerz <dawid@rycerz.xyz>2025-05-28 15:44:40 +0200
commit54b521f19e00bea52304f7379ca59de0c2e20962 (patch)
treed28ecbe7dbd59a5d400f52cd7345ed0f5ec66476 /servers/gitlab_glab/README.md
parent0b819edceb307ce2f8ba6d58b37a86329b7d6ec0 (diff)
feat(gitlab_glab): add CI pipeline functionality with glab ci run
- Add new run_ci_pipeline method to GitLabServer class - Support all glab ci run options including variables, branch, and web mode - Auto-detect current branch using git branch --show-current when -b is missing - Implement web mode that overrides CI_PIPELINE_SOURCE=web - Add comprehensive test coverage with 9 new test cases - Update README.md with complete documentation and usage examples - Maintain 95% test coverage and pass all 53 tests - Follow project standards with proper error handling and type hints Closes: Add CI job runner functionality as requested
Diffstat (limited to 'servers/gitlab_glab/README.md')
-rw-r--r--servers/gitlab_glab/README.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/servers/gitlab_glab/README.md b/servers/gitlab_glab/README.md
index a2bb677..19b6cd7 100644
--- a/servers/gitlab_glab/README.md
+++ b/servers/gitlab_glab/README.md
@@ -9,6 +9,7 @@ This MCP server provides integration with GitLab through the GitLab CLI (`glab`)
- Search for GitLab issues with various filters
- Create new GitLab issues
- Get merge request diffs with automatic handling of large diffs
+- Run CI/CD pipelines with support for variables and web mode
- More features to be added in the future
## Prerequisites
@@ -179,6 +180,40 @@ The function returns a dictionary containing:
**Note on Large Diffs**: To prevent overwhelming LLMs with extremely large diffs, this tool automatically saves diffs larger than `max_size_kb` (default: 100KB) to a temporary file and returns the file path instead of the content. This allows you to process large merge request diffs without hitting token limits.
+### run_ci_pipeline
+
+Run a CI/CD pipeline on GitLab using `glab ci run`.
+
+```python
+result = use_mcp_tool(
+ server_name="gitlab_glab",
+ tool_name="run_ci_pipeline",
+ arguments={
+ "working_directory": "/path/to/current/directory",
+ # Optional parameters
+ "branch": "main", # Branch/ref to run pipeline on (if None, uses current branch)
+ "variables": ["VAR1:value1", "VAR2:value2"], # Variables in key:value format
+ "variables_env": ["ENV1:envval1"], # Environment variables in key:value format
+ "variables_file": ["FILE1:file1.txt"], # File variables in key:filename format
+ "variables_from": "/path/to/vars.json", # JSON file containing variables
+ "web_mode": True, # Enable web mode (sets CI_PIPELINE_SOURCE=web)
+ "repo": "group/project" # Project path with namespace
+ }
+)
+```
+
+The function returns a dictionary containing:
+- `success`: Boolean indicating if the pipeline was created successfully
+- `output`: The full command output from glab
+- `branch`: The branch the pipeline was created on
+- `web_mode`: Boolean indicating if web mode was used
+- `pipeline_url`: The URL of the created pipeline (if found in output)
+- `error`: Error message if the operation failed
+
+**Branch Detection**: If no `branch` is specified, the tool will automatically detect the current git branch using `git branch --show-current`. If branch detection fails, the pipeline will be created without specifying a branch (uses GitLab's default behavior).
+
+**Web Mode**: When `web_mode` is set to `True`, the tool adds `CI_PIPELINE_SOURCE:web` as an environment variable, which allows the pipeline to run with web-triggered behavior and access to manual pipeline features.
+
## Working Directory Context
All tools require a `working_directory` parameter that specifies the directory context in which the GitLab CLI commands should be executed. This ensures that commands are run in the same directory as the agent, maintaining proper context for repository operations.