
Cicd Pipeline Setup
- 453 installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
cicd-pipeline-setup is a prompt skill that designs CI/CD pipelines with lint, test, build, staging promotion, production gates, caching, and rollback-friendly deploy steps for developers shipping reliable releases.
About
cicd-pipeline-setup is a skill from aj-geddes/useful-ai-prompts that guides creation of CI/CD pipelines covering lint, test, artifact build, and staged promotion across staging and production. It emphasizes gates, caching, and rollback-friendly deploy steps so failures surface before customers see broken builds. Developers reach for cicd-pipeline-setup when bootstrapping GitHub Actions, GitLab CI, or similar workflows, or when an existing pipeline lacks test coverage, artifact promotion, or safe rollback paths. The skill outputs pipeline structure and step recommendations rather than executing cloud provisioning itself. It pairs well with repository testing skills and release checklists when a team moves from manual deploys to automated promotion.
- Workflow structure and triggers
- Test and lint stages
- Artifact caching
- Environment promotions
- Secrets in CI
Cicd Pipeline Setup by the numbers
- 453 all-time installs (skills.sh)
- Ranked #272 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill cicd-pipeline-setupAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 453 |
|---|---|
| repo stars | ★ 305 |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How do you set up CI/CD with test gates?
Create CI/CD pipelines that lint, test, build artifacts, and promote releases across staging and production with gates, caching, and rollback-friendly deploy steps.
Who is it for?
Developers adding first-class CI/CD to a repo that needs linting, tests, artifacts, and staged production promotion.
Skip if: Infrastructure-only Terraform work or production incident response where no pipeline authoring is required.
When should I use this skill?
The user asks to create, fix, or extend CI/CD with lint, test, build, caching, gates, or rollback deploy steps.
What you get
CI/CD pipeline definition with lint, test, build, promotion, and rollback-friendly deploy stages.
- CI/CD pipeline stage plan
- Lint-test-build-promote workflow
Files
CI/CD Pipeline Setup
Table of Contents
Overview
Build automated continuous integration and deployment pipelines that test code, build artifacts, run security checks, and deploy to multiple environments with minimal manual intervention.
When to Use
- Automated code testing and quality checks
- Containerized application builds
- Multi-environment deployments
- Release management and versioning
- Automated security scanning
- Performance testing integration
- Artifact management and registry
Quick Start
Minimal working example:
# .github/workflows/deploy.yml
name: Build and Deploy
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
// ... (see reference guides for full implementation)Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| GitHub Actions Workflow | GitHub Actions Workflow |
| GitLab CI Pipeline | GitLab CI Pipeline |
| Jenkins Pipeline | Jenkins Pipeline |
| CI/CD Script | CI/CD Script |
Best Practices
✅ DO
- Fail fast with early validation
- Run tests in parallel when possible
- Use caching for dependencies
- Implement proper secret management
- Gate production deployments with approval
- Monitor and alert on pipeline failures
- Use consistent environment configuration
- Implement infrastructure as code
❌ DON'T
- Store credentials in pipeline configuration
- Deploy without automated tests
- Skip security scanning
- Allow long-running pipelines
- Mix staging and production pipelines
- Ignore test failures
- Deploy directly to main branch
- Skip health checks after deployment
CI/CD Script
CI/CD Script
#!/bin/bash
# ci-pipeline.sh - Local pipeline validation
set -euo pipefail
echo "Starting CI/CD pipeline..."
# Code quality
echo "Running code quality checks..."
npm run lint
npm run type-check
# Testing
echo "Running tests..."
npm run test:coverage
# Build
echo "Building application..."
npm run build
# Docker build
echo "Building Docker image..."
docker build -t myapp:latest .
# Security scanning
echo "Running security scans..."
trivy image myapp:latest --exit-code 0 --severity HIGH
echo "All pipeline stages completed successfully!"GitHub Actions Workflow
GitHub Actions Workflow
# .github/workflows/deploy.yml
name: Build and Deploy
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run tests
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/coverage-final.json
flags: unittests
name: codecov-umbrella
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Snyk Security Scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
- name: Run Trivy vulnerability scan
uses: aquasecurity/trivy-action@master
with:
scan-type: "fs"
scan-ref: "."
build:
needs: [test, security]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GithubActionsRole
aws-region: us-east-1
- name: Deploy to ECS
run: |
aws ecs update-service \
--cluster production \
--service myapp \
--force-new-deployment
- name: Verify deployment
run: |
aws ecs wait services-stable \
--cluster production \
--services myappGitLab CI Pipeline
GitLab CI Pipeline
# .gitlab-ci.yml
stages:
- test
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
IMAGE_TAG: $CI_COMMIT_SHA
test:
stage: test
image: node:20
cache:
paths:
- node_modules/
script:
- npm ci
- npm run lint
- npm run test:coverage
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
coverage: '/Lines\s*:\s*(\d+.\d+)%/'
security:
stage: test
image: aquasec/trivy:latest
script:
- trivy fs --exit-code 0 --severity HIGH,CRITICAL .
build:
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE:$IMAGE_TAG .
- docker push $CI_REGISTRY_IMAGE:$IMAGE_TAG
- docker tag $CI_REGISTRY_IMAGE:$IMAGE_TAG $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
only:
- main
- develop
deploy_staging:
stage: deploy
image: alpine:latest
before_script:
- apk add --no-cache aws-cli
script:
- aws ecs update-service --cluster staging --service myapp --force-new-deployment
environment:
name: staging
url: https://staging.myapp.com
only:
- develop
deploy_production:
stage: deploy
image: alpine:latest
before_script:
- apk add --no-cache aws-cli
script:
- aws ecs update-service --cluster production --service myapp --force-new-deployment
environment:
name: production
url: https://myapp.com
when: manual
only:
- mainJenkins Pipeline
Jenkins Pipeline
// Jenkinsfile
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 1, unit: 'HOURS')
timestamps()
}
environment {
REGISTRY = 'gcr.io'
PROJECT_ID = 'my-project'
IMAGE_NAME = 'myapp'
IMAGE_TAG = "${BUILD_NUMBER}-${GIT_COMMIT.take(7)}"
}
stages {
stage('Checkout') {
steps {
checkout scm
script {
GIT_COMMIT_MSG = sh(
script: "git log -1 --pretty=%B",
returnStdout: true
).trim()
}
}
}
stage('Install') {
steps {
sh 'npm ci'
}
}
stage('Lint') {
steps {
sh 'npm run lint'
}
}
stage('Test') {
steps {
sh 'npm run test:coverage'
publishHTML([
reportDir: 'coverage',
reportFiles: 'index.html',
reportName: 'Coverage Report'
])
}
}
stage('Build Image') {
when {
branch 'main'
}
steps {
script {
sh '''
docker build -t ${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} .
docker tag ${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} \
${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:latest
'''
}
}
}
stage('Push Image') {
when {
branch 'main'
}
steps {
sh '''
docker push ${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
docker push ${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:latest
'''
}
}
stage('Deploy Staging') {
when {
branch 'develop'
}
steps {
sh '''
kubectl set image deployment/myapp myapp=${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} \
-n staging --record
kubectl rollout status deployment/myapp -n staging
'''
}
}
stage('Deploy Production') {
when {
branch 'main'
}
input {
message "Deploy to production?"
ok "Deploy"
}
steps {
sh '''
kubectl set image deployment/myapp myapp=${REGISTRY}/${PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} \
-n production --record
kubectl rollout status deployment/myapp -n production
'''
}
}
}
post {
always {
cleanWs()
}
success {
slackSend(
channel: '#deployments',
message: "Build ${BUILD_NUMBER} succeeded on ${BRANCH_NAME}"
)
}
failure {
slackSend(
channel: '#deployments',
message: "Build ${BUILD_NUMBER} failed on ${BRANCH_NAME}"
)
}
}
}#!/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 cicd-pipeline-setup cover?
cicd-pipeline-setup covers lint, test, artifact build, staging promotion, production gates, caching, and rollback-friendly deploy steps for reliable release pipelines.
When should developers use cicd-pipeline-setup?
Developers should use cicd-pipeline-setup when bootstrapping or hardening CI/CD workflows that must gate releases with tests and safe promotion across staging and production.