Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wshobson avatar

Gitlab Ci Patterns

  • 10.2k installs
  • 38.3k repo stars
  • Updated July 22, 2026
  • wshobson/agents

gitlab-ci-patterns is an agent skill that Build GitLab CI/CD pipelines with multi-stage workflows, caching, and distributed runners for scalable automation. Use when implementing GitLab CI/CD, optimizin.

About

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 name gitlab-ci-patterns description 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 GitLab CI Patterns Comprehensive GitLab CI CD pipeline patterns for automated testing building and deployment Purpose Create efficient GitLab CI pipelines with proper stage organization caching and deployment strategies When to Use Automate GitLab-based CI CD Implement multi-stage pipelines Configure GitLab Runners Deploy to Kubernetes from GitLab Implement GitOps workflows Basic Pipeline Structure yaml stages build test deploy variables DOCKER_DRIVER overlay2 DOCKER_TLS_CERTDIR certs build stage build image node 20 script npm ci npm run build artifacts paths dist expire_in 1 hour cache key CI_COMMIT_REF_SLUG paths node_modules test stage test image node 20 script npm ci npm run lint npm test coverage.

  • Automate GitLab-based CI/CD
  • Implement multi-stage pipelines
  • Configure GitLab Runners
  • Deploy to Kubernetes from GitLab
  • Implement GitOps workflows

Gitlab Ci Patterns by the numbers

  • 10,157 all-time installs (skills.sh)
  • +215 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #38 of 1,041 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

gitlab-ci-patterns capabilities & compatibility

Capabilities
automate gitlab based ci/cd · implement multi stage pipelines · configure gitlab runners · deploy to kubernetes from gitlab · implement gitops workflows
Use cases
documentation
From the docs

What gitlab-ci-patterns says it does

--- name: gitlab-ci-patterns description: Build GitLab CI/CD pipelines with multi-stage workflows, caching, and distributed runners for scalable automation.
SKILL.md
Use when implementing GitLab CI/CD, optimizing pipeline performance, or setting up automated testing and deployment.
SKILL.md
--- # GitLab CI Patterns Comprehensive GitLab CI/CD pipeline patterns for automated testing, building, and deployment.
SKILL.md
## Purpose Create efficient GitLab CI pipelines with proper stage organization, caching, and deployment strategies.
SKILL.md
npx skills add https://github.com/wshobson/agents --skill gitlab-ci-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs10.2k
repo stars38.3k
Security audit2 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorywshobson/agents

What problem does gitlab-ci-patterns solve for developers using this skill?

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 au

Who is it for?

Developers who need gitlab-ci-patterns patterns described in the cached skill documentation.

Skip if: Skip when docs are empty or the task is outside the skill's documented scope.

When should I use this skill?

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 au

What you get

Actionable workflows and conventions from SKILL.md for gitlab-ci-patterns.

  • .gitlab-ci.yml pipeline template
  • Runner and cache configuration

Files

SKILL.mdMarkdownGitHub ↗

GitLab CI Patterns

Comprehensive GitLab CI/CD pipeline patterns for automated testing, building, and deployment.

Purpose

Create efficient GitLab CI pipelines with proper stage organization, caching, and deployment strategies.

When to Use

  • Automate GitLab-based CI/CD
  • Implement multi-stage pipelines
  • Configure GitLab Runners
  • Deploy to Kubernetes from GitLab
  • Implement GitOps workflows

Basic Pipeline Structure

stages:
  - build
  - test
  - deploy

variables:
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: "/certs"

build:
  stage: build
  image: node:20
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 hour
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/

test:
  stage: test
  image: node:20
  script:
    - npm ci
    - npm run lint
    - npm test
  coverage: '/Lines\s*:\s*(\d+\.\d+)%/'
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

deploy:
  stage: deploy
  image: bitnami/kubectl:1.31
  script:
    - kubectl apply -f k8s/
    - kubectl rollout status deployment/my-app
  only:
    - main
  environment:
    name: production
    url: https://app.example.com

Docker Build and Push

build-docker:
  stage: build
  image: docker:24
  services:
    - docker:24-dind
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  script:
    - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
    - docker build -t $CI_REGISTRY_IMAGE:latest .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE:latest
  only:
    - main
    - tags

Multi-Environment Deployment

.deploy_template: &deploy_template
  image: bitnami/kubectl:1.31
  before_script:
    - kubectl config set-cluster k8s --server="$KUBE_URL" --insecure-skip-tls-verify=true
    - kubectl config set-credentials admin --token="$KUBE_TOKEN"
    - kubectl config set-context default --cluster=k8s --user=admin
    - kubectl config use-context default

deploy:staging:
  <<: *deploy_template
  stage: deploy
  script:
    - kubectl apply -f k8s/ -n staging
    - kubectl rollout status deployment/my-app -n staging
  environment:
    name: staging
    url: https://staging.example.com
  only:
    - develop

deploy:production:
  <<: *deploy_template
  stage: deploy
  script:
    - kubectl apply -f k8s/ -n production
    - kubectl rollout status deployment/my-app -n production
  environment:
    name: production
    url: https://app.example.com
  when: manual
  only:
    - main

Terraform Pipeline

stages:
  - validate
  - plan
  - apply

variables:
  TF_ROOT: ${CI_PROJECT_DIR}/terraform
  TF_VERSION: "1.6.0"

before_script:
  - cd ${TF_ROOT}
  - terraform --version

validate:
  stage: validate
  image: hashicorp/terraform:${TF_VERSION}
  script:
    - terraform init -backend=false
    - terraform validate
    - terraform fmt -check

plan:
  stage: plan
  image: hashicorp/terraform:${TF_VERSION}
  script:
    - terraform init
    - terraform plan -out=tfplan
  artifacts:
    paths:
      - ${TF_ROOT}/tfplan
    expire_in: 1 day

apply:
  stage: apply
  image: hashicorp/terraform:${TF_VERSION}
  script:
    - terraform init
    - terraform apply -auto-approve tfplan
  dependencies:
    - plan
  when: manual
  only:
    - main

Security Scanning

include:
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml
  - template: Security/Container-Scanning.gitlab-ci.yml

trivy-scan:
  stage: test
  image: aquasec/trivy:0.58.0
  script:
    - trivy image --exit-code 1 --severity HIGH,CRITICAL $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  allow_failure: true

Caching Strategies

# Cache node_modules
build:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/
    policy: pull-push

# Global cache
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .cache/
    - vendor/

# Separate cache per job
job1:
  cache:
    key: job1-cache
    paths:
      - build/

job2:
  cache:
    key: job2-cache
    paths:
      - dist/

Dynamic Child Pipelines

generate-pipeline:
  stage: build
  script:
    - python generate_pipeline.py > child-pipeline.yml
  artifacts:
    paths:
      - child-pipeline.yml

trigger-child:
  stage: deploy
  trigger:
    include:
      - artifact: child-pipeline.yml
        job: generate-pipeline
    strategy: depend

Best Practices

1. Use specific image tags (node:20, not node:latest) 2. Cache dependencies appropriately 3. Use artifacts for build outputs 4. Implement manual gates for production 5. Use environments for deployment tracking 6. Enable merge request pipelines 7. Use pipeline schedules for recurring jobs 8. Implement security scanning 9. Use CI/CD variables for secrets 10. Monitor pipeline performance

Related Skills

  • github-actions-templates - For GitHub Actions
  • deployment-pipeline-design - For architecture
  • secrets-management - For secrets handling

Related skills

FAQ

What does gitlab-ci-patterns do?

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

When should I use gitlab-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

Is gitlab-ci-patterns safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.