GitLab CI (gitlab-ci-local)
Run GitLab CI/CD pipeline jobs locally using gitlab-ci-local. Workspace Tasks discovers your .gitlab-ci.yml files and exposes each job as a runnable task โ without pushing to GitLab.
Table of Contents
- Overview
- Requirements
- Features
- Configuration
- Custom File Patterns
- Variables
- Home
- Windows Support
- See Also
New in v1.9.0: GitLab CI support.
Overview
Workspace Tasks automatically discovers .gitlab-ci.yml files in your workspace and uses gitlab-ci-local --list-json to enumerate available jobs. Each CI file appears as a collapsible parent item with its jobs listed as children.
Jobs with when: never are automatically filtered from the task tree โ they are intentionally disabled and are never runnable.
Task Tree Structure
.gitlab-ci.yml
โโโ npm-install โ (stage: build)
โโโ npm-outdated โ (stage: test)
โโโ docker-compose-up โ (stage: deploy)
โโโ docker-compose-down โ (stage: .post, manual)
โโโ always-cleanup โ (stage: .post, always)
โโโ notify-failure โ (stage: .post, on_failure)
Requirements
- gitlab-ci-local โ Must be installed on your system (
npm install -g gitlab-ci-local) - Docker โ Must be running (gitlab-ci-local uses containers for most jobs)
- Configure
workspaceTasks.applicationPath.gitlabCiLocalifgitlab-ci-localis not in your systemPATH
Note: This task type is disabled by default because it requires both Docker and an external tool. Enable it via
workspaceTasks.enabledTaskTypes.
Features
- Automatic Discovery โ Scans
**/.gitlab-ci.ymlacross the workspace - Custom File Patterns โ Additional glob patterns via
gitlabCiLocal.additionalFilePatterns - Job Filtering โ Jobs with
when: neverare automatically hidden - Stage Labels โ Each job shows its pipeline stage as a description
- Rich Tooltips โ Stage, when condition, allow_failure, and needs are shown in hover tooltips
- Variable Support โ Pass CI/CD variables via
gitlabCiLocal.variableor a variables file - Multi-root Support โ Works correctly in multi-root workspaces
Configuration
Configure GitLab CI Local in your VS Code settings.json:
{
"workspaceTasks.enabledTaskTypes": {
"gitlab-ci": true
},
"workspaceTasks.applicationPath.gitlabCiLocal": "gitlab-ci-local",
"workspaceTasks.gitlabCiLocal.variablesFile": ".variables.yml",
"workspaceTasks.gitlabCiLocal.variable": [
"DEPLOY_ENV=staging"
]
}
Available Settings
| Setting | Type | Default | Description |
|---|---|---|---|
workspaceTasks.applicationPath.gitlabCiLocal | string | "gitlab-ci-local" | Path to the gitlab-ci-local executable |
workspaceTasks.gitlabCiLocal.additionalFilePatterns | string[] | [] | Extra glob patterns for non-standard CI file locations |
workspaceTasks.gitlabCiLocal.variablesFile | string | "" | Path to a YAML variables file (--variables-file) |
workspaceTasks.gitlabCiLocal.variable | string[] | [] | Array of KEY=VALUE variables (--variable) |
workspaceTasks.gitlabCiLocal.unsetVariable | string[] | [] | Variable names to unset (--unset-variable) |
workspaceTasks.gitlabCiLocal.remoteVariables | string[] | [] | Remote variable sources (--remote-variables) |
workspaceTasks.gitlabCiLocal.home | string | "" | Override home directory (--home) |
Custom File Patterns
By default, the extension discovers all **/.gitlab-ci.yml files. To include CI files with non-standard names, add extra glob patterns:
{
"workspaceTasks.gitlabCiLocal.additionalFilePatterns": [
"**/.gitlab-ci.staging.yml",
"**/ci/pipeline.yml"
]
}
These patterns are merged with the built-in **/.gitlab-ci.yml pattern.
Variables
Inline Variables
Pass variables directly in settings:
{
"workspaceTasks.gitlabCiLocal.variable": [
"DEPLOY_ENV=staging",
"APP_VERSION=1.2.3"
]
}
Variables File
Point to a YAML file containing variables:
{
"workspaceTasks.gitlabCiLocal.variablesFile": ".local-variables.yml"
}
Example .local-variables.yml:
DEPLOY_ENV: staging
APP_VERSION: 1.2.3
Home
Override the home directory used by gitlab-ci-local:
{
"workspaceTasks.gitlabCiLocal.home": "/custom/home"
}
Windows Support
gitlab-ci-local is not supported on Windows. This task type will not produce any tasks when running on Windows.