
Gitlab Cicd Pipeline
- 588 installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
gitlab-cicd-pipeline is a Claude Code skill that designs GitLab .gitlab-ci.yml pipelines with lint, test, build, security, and deploy stages for developers automating repository delivery on GitLab Runner infrastructure.
About
gitlab-cicd-pipeline is a GitLab CI/CD authoring skill for creating .gitlab-ci.yml files with staged jobs, artifacts, caching, Docker integration, and deployment strategies on GitLab Runner infrastructure. It covers multi-stage pipelines spanning lint, test, build, security scanning, review environments, and production deploys, plus runner and container execution configuration. Developers reach for this skill when standing up CI for a GitLab repository, wiring Docker registry pushes, or adding Kubernetes deployment stages without hand-writing every job block from scratch.
- Multi-stage pipeline pattern: lint → test → build → security → deploy-review → deploy-prod
- Cache keys on `${CI_COMMIT_REF_SLUG}` for `node_modules/` and `.npm/`
- GitLab Runner, Docker image execution, and registry integration guidance
- Reference guides for complete pipeline config and runner setup under `references/`
- Variables such as `DOCKER_DRIVER` and `FF_USE_FASTZIP` for faster container builds
Gitlab Cicd Pipeline by the numbers
- 588 all-time installs (skills.sh)
- Ranked #246 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Security screen: HIGH risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill gitlab-cicd-pipelineAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 588 |
|---|---|
| repo stars | ★ 305 |
| Security audit | 2 / 3 scanners passed |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How do you set up GitLab CI/CD pipeline stages?
Stand up a GitLab `.gitlab-ci.yml` with lint, test, build, security, and review/production deploy stages for a repo.
Who is it for?
Developers onboarding a GitLab repository who need a full lint-test-build-security-deploy pipeline with runner and Docker setup.
Skip if: GitHub Actions workflows, local-only test scripts without GitLab Runner, or application feature coding unrelated to CI configuration.
When should I use this skill?
A user asks to create or extend .gitlab-ci.yml with stages, jobs, artifacts, caching, Docker registry, or Kubernetes deploy steps.
What you get
.gitlab-ci.yml with staged jobs, artifacts, caching, Docker integration, and deployment configuration for GitLab Runners.
- .gitlab-ci.yml
- CI job and stage definitions
Files
GitLab CI/CD Pipeline
Table of Contents
Overview
Create comprehensive GitLab CI/CD pipelines that automate building, testing, and deployment using GitLab Runner infrastructure and container execution.
When to Use
- GitLab repository CI/CD setup
- Multi-stage build pipelines
- Docker registry integration
- Kubernetes deployment
- Review app deployment
- Cache optimization
- Dependency management
Quick Start
Minimal working example:
# .gitlab-ci.yml
image: node:18-alpine
variables:
DOCKER_DRIVER: overlay2
FF_USE_FASTZIP: "true"
stages:
- lint
- test
- build
- security
- deploy-review
- deploy-prod
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .npm/
lint:
stage: lint
script:
- npm install
// ... (see reference guides for full implementation)Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Complete Pipeline Configuration | Complete Pipeline Configuration |
| GitLab Runner Configuration | GitLab Runner Configuration |
| Docker Layer Caching Optimization | Docker Layer Caching Optimization |
| Multi-Project Pipeline | Multi-Project Pipeline |
| Kubernetes Deployment | Kubernetes Deployment, Performance Testing Stage, Release Pipeline with Semantic Versioning |
Best Practices
✅ DO
- Use stages to organize pipeline flow
- Implement caching for dependencies
- Use artifacts for test reports
- Set appropriate cache keys
- Implement conditional execution with
onlyandexcept - Use
needs:for job dependencies - Clean up artifacts with
expire_in - Use Docker for consistent environments
- Implement security scanning stages
- Set resource limits for jobs
- Use merge request pipelines
❌ DON'T
- Run tests serially when parallelizable
- Cache everything unnecessarily
- Leave large artifacts indefinitely
- Store secrets in configuration files
- Run privileged Docker without necessity
- Skip security scanning
- Ignore pipeline failures
- Use
only: [main]without proper controls
Complete Pipeline Configuration
Complete Pipeline Configuration
# .gitlab-ci.yml
image: node:18-alpine
variables:
DOCKER_DRIVER: overlay2
FF_USE_FASTZIP: "true"
stages:
- lint
- test
- build
- security
- deploy-review
- deploy-prod
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .npm/
lint:
stage: lint
script:
- npm install
- npm run lint
- npm run format:check
artifacts:
reports:
codequality: code-quality-report.json
expire_in: 1 week
unit-tests:
stage: test
script:
- npm install
- npm run test:coverage
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
junit: test-results.xml
paths:
- coverage/
expire_in: 1 week
coverage: '/Coverage: \d+\.\d+%/'
integration-tests:
stage: test
services:
- postgres:13
- redis:7
variables:
POSTGRES_DB: test_db
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
script:
- npm run test:integration
only:
- merge_requests
- main
build:
stage: build
image: docker:latest
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
REGISTRY: registry.gitlab.com
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
only:
- main
- tags
security-scan:
stage: security
image: alpine:latest
script:
- apk add --no-cache git
- git clone https://github.com/aquasecurity/trivy.git
- ./trivy image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
allow_failure: true
deploy-review:
stage: deploy-review
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://$CI_COMMIT_REF_SLUG.review.example.com
auto_stop_in: 1 week
script:
- helm upgrade --install review-$CI_COMMIT_REF_SLUG ./chart
--set image.tag=$CI_COMMIT_SHA
--set environment=review
only:
- merge_requests
deploy-prod:
stage: deploy-prod
environment:
name: production
url: https://example.com
script:
- helm upgrade --install prod ./chart
--set image.tag=$CI_COMMIT_SHA
--set environment=production
only:
- main
when: manualDocker Layer Caching Optimization
Docker Layer Caching Optimization
# .gitlab-ci.yml
stages:
- build
build-image:
stage: build
image: docker:latest
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Pull previous image for cache
- docker pull $CI_REGISTRY_IMAGE:latest || true
# Build with cache
- docker build
--cache-from $CI_REGISTRY_IMAGE:latest
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
--tag $CI_REGISTRY_IMAGE:latest
.
# Push images
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
cache:
key: ${CI_COMMIT_REF_SLUG}-docker
paths:
- .docker/GitLab Runner Configuration
GitLab Runner Configuration
#!/bin/bash
# install-runner.sh
# Register GitLab Runner
gitlab-runner register \
--url https://gitlab.com/ \
--registration-token $RUNNER_TOKEN \
--executor docker \
--docker-image alpine:latest \
--docker-privileged \
--docker-volumes /certs/client \
--description "Docker Runner" \
--tag-list "docker,linux" \
--run-untagged=false \
--locked=false \
--access-level not_protected
# Start runner
gitlab-runner startKubernetes Deployment
Kubernetes Deployment
# .gitlab-ci.yml
deploy-k8s:
stage: deploy
image: alpine/k8s:latest
script:
- mkdir -p $HOME/.kube
- echo $KUBE_CONFIG_ENCODED | base64 -d > $HOME/.kube/config
- chmod 600 $HOME/.kube/config
# Update image in deployment
- kubectl set image deployment/app-deployment
app=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
-n production
# Wait for rollout
- kubectl rollout status deployment/app-deployment -n production
environment:
name: production
kubernetes:
namespace: production
only:
- main
when: manualPerformance Testing Stage
# .gitlab-ci.yml
performance:
stage: test
image: grafana/k6:latest
script:
- k6 run tests/performance.js
artifacts:
reports:
performance: performance-results.json
expire_in: 1 week
allow_failure: true
only:
- main
- merge_requestsRelease Pipeline with Semantic Versioning
# .gitlab-ci.yml
release:
stage: deploy-prod
image: node:18-alpine
script:
- npm install -g semantic-release @semantic-release/gitlab
# Configure git
- git config user.email "ci@example.com"
- git config user.name "CI Bot"
# Run semantic-release
- semantic-release
only:
- main
when: manualMulti-Project Pipeline
Multi-Project Pipeline
# .gitlab-ci.yml
stages:
- build
- test
- deploy
build:backend:
stage: build
script:
- cd backend && npm run build
artifacts:
paths:
- backend/dist/
build:frontend:
stage: build
script:
- cd frontend && npm run build
artifacts:
paths:
- frontend/dist/
test:backend:
stage: test
needs: ["build:backend"]
script:
- cd backend && npm test
artifacts:
reports:
junit: backend/test-results.xml
test:frontend:
stage: test
needs: ["build:frontend"]
script:
- cd frontend && npm test
artifacts:
reports:
junit: frontend/test-results.xml
deploy:
stage: deploy
needs: ["test:backend", "test:frontend"]
script:
- echo "Deploying backend and frontend..."
when: manual#!/bin/bash
# validate-pipeline.sh - Validate CI/CD pipeline configuration
# Usage: ./validate-pipeline.sh <pipeline_file>
set -euo pipefail
PIPELINE_FILE="${{1:?Usage: $0 <pipeline_file>}}"
echo "Validating pipeline: $PIPELINE_FILE"
# TODO: Add pipeline validation
# - Check YAML/Groovy syntax
# - Verify stage dependencies
# - Check for required stages (build, test, deploy)
# - Validate environment variable references
# - Check for security best practices
echo "Pipeline validation complete."
# CI/CD Pipeline Starter Template
# TODO: Customize for your CI/CD platform (GitHub Actions, GitLab CI, Jenkins, etc.)
name: CI/CD Pipeline
# TODO: Configure triggers
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: Add build steps
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
# TODO: Add test steps
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
# TODO: Add deployment steps
- run: echo "Deploy to production"
Related skills
FAQ
What stages does gitlab-cicd-pipeline cover?
gitlab-cicd-pipeline designs .gitlab-ci.yml pipelines with lint, test, build, security, review, and production deploy stages, including artifacts, caching, and GitLab Runner job configuration.
Does gitlab-cicd-pipeline support Docker and Kubernetes deploys?
Yes. gitlab-cicd-pipeline configures Docker registry integration, container execution on GitLab Runners, and deployment strategies including Kubernetes targets within the CI/CD YAML.
Is Gitlab Cicd Pipeline safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.