jenkins-pipeline
aj-geddes/useful-ai-prompts
Build enterprise Jenkins pipelines with declarative and scripted syntax for CI/CD automation.
What is jenkins-pipeline?
This skill enables you to create and configure Jenkins pipelines using both declarative and scripted approaches. Use it to automate building, testing, and deploying applications with multi-stage workflows, parameters, credentials, and deployment gates.
- Define declarative and scripted pipelines with stages and agents
- Configure environment variables, parameters, and credentials securely
- Implement multi-branch pipelines for complex workflows
- Archive artifacts and generate test reports
- Set up approval gates and conditional deployment logic
- Integrate with Docker, plugins, and on-premise infrastructure
How to install jenkins-pipeline
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill jenkins-pipeline- Jenkins server installed and configured
- Jenkins Pipeline plugin enabled
- Access to Jenkins UI or Jenkinsfile repository
- Docker or build agent labels configured (optional)
How to use jenkins-pipeline
- 1.Define a Jenkinsfile in your repository root using declarative or scripted syntax
- 2.Configure agent labels to specify where pipeline stages run
- 3.Add environment variables and parameters for build configuration
- 4.Implement stages for checkout, build, test, and deploy steps
- 5.Use credentials plugin to securely manage secrets and API tokens
- 6.Archive artifacts and test reports for visibility
- 7.Add approval gates or conditions for production deployments
- 8.Trigger pipeline from SCM webhooks or manual execution
Use cases
- Enterprise CI/CD pipelines for multi-stage builds and deployments
- Parameterized builds with environment-specific configurations
- Multi-branch pipelines for feature branches and release management
- Automated testing and artifact archival in deployment workflows
- On-premise deployment automation with approval gates
- DevOps engineers
- CI/CD pipeline architects
- Enterprise software teams
- Infrastructure automation specialists
jenkins-pipeline FAQ
Declarative pipelines use a structured, predefined syntax with clear sections (agent, stages, post) and are easier to read and maintain. Scripted pipelines use Groovy code for more flexibility and complex control flow but require more expertise.
Use the Jenkins Credentials plugin to store secrets, then reference them in your pipeline using the credentials() function or withCredentials() block. Never hardcode credentials in Jenkinsfile.
Yes. You can specify agent labels at the pipeline level or override them per stage using agent { label 'agent-name' } to run stages on different machines or Docker containers.
Use the junit step to parse test reports and archiveArtifacts to save build outputs. Both are typically placed in the post section or relevant stage steps.
Approval gates pause pipeline execution and require manual approval before proceeding. Implement them using the input step in a stage to block deployment until an authorized user approves.
Full instructions (SKILL.md)
Source of truth, from aj-geddes/useful-ai-prompts.
name: jenkins-pipeline description: > Build Jenkins declarative and scripted pipelines with stages, agents, parameters, and plugins. Implement multi-branch pipelines and deployment automation.
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
Related skills
More from aj-geddes/useful-ai-prompts and the wider catalog.

kubernetes-deployment
>

markdown-documentation
Master markdown formatting and GitHub Flavored Markdown for professional documentation.

mobile-app-testing
>

mobile-first-design
>

nginx-configuration
Configure Nginx for reverse proxy, load balancing, SSL/TLS, caching, and API gateway functionality.

nodejs-express-server
Build production-ready Express.js servers with routing, middleware, authentication, and database integration.