Skip to content
Skills Library
DevOps & cloud · Building & coding

gitlab-ci

/gitlab-ci

Expert GitLab CI/CD assistance covering .gitlab-ci.yml, stages, artifacts, caching, GitLab Runners, and Auto DevOps. Use when configuring continuous integration and deployment pipelines on GitLab.

Licence
MIT
Last repository change
01.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert GitLab CI/CD assistance covering .gitlab-ci.yml, stages, artifacts, caching, GitLab Runners, and Auto DevOps. Use when configuring continuous integration and deployment pipelines on GitLab.

Original author description

Expert GitLab CI/CD assistance covering .gitlab-ci.yml, stages, artifacts, caching, GitLab Runners, and Auto DevOps. Use when configuring continuous integration and deployment pipelines on GitLab.

How it works

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Original SKILL.md headings · 203 lines, 631 words
SKILL.md preview
---
name: gitlab-ci
description: Expert GitLab CI/CD assistance covering .gitlab-ci.yml, stages, artifacts, caching, GitLab Runners, and Auto DevOps. Use when configuring continuous integration and deployment pipelines on GitLab.
---

# GitLab CI/CD

GitLab CI/CD provides integrated pipeline orchestration directly within GitLab repositories, utilizing reusable CI Components and container-native runners for automated software delivery.

## When to Use

- **Self-Hosted & Enterprise GitOps CI/CD**: Running pipelines within GitLab EE/CE and private runner infrastructures.
- **Container Registry & Helm Package Integration**: Built-in GitLab Container Registry, Package Registry, and Dependency Proxy.
- **Multi-Project & Downstream Pipelines**: Triggering coordinated cross-repository builds in complex enterprise architectures.
- **Dynamic Parent-Child Pipelines**: Generating build steps dynamically at runtime based on modified monorepo paths.

## Quick Start

```yaml
# .gitlab-ci.yml
stages:
  - build
  - test

build-job:
  stage: build
  image: node:20
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/

test-job:
  stage: test
  image: node:20
  script:
    - npm test
  needs: [build-job]
```

## Core Concepts

### Declarative Pipeline with Stages, Caching & Artifacts

Clean, structured `.gitlab-ci.yml` pipeline:

```yaml
# .gitlab-ci.yml
stages:
  - lint
  - test
  - build
  - deploy

default:
  image: node:22-alpine
  cache:
    key:
      files:
        - package-lock.json
    paths:
      - .npm/

variables:
  npm_config_cache: "$CI_PROJECT_DIR/.npm"

lint:
  stage: lint
  script:
    - npm ci
    - npm run lint
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

test:
  stage: test
  script:
    - npm ci
    - npm test -- --ci --reporters=default --reporters=jest-junit
  artifacts:
    when: always
    reports:
      junit: junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

build-container:
  stage: build
  image: docker:27-cli
  services:
    - docker:27-dind
  variables:
    DOCKER_TLS_CERTDIR: "/certs"
    IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build -t $IMAGE_TAG .
    - docker push $IMAGE_TAG
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
```

### Monorepo Path Filtering with rules:changes

Executing jobs only when relevant subdirectories are modified:

```yaml
frontend-job:
  stage: test
  script:
    - cd frontend && npm test
  rules:
    - changes:
        - frontend/**/*

backend-job:
  stage: test
  script:
    - cd backend && cargo test
  rules:
    - changes:
        - backend/**/*
```

### Protected Environments & Manual Deployment Gates

Requiring manual approval for production releases:

```yaml
deploy-production:
  stage: deploy
  environment:
    name: production
    url: https://api.example.com
  script:
    - echo "Deploying version $CI_COMMIT_SHA to production cluster"
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual # Requires manual trigger in GitLab UI
```

## Common Patterns

### Multi-Stage Pipeline with Artifact Passing and Rule Conditions

**Problem**: Running tests and security scans on draft branches before code is ready for deployment.

