Skill

Build Robust Jenkins CI/CD Pipelines

Builds Jenkins declarative pipelines: Kubernetes agents, parallel/matrix builds, credential handling, approval gates, and shared libraries.

Works with jenkinsdockerkubernetesslackgithub

77
Spark score
out of 100
Updated 21 days ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Automate your software delivery with expert Jenkins pipeline development. This asset crafts scalable, maintainable CI/CD pipelines using declarative and scripted Groovy, ensuring efficient builds, deployments, and robust error handling.

Outcomes

What it gets done

01

Develop declarative and scripted Jenkins pipelines

02

Implement agent management and parallel execution

03

Configure error handling, notifications, and security

04

Optimize build performance and integrate shared libraries

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-jenkins-pipeline-builder | bash

Overview

Jenkins Pipeline Builder

Guides building Jenkins declarative CI/CD pipelines - Kubernetes-based agents, parallel and matrix builds, secure credential handling, human approval gates, build caching, and versioned shared libraries. Reach for this when building or hardening a Jenkins pipeline that needs dynamic agents, parallel/matrix execution, secure credentials, approval gates, or shared libraries.

What it does

This skill builds Jenkins CI/CD pipelines using declarative syntax (preferred for maintainability and built-in error handling, with scripted syntax reserved for cases needing advanced control flow). A declarative pipeline structure covers agent selection, environment variables including credential-backed secrets, options (build discarding, timeouts, skipStagesAfterUnstable, timestamps), SCM polling and cron triggers, and staged steps. Agent management covers dynamic Kubernetes pod agents (defining a container spec inline as YAML) and conditional agents restricted to specific branches.

Advanced patterns include parallel stage execution (running unit tests, integration tests, and a security scan concurrently) and matrix builds iterating over multiple axes (e.g. platform x architecture) to produce cross-platform binaries. Post-build handling covers always/success/failure/unstable blocks for workspace cleanup, HTML coverage report publishing, Slack notifications on success, and email notifications with recipient providers on failure.

stage('Test') {
    parallel {
        stage('Unit Tests') { steps { sh 'mvn test' } }
        stage('Security Scan') { steps { sh 'sonar-scanner' } }
    }
}

Credential management uses credentials() bindings in the environment block and withCredentials([...]) for scoped, masked access to registry and deployment secrets within a step. Human-in-the-loop deployment uses an input() step presenting a choice of deployment strategy (blue-green, rolling, canary) and a boolean toggle, gating a production deploy stage restricted to the main branch. Performance patterns include skipping stages via when { anyOf { ... } } conditions and caching Maven's local repository keyed by a hash of pom.xml. Shared library integration (@Library('company-pipeline-library@v2.1.0')) wraps common build/deploy logic (e.g. buildApplication, deployToKubernetes) into reusable, versioned pipeline functions.

When to use - and when NOT to

Use this skill when building or hardening a Jenkins CI/CD pipeline that needs Kubernetes-based dynamic agents, parallel or matrix test/build execution, secure credential handling, human approval gates for production deploys, build caching, or shared pipeline libraries across multiple Jenkinsfiles.

It is not the right fit for a trivial single-stage build with no branching logic, where a minimal declarative pipeline is sufficient, or for CI platforms other than Jenkins, since the Groovy DSL and plugin ecosystem (Blue Ocean, shared libraries, credentials()) are Jenkins-specific.

Inputs and outputs

Input: the build/test/deploy steps needed, target agents (Docker, Kubernetes pods, labeled nodes), credentials required, and any approval or caching requirements. Output: a Jenkinsfile with declarative pipeline structure, agent configuration, parallel/matrix stages, post-build notification handling, secure credential usage, optional production approval gates, build caching, and calls into a versioned shared library for reusable build/deploy logic.

Integrations

Built on Jenkins' declarative pipeline DSL (Groovy-based) with Kubernetes plugin for dynamic pod agents, Jenkins Credentials plugin for secret management, Slack and email (emailext) for notifications, SonarQube (sonar-scanner) for security/quality scanning, and shared pipeline libraries versioned via @Library.

Who it's for

DevOps and platform engineers building or maintaining Jenkins CI/CD pipelines - particularly teams needing Kubernetes-based agents, parallel/matrix builds, secure credential handling, and reusable shared libraries across multiple projects.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.