DevOps & CI/CD · Module 03
Jenkins Pipeline
Run Jenkins, manage credentials safely, write Declarative Jenkinsfiles from basic to advanced (when, post, parallel, matrix), extend with plugins and spread builds across agents.
What you will learn
- Explain Jenkins' role in CI/CD and run Jenkins LTS in Docker
- Create and use credentials in pipelines without leaking secrets
- Write a Declarative Jenkinsfile with agent, stages, environment, parameters
- Use when, post, parallel, matrix, options timeout and triggers
- Install plugins, integrate SonarQube/email and describe the controller–agent architecture
Lessons
- Jenkins and CI/CD
Jenkins is an open-source automation server that orchestrates build, test and deploy; every commit goes through an automated pipeline instead of late, manual integration.
- Jenkins Credentials
Store secrets in the credentials store under an ID, use them through credentials() or withCredentials so Jenkins masks them in logs; never hard-code them or interpolate them with Groovy.
- Declarative Jenkinsfile Basics
A Jenkinsfile is pipeline as code stored in the repo; Declarative syntax is pipeline → agent → stages → stage → steps, plus environment and parameters.
- Advanced Pipeline Syntax
Per-stage and Docker agents, options timeout, triggers, when, parallel, matrix, input, script blocks and post with always, success, failure, unstable, fixed, regression and cleanup conditions.
- Plugins and the Controller–Agent Architecture
Plugins extend Jenkins (Git, Pipeline, SonarQube, Email Extension…); the controller schedules and hands builds to agents by label, and agents run them on executors.