
Jenkins Pipeline
- 1.1k installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
jenkins-pipeline is a prompt skill for Jenkins declarative pipeline Jenkinsfile authoring.
About
The jenkins-pipeline skill provides prompt templates and patterns for authoring Jenkins declarative pipelines with checkout, build, test, artifact archive, and deployment stages. It documents agent labels, environment blocks, parallel stages, credentials binding, and post actions for success or failure notifications. Agents scaffold Jenkinsfiles aligned with common stack patterns while keeping secrets in Jenkins credential stores instead of plaintext. The skill helps teams modernize freestyle jobs into pipeline-as-code with reproducible stage boundaries and clear failure diagnostics.
- Declarative Jenkins pipeline Jenkinsfile patterns.
- Checkout, build, test, archive, and deploy stages.
- Parallel stages, credentials binding, and post actions.
- Secrets via Jenkins credential stores, not plaintext.
- Pipeline-as-code migration from freestyle jobs.
Jenkins Pipeline by the numbers
- 1,100 all-time installs (skills.sh)
- +28 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #173 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
What jenkins-pipeline says it does
Jenkins pipeline
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill jenkins-pipelineAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1.1k |
|---|---|
| repo stars | ★ 305 |
| Security audit | 3 / 3 scanners passed |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How should I structure this Jenkins pipeline for build, test, and deploy?
Author Jenkins declarative pipeline Jenkinsfiles for build, test, and deploy stages.
Who is it for?
Teams writing or migrating Jenkins pipeline-as-code jobs.
Skip if: Skip for GitHub Actions or GitLab CI when Jenkins is not the target.
When should I use this skill?
User authors or refactors Jenkins declarative pipelines and Jenkinsfiles.
What you get
Declarative Jenkinsfile with staged workflow and credential-safe configuration.
- Jenkinsfile
- declarative pipeline stages
- parameterized deploy configuration
Files
Jenkins Pipeline
Table of Contents
Overview
Create enterprise-grade Jenkins pipelines using declarative and scripted approaches to automate building, testing, and deploying with advanced control flow.
When to Use
- Enterprise CI/CD infrastructure
- Complex multi-stage builds
- On-premise deployment automation
- Parameterized builds
Quick Start
Minimal working example:
pipeline {
agent { label 'linux-docker' }
environment {
REGISTRY = 'docker.io'
IMAGE_NAME = 'myapp'
}
parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging')
}
stages {
stage('Checkout') { steps { checkout scm } }
stage('Install') { steps { sh 'npm ci' } }
stage('Lint') { steps { sh 'npm run lint' } }
stage('Test') {
steps {
sh 'npm run test:coverage'
junit 'test-results.xml'
}
}
stage('Build') {
steps {
sh 'npm run build'
archiveArtifacts artifacts: 'dist/**/*'
}
}
// ... (see reference guides for full implementation)Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Declarative Pipeline (Jenkinsfile) | Declarative Pipeline (Jenkinsfile) |
| Scripted Pipeline | Scripted Pipeline (Groovy), Multi-Branch Pipeline, Parameterized Pipeline, Pipeline with Credentials |
Best Practices
✅ DO
- Use declarative pipelines for clarity
- Use credentials plugin for secrets
- Archive artifacts and reports
- Implement approval gates for production
- Keep pipelines modular and reusable
❌ DON'T
- Store credentials in pipeline code
- Ignore pipeline errors
- Skip test coverage reporting
- Use deprecated plugins
Declarative Pipeline (Jenkinsfile)
Declarative Pipeline (Jenkinsfile)
pipeline {
agent { label 'linux-docker' }
environment {
REGISTRY = 'docker.io'
IMAGE_NAME = 'myapp'
}
parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging')
}
stages {
stage('Checkout') { steps { checkout scm } }
stage('Install') { steps { sh 'npm ci' } }
stage('Lint') { steps { sh 'npm run lint' } }
stage('Test') {
steps {
sh 'npm run test:coverage'
junit 'test-results.xml'
}
}
stage('Build') {
steps {
sh 'npm run build'
archiveArtifacts artifacts: 'dist/**/*'
}
}
stage('Deploy') {
when { branch 'main' }
steps {
sh 'kubectl set image deployment/app app=${REGISTRY}/${IMAGE_NAME}:latest'
}
}
}
post {
always { cleanWs() }
failure { echo 'Pipeline failed!' }
}
}Scripted Pipeline
Scripted Pipeline (Groovy)
// Jenkinsfile - Scripted Pipeline
node('linux-docker') {
def imageTag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
def registry = 'docker.io'
try {
stage('Checkout') { checkout scm }
stage('Install') { sh 'npm ci' }
stage('Test') { sh 'npm test' }
stage('Build') { sh 'npm run build' }
currentBuild.result = 'SUCCESS'
} catch (Exception e) {
currentBuild.result = 'FAILURE'
error("Build failed: ${e.message}")
}
}Multi-Branch Pipeline
pipeline {
agent any
stages {
stage('Build') { steps { sh 'npm run build' } }
stage('Test') { steps { sh 'npm test' } }
stage('Deploy') {
when { branch 'main' }
steps { sh 'npm run deploy:prod' }
}
}
}Parameterized Pipeline
pipeline {
agent any
parameters {
string(name: 'VERSION', defaultValue: '1.0.0', description: 'Version to release')
choice(name: 'ENV', choices: ['staging', 'prod'], description: 'Deployment environment')
}
stages {
stage('Build') { steps { sh 'npm run build' } }
stage('Test') { steps { sh 'npm test' } }
stage('Deploy') {
steps { sh "npm run deploy:${params.ENV}" }
}
}
}Pipeline with Credentials
pipeline {
agent any
environment {
DOCKER_CREDS = credentials('docker-hub')
}
stages {
stage('Build & Push') {
steps {
sh '''
echo $DOCKER_CREDS_PSW | docker login -u $DOCKER_CREDS_USR --password-stdin
docker build -t myapp:latest .
docker push myapp:latest
'''
}
}
}
}#!/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
Which pipeline syntax?
Jenkins declarative pipeline Jenkinsfile patterns.
How are secrets handled?
Bind Jenkins credentials stores; avoid plaintext secrets in Jenkinsfiles.
What stages are typical?
Checkout, build, test, artifact archive, and deployment with post actions.
Is Jenkins Pipeline safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.