gitlab-catalog-browser 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/bin/gitlab-ci-cli.js +29 -0
  4. package/dist/api/catalog.d.ts +38 -0
  5. package/dist/api/catalog.d.ts.map +1 -0
  6. package/dist/api/catalog.js +72 -0
  7. package/dist/api/catalog.js.map +1 -0
  8. package/dist/api/gitlab.d.ts +69 -0
  9. package/dist/api/gitlab.d.ts.map +1 -0
  10. package/dist/api/gitlab.js +226 -0
  11. package/dist/api/gitlab.js.map +1 -0
  12. package/dist/api/lint.d.ts +61 -0
  13. package/dist/api/lint.d.ts.map +1 -0
  14. package/dist/api/lint.js +41 -0
  15. package/dist/api/lint.js.map +1 -0
  16. package/dist/cache/schema-cache.d.ts +54 -0
  17. package/dist/cache/schema-cache.d.ts.map +1 -0
  18. package/dist/cache/schema-cache.js +124 -0
  19. package/dist/cache/schema-cache.js.map +1 -0
  20. package/dist/commands/batch.d.ts +19 -0
  21. package/dist/commands/batch.d.ts.map +1 -0
  22. package/dist/commands/batch.js +174 -0
  23. package/dist/commands/batch.js.map +1 -0
  24. package/dist/commands/catalog.d.ts +42 -0
  25. package/dist/commands/catalog.d.ts.map +1 -0
  26. package/dist/commands/catalog.js +158 -0
  27. package/dist/commands/catalog.js.map +1 -0
  28. package/dist/commands/component.d.ts +46 -0
  29. package/dist/commands/component.d.ts.map +1 -0
  30. package/dist/commands/component.js +213 -0
  31. package/dist/commands/component.js.map +1 -0
  32. package/dist/commands/pipeline.d.ts +61 -0
  33. package/dist/commands/pipeline.d.ts.map +1 -0
  34. package/dist/commands/pipeline.js +880 -0
  35. package/dist/commands/pipeline.js.map +1 -0
  36. package/dist/commands/setup.d.ts +119 -0
  37. package/dist/commands/setup.d.ts.map +1 -0
  38. package/dist/commands/setup.js +391 -0
  39. package/dist/commands/setup.js.map +1 -0
  40. package/dist/commands/skills.d.ts +39 -0
  41. package/dist/commands/skills.d.ts.map +1 -0
  42. package/dist/commands/skills.js +208 -0
  43. package/dist/commands/skills.js.map +1 -0
  44. package/dist/commands/validate.d.ts +27 -0
  45. package/dist/commands/validate.d.ts.map +1 -0
  46. package/dist/commands/validate.js +201 -0
  47. package/dist/commands/validate.js.map +1 -0
  48. package/dist/config/loader.d.ts +80 -0
  49. package/dist/config/loader.d.ts.map +1 -0
  50. package/dist/config/loader.js +217 -0
  51. package/dist/config/loader.js.map +1 -0
  52. package/dist/config/types.d.ts +46 -0
  53. package/dist/config/types.d.ts.map +1 -0
  54. package/dist/config/types.js +45 -0
  55. package/dist/config/types.js.map +1 -0
  56. package/dist/index.d.ts +10 -0
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +437 -0
  59. package/dist/index.js.map +1 -0
  60. package/dist/output/table.d.ts +28 -0
  61. package/dist/output/table.d.ts.map +1 -0
  62. package/dist/output/table.js +67 -0
  63. package/dist/output/table.js.map +1 -0
  64. package/dist/types/api.d.ts +66 -0
  65. package/dist/types/api.d.ts.map +1 -0
  66. package/dist/types/api.js +61 -0
  67. package/dist/types/api.js.map +1 -0
  68. package/dist/types/catalog.d.ts +77 -0
  69. package/dist/types/catalog.d.ts.map +1 -0
  70. package/dist/types/catalog.js +5 -0
  71. package/dist/types/catalog.js.map +1 -0
  72. package/package.json +60 -0
  73. package/skill-data/core/reference.md +127 -0
  74. package/skill-data/core/templates.md +97 -0
  75. package/skill-data/core/workflows.md +84 -0
  76. package/skill-data/manifest.json +12 -0
  77. package/skill-data/templates/basic-pipeline.yml +29 -0
  78. package/skill-data/templates/docker-build.yml +38 -0
  79. package/skill-data/templates/multi-stage.yml +43 -0
  80. package/skills/gitlab-catalog-browser/SKILL.md +49 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Shared API response and error types for GitLab API interactions.
