Turbocharge your GitLab CI/CD workflow in VS Code! Instantly browse, insert, and manage reusable components from any GitLab instanceβpublic or private.
- Component Browser: Explore and insert components from any GitLab project or group
- Smart Completion: Context-aware suggestions for components and versions as you type
- Hover Docs: See full documentation and parameter hints instantly
- Input Validation: Real-time validation of component inputs with intelligent Quick Fix suggestions
- Version/Tag Picker: Always use the right versionβno more guessing
- Variable Expansion: Full support for GitLab CI/CD variables in URLs and parameters
- Lightning Fast: Caching, batch API calls, and performance optimizations for huge catalogs
- Private Access: π Add private projects/groups with a token (per GitLab instance)
- Install: Search "GitLab Component Helper" in VS Code Extensions and click Install
- Browse Components:
Ctrl+Shift+Pβ "GitLab: Browse Components" - Add Project/Group:
Ctrl+Shift+Pβ "GitLab CI: Add Component Project/Group" (add public or private sources, with or without a token) - Insert & Complete: Type
component:in.gitlab-ci.ymland get instant, real versioned suggestions - Hover for Docs: Hover any component URL for instant documentation
Add any private project or group with a personal access tokenβjust once per GitLab instance! The extension will use your token for all future requests to that instance.
Your security matters:
- Tokens are stored securely using VS Code's built-in SecretStorageβnever in plain text or files.
- Tokens are only used for authenticated API calls to your specified GitLab instance and are never sent to third parties.
β οΈ The legacygitlabComponentHelper.gitlabTokensetting stores tokens in plain text insettings.jsonand is deprecated. Use the GitLab CI: Add Component Project/Group command instead β it stores tokens encrypted via SecretStorage. If you still have a token in that setting, copy it through the command and clear the field.
include:
- component: https://gitlab.com/components/terraform@v1.0.0
with:
terraform_version: "1.5.0"
workspace: "default"
apply: trueTo provide consistent context in the Component Browser, you can add spec-compliant header comments at the top of a template file. Only these keys are displayed; all other comments are ignored.
Supported keys (must be at top of file):
summaryusagenote
Full format:
# @gitlab-component-helper: summary: Push a Helm chart to Sonic
# @gitlab-component-helper: usage: include + set SONIC_TARGET_* variables
# @gitlab-component-helper: note: Requires a protected ref for publishShort format:
# @gch: summary: Push a Helm chart to Sonic
# @gch: usage: include + set SONIC_TARGET_* variables
# @gch: note: Requires a protected ref for publishNotes:
- Header comments must appear before any non-comment content.
- Multiple
noteentries are supported. - If no header is present, the Context section stays hidden.
Component details include a Raw YAML toggle so you can inspect the original template when needed. This is available regardless of whether header comments are present.
Add your favorite sources in VS Code settings:
"gitlabComponentHelper.componentSources": [
{
"name": "OpenTofu Components",
"path": "components/opentofu",
"gitlabInstance": "gitlab.com"
},
{
"name": "Internal CI Components",
"path": "devops/ci-components",
"gitlabInstance": "gitlab.company.com"
}
]By default the extension follows the GitLab CI Components spec when scanning a source repository β it looks for templates in templates/ and one subdirectory level deep, matching *.yml and *.yaml. No configuration is required for spec-compliant repos.
For repositories that pre-date the spec, use a custom directory layout, or store templates outside templates/, you can override discovery behavior either globally or per source.
These four settings are also editable from the VS Code Settings UI (search for "GitLab Component Helper Discovery").
Need different rules for one repository? Add a discovery block to that source β its values override the global defaults for that source only.
"gitlabComponentHelper.componentSources": [
{
"name": "Standard CI Components",
"path": "components/opentofu",
"gitlabInstance": "gitlab.com"
// uses global discovery defaults
},
{
"name": "Legacy Internal Components",
"path": "infra/legacy-ci",
"gitlabInstance": "gitlab.company.com",
"discovery": {
"templateRoots": ["ci/components", "shared/pipelines"],
"maxDepth": 2
}
}
]To keep the extension fast and predictable:
| Field | Limit |
|---|---|
templateRoots |
Up to 5 roots per source |
maxDepth |
0β3 (0 = root only, 1 = one subdirectory level, the spec default) |
filePatterns |
Filename globs only β no path globs (e.g. *.yml β
, foo/*.yml β) |
templateFileNames |
Filenames only β no slashes |
- GitLab CI: Browse Components β Explore and insert from all your sources
- GitLab CI: Add Component Project/Group β Add any project/group (with optional token for private access)
- GitLab CI: Refresh Component Cache β Refreshes cached data
- GitLab CI: Show Cache Status β See cache info and stats
Component browser not showing components?
- Check file language mode is set to YAML
- Verify component sources are configured
Version dropdown not loading?
- Check network connectivity to GitLab instance
- Verify project permissions and access tokens
- Review cache status and refresh if needed
If you encounter issues:
- Enable debug output and check for error messages
- Verify your configuration matches the examples above
- Test with a simple, known-working component source
- Submit an issue with debug output and configuration details
The extension exposes the following API for other extensions to consume:
interface GitLabComponentAPI {
getComponentList(): Promise<Component[]>;
getComponentDetails(name: string, version?: string): Promise<ComponentDetails>;
validateComponent(component: Component): ValidationResult;
expandGitLabVariables(text: string, context?: VariableContext): string;
openComponentBrowser(context?: ComponentContext): Promise<void>;
}
interface Component {
name: string;
description: string;
parameters: ComponentParameter[];
version?: string;
source?: string;
gitlabInstance?: string;
sourcePath?: string;
availableVersions?: string[];
originalUrl?: string;
}
interface ComponentParameter {
name: string;
description?: string;
required: boolean;
type?: string;
default?: any;
}Access through:
const api = await vscode.extensions.getExtension('username.gitlab-component-helper')?.activate();
if (api) {
const components = await api.getComponentList();
// Use components...
}Prerequisites:
- VSCode 1.102.0 or higher
- Node.js 22.x or higher
- Yarn or npm
Setup:
git clone https://github.com/username/gitlab-component-helper.git
cd gitlab-component-helper
yarn install # or npm installBuild:
yarn compile # or npm run compileDebug:
- Open the project in VSCode
- Press F5 to start debugging
- A new VSCode window will open with the extension loaded
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using conventional commits:
feat:for new featuresfix:for bug fixesdocs:for documentation changeschore:for maintenance tasks
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project uses semantic-release for automated versioning and releases. When your PR is merged to main:
- Version is automatically bumped based on commit messages
- CHANGELOG.md is updated
- GitHub release is created with packaged extension
- No manual versioning needed!
See SEMANTIC_RELEASE.md for more details.
Distributed under the MIT License. See LICENSE for more information.
The following settings are available for the GitLab Component Helper extension. Add these to your VS Code settings.json or configure via the Settings UI:
| Setting | Type | Default | Description |
|---|---|---|---|
gitlabComponentHelper.componentSource |
string | local |
Source for component definitions. One of: local, gitlab, url |
gitlabComponentHelper.gitlabUrl |
string | https://gitlab.com |
GitLab instance URL |
gitlabComponentHelper.gitlabProjectId |
string | "" |
GitLab project ID containing component definitions |
gitlabComponentHelper.gitlabToken |
string | "" |
|
gitlabComponentHelper.gitlabComponentsFilePath |
string | components.json |
Path to components JSON file in GitLab repository |
gitlabComponentHelper.componentsUrl |
string | "" |
URL to a JSON file containing component definitions |
gitlabComponentHelper.cacheTime |
number | 3600 |
Cache time for components in seconds |
gitlabComponentHelper.logLevel |
string | ERROR |
Logging level for component service. One of: DEBUG, INFO, WARN, ERROR |
gitlabComponentHelper.autoShowOutput |
boolean | false |
Automatically show output channel when log level changes |
gitlabComponentHelper.httpTimeout |
number | 10000 |
HTTP request timeout in milliseconds |
gitlabComponentHelper.retryAttempts |
number | 3 |
Number of retry attempts for failed HTTP requests |
gitlabComponentHelper.batchSize |
number | 5 |
Number of components to process in parallel batches |
gitlabComponentHelper.componentSources |
array | See below | GitLab repositories containing reusable CI/CD components. Each item supports an optional discovery block to override the global discovery defaults for that source. |
gitlabComponentHelper.discovery.templateRoots |
array | ["templates"] |
Repository directories scanned for components. Up to 5 entries. |
gitlabComponentHelper.discovery.maxDepth |
number | 1 |
Subdirectory depth to recurse under each root. Range 0β3. |
gitlabComponentHelper.discovery.filePatterns |
array | ["*.yml", "*.yaml"] |
Filename globs identifying component template files. Filename only β no path globs. |
gitlabComponentHelper.discovery.templateFileNames |
array | ["template.yml", "template.yaml"] |
Filenames recognised inside per-component subfolders (e.g. templates/foo/template.yml). |
"gitlabComponentHelper.componentSources": [
{
"name": "GitLab CI Examples",
"path": "gitlab-org/gitlab-foss",
"gitlabInstance": "gitlab.com"
},
{
"name": "OpenTofu Components",
"path": "components/opentofu",
"gitlabInstance": "gitlab.com"
}
]For more details on each setting, see the extension's package.json or the VS Code Settings UI.