**Solution**:
Use `.gitlab-ci.yml` stages with `rules:` conditions:

```yaml
stages:
  - test
  - deploy

run_tests:
  stage: test
  image: node:20-alpine
  script:
    - npm ci
    - npm test
  artifacts:
    when: on_failure
    paths:
      - test-results/

deploy_prod:
  stage: deploy
  image: alpine/k8s:1.28.2
  script:
    - kubectl apply -f k8s/production/
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: manual
```

## Best Practices

**Do**:

- Use `rules:changes` in monorepos to avoid running redundant jobs when unrelated code is modified.
- Configure GitLab `reports:junit` and `reports:coverage_report` to view test insights in merge requests.
- Use GitLab Dependency Proxy to cache container images from Docker Hub, eliminating rate limit throttling.
- Mark production deploy jobs with `when: manual` and assign them to protected environments with approver policies.

**Don't**:

- Use deprecated `only`/`except` syntax; migrate to modern `rules:` directives.
- Store plaintext passwords in `.gitlab-ci.yml`; use Masked and Protected CI/CD Variables.
- Run Docker-in-Docker (`dind`) with privileged flags in shared environments; use Kaniko for rootless builds.

## Troubleshooting

| Error                                                          | Cause                                                              | Solution                                                            |
| :------------------------------------------------------------- | :----------------------------------------------------------------- | :------------------------------------------------------------------ |
| `yaml invalid: jobs:run_tests config key may not be used with` | Incompatible keyword combinations (e.g. `only` used with `rules`). | Migrate legacy `only/except` syntax to modern `rules:` conditions.  |
| `Job failed: execution took longer than ...`                   | Job exceeded runner timeout setting.                               | Increase timeout in project Settings > CI/CD > General pipelines.   |
| `Artifacts not found in downstream job`                        | Artifact expiration reached or `dependencies:` list omitted.       | Explicitly declare `dependencies: [build_job]` in the consumer job. |

## References

- [GitLab CI/CD Documentation](https://docs.gitlab.com/ee/ci/)

Versions

RepositoryScoreLicence
This page · G1Joshi/Agent-Skills100MIT
siva01c/claude-plugins100MIT
dkbnull/hello-skill90MIT

Database snapshot: 13.11.2026 · package version 9958807bb947 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100gitlab-ci-patterns
    Provides GitLab CI/CD pipeline patterns including stages, jobs, artifacts, caching, and environment deployments. Use when working with .gitlab-ci.yml or when the user mentions GitLab CI or GitLab pipelines.
  • 100ci-cd-gitlab-ci-pipelines
    Use this skill when building multi-stage continuous integration and deployment pipelines using GitLab CI/CD .gitlab-ci.yml.
  • 90devops-gitlab-ci
    GitLab CI/CD pipeline configuration and management. Covers: .gitlab-ci.yml structure, stages, jobs, parallel, needs, artifacts, cache, child/parent pipelines, multi-project pipelines, rules, YAML anchors, templates, includes, Container Registry, Kaniko, security scanning (SAST,…
  • 90gitlab-ci-handbook
    GitLab CI/CD knowledge base (GitLab 18+). Use whenever the user asks about, needs an explanation of, writes, reviews, optimizes, or debugs GitLab pipelines or .gitlab-ci.yml files: stages, jobs, rules and workflows, includes and templates, caching and artifacts, child and…
  • 95gitlab-ci-generator
    Creates .gitlab-ci.yml files, configures pipeline stages, defines CI jobs and runners, sets up deployment workflows, and generates reusable GitLab CI/CD templates following current best practices and security standards. Use when users ask to create or build a GitLab CI/CD…
  • 100gitlab-ci-patterns
    Build GitLab CI/CD pipelines with multi-stage workflows, caching, and distributed runners for scalable automation. Use when implementing GitLab CI/CD, optimizing pipeline performance, or setting up automated testing and deployment.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.