3
+ */
4
+ // ──────────────────────────────────────────────
5
+ // API Error classes
6
+ // ──────────────────────────────────────────────
7
+ export class GitLabApiError extends Error {
8
+ statusCode;
9
+ code;
10
+ constructor(message, statusCode, code) {
11
+ super(message);
12
+ this.statusCode = statusCode;
13
+ this.code = code;
14
+ this.name = 'GitLabApiError';
15
+ }
16
+ }
17
+ export class AuthenticationError extends GitLabApiError {
18
+ constructor(message = 'Authentication failed — token may be expired or invalid') {
19
+ super(message, 401, 'AUTHENTICATION_FAILED');
20
+ this.name = 'AuthenticationError';
21
+ }
22
+ }
23
+ export class PermissionError extends GitLabApiError {
24
+ constructor(message = 'Insufficient permissions for this resource') {
25
+ super(message, 403, 'PERMISSION_DENIED');
26
+ this.name = 'PermissionError';
27
+ }
28
+ }
29
+ export class NotFoundError extends GitLabApiError {
30
+ constructor(resource) {
31
+ super(`Resource not found: ${resource}`, 404, 'NOT_FOUND');
32
+ this.name = 'NotFoundError';
33
+ }
34
+ }
35
+ export class RateLimitError extends GitLabApiError {
36
+ retryAfterSeconds;
37
+ constructor(message, retryAfterSeconds) {
38
+ super(message, 429, 'RATE_LIMITED');
39
+ this.retryAfterSeconds = retryAfterSeconds;
40
+ this.name = 'RateLimitError';
41
+ }
42
+ }
43
+ export class ServerError extends GitLabApiError {
44
+ constructor(statusCode, statusText) {
45
+ super(`GitLab server error: ${statusCode} ${statusText}`, statusCode, 'SERVER_ERROR');
46
+ this.name = 'ServerError';
47
+ }
48
+ }
49
+ export class NetworkError extends GitLabApiError {
50
+ constructor(url, cause) {
51
+ super(`Unable to reach GitLab instance at ${url}: ${cause}`, 0, 'NETWORK_ERROR');
52
+ this.name = 'NetworkError';
53
+ }
54
+ }
55
+ export class ConfigurationError extends GitLabApiError {
56
+ constructor(message) {
57
+ super(message, 0, 'CONFIGURATION_ERROR');
58
+ this.name = 'ConfigurationError';
59
+ }
60
+ }
61
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmBH,iDAAiD;AACjD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AU,EAAE,cAAc,CAAC,CAAC;QACtF,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,cAAc;IAC9C,YAAY,GAAW,EAAE,KAAa;QACpC,KAAK,CAAC,sCAAsC,GAAG,KAAK,KAAK,EAAE,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,qBAAqB,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Catalog-specific type definitions for GitLab CI/CD Catalog components.
3
+ */
4
+ /**
5
+ * Summary info for a catalog component (as returned by list/search).
6
+ */
7
+ export interface CatalogComponent {
8
+ id: number;
9
+ name: string;
10
+ /** Full path including namespace, e.g. "to-be-continuous/docker-build" */
11
+ full_path: string;
12
+ /** Latest version string, e.g. "1.2.0" */
13
+ version: string;
14
+ /** Human-readable description */
15
+ description: string;
16
+ /** Latest tag, e.g. "v1.2.0" */
17
+ latest_tag?: string;
18
+ /** When the component was last updated */
19
+ updated_at?: string;
20
+ }
21
+ /**
22
+ * Detailed component info including specification.
23
+ */
24
+ export interface CatalogComponentDetail extends CatalogComponent {
25
+ /** Full YAML specification content */
26
+ spec?: string;
27
+ /** Input parameter definitions */
28
+ inputs?: ComponentInput[];
29
+ /** Job definitions */
30
+ jobs?: ComponentJob[];
31
+ /** Workflow definitions */
32
+ workflows?: ComponentWorkflow[];
33
+ }
34
+ export interface ComponentInput {
35
+ name: string;
36
+ type: 'string' | 'number' | 'boolean' | 'array';
37
+ required: boolean;
38
+ default?: unknown;
39
+ description?: string;
40
+ /** Regex validation pattern */
41
+ regex?: string;
42
+ /** Constrained options */
43
+ options?: string[];
44
+ }
45
+ export interface ComponentJob {
46
+ name: string;
47
+ stage: string;
48
+ image?: string;
49
+ script: string[];
50
+ /** Variables defined at job level */
51
+ variables?: Record<string, string>;
52
+ /** Job dependencies (needs) */
53
+ needs?: string[];
54
+ /** Rules/conditions */
55
+ rules?: string[];
56
+ /** When condition */
57
+ when?: string;
58
+ }
59
+ export interface ComponentWorkflow {
60
+ name: string;
61
+ /** Trigger conditions */
62
+ triggers: string[];
63
+ /** Jobs included in this workflow */
64
+ jobs: string[];
65
+ /** Rules for this workflow */
66
+ rules?: string[];
67
+ }
68
+ /**
69
+ * GitLab namespace/project info for API calls.
70
+ * Used to resolve a namespace to a project ID for catalog API calls.
71
+ */
72
+ export interface NamespaceInfo {
73
+ id: number;
74
+ name: string;
75
+ full_path: string;
76
+ }
77
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/types/catalog.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,sBAAsB;IACtB,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,2BAA2B;IAC3B,SAA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sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/types/catalog.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "gitlab-catalog-browser",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool for AI agents to browse GitLab CI/CD Catalog, inspect component schemas, and validate pipeline configurations",
5
+ "type": "module",
6
+ "bin": {
7
+ "gitlab-ci-cli": "./bin/gitlab-ci-cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "start": "node bin/gitlab-ci-cli.js",
13
+ "test": "vitest run",
14
+ "test:watch": "vitest",
15
+ "typecheck": "tsc --noEmit",
16
+ "prepublishOnly": "npm run build",
17
+ "prepack": "npm run build"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/kouassives/gitlab-catalog-browser.git"
22
+ },
23
+ "homepage": "https://github.com/kouassives/gitlab-catalog-browser",
24
+ "bugs": {
25
+ "url": "https://github.com/kouassives/gitlab-catalog-browser/issues"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "provenance": true
30
+ },
31
+ "keywords": [
32
+ "gitlab",
33
+ "ci-cd",
34
+ "cli",
35
+ "catalog",
36
+ "devops"
37
+ ],
38
+ "license": "MIT",
39
+ "dependencies": {
40
+ "commander": "^12.0.0",
41
+ "js-yaml": "^4.1.1"
42
+ },
43
+ "devDependencies": {
44
+ "@types/js-yaml": "^4.0.9",
45
+ "@types/node": "^20.0.0",
46
+ "typescript": "^5.4.0",
47
+ "vitest": "^1.6.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ },
52
+ "files": [
53
+ "bin/",
54
+ "dist/",
55
+ "skill-data/",
56
+ "skills/",
57
+ "package.json",
58
+ "README.md"
59
+ ]
60
+ }
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: core
3
+ description: Full command reference for gitlab-ci-cli
4
+ ---
5
+
6
+ # Command Reference
7
+
8
+ ## Global Flags
9
+
10
+ | Flag | Description |
11
+ |------|-------------|
12
+ | `--gitlab-url <url>` | GitLab instance URL (default: https://gitlab.com) |
13
+ | `--token <token>` | GitLab personal access token |
14
+
15
+ ## Commands
16
+
17
+ ### init
18
+ Initialize project configuration and verify environment.
19
+
20
+ ```bash
21
+ gitlab-ci-cli init [--force] [--completion bash|zsh]
22
+ ```
23
+
24
+ ### upgrade
25
+ Check for and apply CLI upgrades.
26
+
27
+ ```bash
28
+ gitlab-ci-cli upgrade [--dry-run]
29
+ ```
30
+
31
+ ### doctor
32
+ Run comprehensive environment diagnostics.
33
+
34
+ ```bash
35
+ gitlab-ci-cli doctor [--json]
36
+ ```
37
+
38
+ ### catalog list
39
+ List all catalog components in a namespace.
40
+
41
+ ```bash
42
+ gitlab-ci-cli catalog list --org <namespace> [--json] [--page <n>] [--per-page <n>]
43
+ ```
44
+
45
+ ### catalog search
46
+ Search catalog components by keyword.
47
+
48
+ ```bash
49
+ gitlab-ci-cli catalog search <query> [--json] [--page <n>] [--per-page <n>]
50
+ ```
51
+
52
+ ### catalog info
53
+ Show detailed information about a specific component.
54
+
55
+ ```bash
56
+ gitlab-ci-cli catalog info <full-path> [--json]
57
+ ```
58
+
59
+ ### component schema
60
+ Get the complete YAML specification of a component.
61
+
62
+ ```bash
63
+ gitlab-ci-cli component schema <full-path> [--version <version>] [--output-file <path>]
64
+ ```
65
+
66
+ ### component inputs
67
+ List all input parameters for a component.
68
+
69
+ ```bash
70
+ gitlab-ci-cli component inputs <full-path> [--json]
71
+ ```
72
+
73
+ ### component workflows
74
+ List workflow definitions for a component.
75
+
76
+ ```bash
77
+ gitlab-ci-cli component workflows <full-path>
78
+ ```
79
+
80
+ ### component jobs
81
+ List job definitions for a component.
82
+
83
+ ```bash
84
+ gitlab-ci-cli component jobs <full-path> [--with-artifacts]
85
+ ```
86
+
87
+ ### validate
88
+ Validate a .gitlab-ci.yml pipeline configuration.
89
+
90
+ ```bash
91
+ gitlab-ci-cli validate <file> [--stdin] [--dry-run] [--project <path>] [--var <key=value>] [--json]
92
+ ```
93
+
94
+ ### pipeline explain
95
+ Show job dependency graph for specified jobs.
96
+
97
+ ```bash
98
+ gitlab-ci-cli pipeline explain <file> --jobs <list> [--json]
99
+ ```
100
+
101
+ ### pipeline trace
102
+ Trace variable usage across the pipeline.
103
+
104
+ ```bash
105
+ gitlab-ci-cli pipeline trace <file> --var <name> [--json]
106
+ ```
107
+
108
+ ### pipeline stages
109
+ List pipeline stages and their jobs.
110
+
111
+ ```bash
112
+ gitlab-ci-cli pipeline stages <file> [--mermaid] [--json]
113
+ ```
114
+
115
+ ### pipeline includes
116
+ Show include hierarchy of the pipeline.
117
+
118
+ ```bash
119
+ gitlab-ci-cli pipeline includes <file> [--json]
120
+ ```
121
+
122
+ ### pipeline summary
123
+ Generate a structured pipeline summary.
124
+
125
+ ```bash
126
+ gitlab-ci-cli pipeline summary <file> [--json]
127
+ ```
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: core
3
+ description: Pipeline template patterns and best practices
4
+ ---
5
+
6
+ # Pipeline Template Patterns
7
+
8
+ ## Basic Three-Stage Pipeline
9
+
10
+ ```yaml
11
+ stages: [build, test, deploy]
12
+
13
+ build:
14
+ stage: build
15
+ script: echo "Building..."
16
+
17
+ test:
18
+ stage: test
19
+ script: echo "Testing..."
20
+ needs: [build]
21
+
22
+ deploy:
23
+ stage: deploy
24
+ script: echo "Deploying..."
25
+ needs: [test]
26
+ when: manual
27
+ ```
28
+
29
+ ## Multi-Stage with Approvals
30
+
31
+ ```yaml
32
+ stages: [build, test, staging, production]
33
+
34
+ build:
35
+ stage: build
36
+ script: make build
37
+ artifacts:
38
+ paths: [dist/]
39
+
40
+ test:
41
+ stage: test
42
+ script: make test
43
+ needs: [build]
44
+
45
+ deploy-staging:
46
+ stage: staging
47
+ script: make deploy-staging
48
+ needs: [test]
49
+ environment: staging
50
+
51
+ deploy-production:
52
+ stage: production
53
+ script: make deploy-production
54
+ needs: [deploy-staging]
55
+ when: manual
56
+ environment: production
57
+ ```
58
+
59
+ ## Docker Build Pipeline
60
+
61
+ ```yaml
62
+ stages: [build, test, push]
63
+
64
+ variables:
65
+ IMAGE_TAG: $CI_COMMIT_SHORT_SHA
66
+
67
+ docker-build:
68
+ stage: build
69
+ image: docker:latest
70
+ services: [docker:dind]
71
+ script:
72
+ - docker build -t $CI_REGISTRY_IMAGE:$IMAGE_TAG .
73
+ - docker tag $CI_REGISTRY_IMAGE:$IMAGE_TAG $CI_REGISTRY_IMAGE:latest
74
+
75
+ docker-test:
76
+ stage: test
77
+ script:
78
+ - docker run $CI_REGISTRY_IMAGE:$IMAGE_TAG test
79
+ needs: [docker-build]
80
+
81
+ docker-push:
82
+ stage: push
83
+ script:
84
+ - docker push $CI_REGISTRY_IMAGE:$IMAGE_TAG
85
+ - docker push $CI_REGISTRY_IMAGE:latest
86
+ needs: [docker-test]
87
+ only: [main]
88
+ ```
89
+
90
+ ## Best Practices
91
+
92
+ 1. **Use needs explicitly**: Always declare job dependencies for clarity and performance
93
+ 2. **Leverage artifacts**: Pass build outputs between stages instead of rebuilding
94
+ 3. **Use rules over only/except**: `rules:` provides more flexible conditionals
95
+ 4. **Cache dependencies**: Use `cache:` for package managers (npm, pip, maven)
96
+ 5. **Keep stages parallel**: Design jobs within the same stage to run independently
97
+ 6. **Use manual gates**: Mark deployment jobs as `when: manual` for production safety
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: core
3
+ description: Core workflow instructions for using gitlab-ci-cli
4
+ ---
5
+
6
+ # Core Workflows
7
+
8
+ ## Overview
9
+
10
+ gitlab-ci-cli is a CLI tool for AI agents to browse the GitLab CI/CD Catalog, inspect component schemas, validate pipeline configurations, and analyze pipeline structures.
11
+
12
+ ## Browsing the Catalog
13
+
14
+ ```bash
15
+ # List components in a namespace
16
+ gitlab-ci-cli catalog list --org to-be-continuous
17
+
18
+ # Search for components
19
+ gitlab-ci-cli catalog search docker
20
+
21
+ # Get component details
22
+ gitlab-ci-cli catalog info to-be-continuous/docker-build
23
+ ```
24
+
25
+ ## Inspecting Component Schemas
26
+
27
+ ```bash
28
+ # Get full YAML spec
29
+ gitlab-ci-cli component schema to-be-continuous/docker-build
30
+
31
+ # List input parameters
32
+ gitlab-ci-cli component inputs to-be-continuous/docker-build
33
+
34
+ # List workflows
35
+ gitlab-ci-cli component workflows to-be-continuous/docker-build
36
+
37
+ # List jobs
38
+ gitlab-ci-cli component jobs to-be-continuous/docker-build
39
+ ```
40
+
41
+ ## Validating Pipelines
42
+
43
+ ```bash
44
+ # Validate a .gitlab-ci.yml file
45
+ gitlab-ci-cli validate .gitlab-ci.yml
46
+
47
+ # Validate with dry-run rules evaluation
48
+ gitlab-ci-cli validate .gitlab-ci.yml --dry-run
49
+
50
+ # Validate with simulated variables
51
+ gitlab-ci-cli validate .gitlab-ci.yml --dry-run --var CI_PIPELINE_SOURCE=merge_request_event
52
+
53
+ # Validate with project context
54
+ gitlab-ci-cli validate .gitlab-ci.yml --project my-group/my-project
55
+
56
+ # Validate piped content
57
+ echo "stages: [build]" | gitlab-ci-cli validate --stdin
58
+ ```
59
+
60
+ ## Analyzing Pipelines
61
+
62
+ ```bash
63
+ # Show job dependency graph
64
+ gitlab-ci-cli pipeline explain .gitlab-ci.yml --jobs build,test,deploy
65
+
66
+ # Trace variable usage
67
+ gitlab-ci-cli pipeline trace .gitlab-ci.yml --var MY_VAR
68
+
69
+ # List stages
70
+ gitlab-ci-cli pipeline stages .gitlab-ci.yml
71
+
72
+ # Show include hierarchy
73
+ gitlab-ci-cli pipeline includes .gitlab-ci.yml
74
+
75
+ # Generate pipeline summary
76
+ gitlab-ci-cli pipeline summary .gitlab-ci.yml
77
+ ```
78
+
79
+ ## Troubleshooting
80
+
81
+ 1. **Authentication errors**: Ensure GITLAB_TOKEN is set or pass `--token`
82
+ 2. **Component not found**: Verify the full path (e.g., `namespace/component-name`)
83
+ 3. **Pipeline validation failures**: Check the error details for line/column information
84
+ 4. **Dry-run unexpected results**: Verify branch conditions and variables match your context
@@ -0,0 +1,12 @@
1
+ {
2
+ "skills": [
3
+ {
4
+ "name": "core",
5
+ "description": "Core workflow instructions for using gitlab-ci-cli to browse, validate, and manage GitLab CI/CD pipelines"
6
+ },
7
+ {
8
+ "name": "templates",
9
+ "description": "Pipeline template patterns including basic, multi-stage, and Docker build configurations"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,29 @@
1
+ stages: [build, test, deploy]
2
+
3
+ variables:
4
+ APP_NAME: my-app
5
+
6
+ build:
7
+ stage: build
8
+ script:
9
+ - echo "Building $APP_NAME"
10
+ - mkdir -p dist
11
+ - cp -r src/* dist/
12
+ artifacts:
13
+ paths: [dist/]
14
+ expire_in: 1 hour
15
+
16
+ test:
17
+ stage: test
18
+ script:
19
+ - echo "Testing $APP_NAME"
20
+ - npm test
21
+ needs: [build]
22
+
23
+ deploy:
24
+ stage: deploy
25
+ script:
26
+ - echo "Deploying $APP_NAME"
27
+ needs: [test]
28
+ when: manual
29
+ environment: production
@@ -0,0 +1,38 @@
1
+ stages: [build, test, push]
2
+
3
+ variables:
4
+ DOCKER_DRIVER: overlay2
5
+ IMAGE_TAG: $CI_COMMIT_SHORT_SHA
6
+
7
+ docker-build:
8
+ stage: build
9
+ image: docker:latest
10
+ services:
11
+ - docker:dind
12
+ script:
13
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
14
+ - docker build -t $CI_REGISTRY_IMAGE:$IMAGE_TAG .
15
+ - docker tag $CI_REGISTRY_IMAGE:$IMAGE_TAG $CI_REGISTRY_IMAGE:latest
16
+
17
+ docker-test:
18
+ stage: test
19
+ image: docker:latest
20
+ services:
21
+ - docker:dind
22
+ script:
23
+ - docker run $CI_REGISTRY_IMAGE:$IMAGE_TAG npm test
24
+ needs: [docker-build]
25
+
26
+ docker-push:
27
+ stage: push
28
+ image: docker:latest
29
+ services:
30
+ - docker:dind
31
+ script:
32
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
33
+ - docker push $CI_REGISTRY_IMAGE:$IMAGE_TAG
34
+ - docker push $CI_REGISTRY_IMAGE:latest
35
+ needs: [docker-test]
36
+ only:
37
+ - main
38
+ environment: production
@@ -0,0 +1,43 @@
1
+ stages: [build, test, staging, production]
2
+
3
+ variables:
4
+ CI_IMAGE_TAG: $CI_COMMIT_SHORT_SHA
5
+
6
+ build:
7
+ stage: build
8
+ script:
9
+ - echo "Building image"
10
+ - docker build -t app:$CI_IMAGE_TAG .
11
+ artifacts:
12
+ paths: [Dockerfile]
13
+
14
+ unit-test:
15
+ stage: test
16
+ script:
17
+ - echo "Running unit tests"
18
+ - docker run app:$CI_IMAGE_TAG npm test
19
+ needs: [build]
20
+
21
+ integration-test:
22
+ stage: test
23
+ script:
24
+ - echo "Running integration tests"
25
+ - docker-compose -f ci/docker-compose.test.yml up --abort-on-container-exit
26
+ needs: [build]
27
+
28
+ deploy-staging:
29
+ stage: staging
30
+ script:
31
+ - echo "Deploying to staging"
32
+ - kubectl set image deployment/app app=app:$CI_IMAGE_TAG
33
+ needs: [unit-test, integration-test]
34
+ environment: staging
35
+
36
+ deploy-production:
37
+ stage: production
38
+ script:
39
+ - echo "Deploying to production"
40
+ - kubectl set image deployment/app app=app:$CI_IMAGE_TAG
41
+ needs: [deploy-staging]
42
+ when: manual
43
+ environment: production