๐ Jenkins Summary Guide
๐ Jenkins Summary Guide
I. What is Jenkins?
Jenkins is an open-source automation server used to automate the building, testing, and deploying of software. It supports Continuous Integration (CI) and Continuous Delivery/Deployment (CD) through a wide range of plugins.
II. Core Concepts
-
CI/CD
-
Continuous Integration (CI): Automatically integrating code changes into a shared repository.
-
Continuous Delivery (CD): Automatically preparing code for release.
-
Continuous Deployment: Automatically releasing code into production.
-
-
Pipeline
A series of automated steps (like build, test, deploy) defined as code using aJenkinsfile
. -
Job / Project
A runnable task in Jenkins (Freestyle or Pipeline). -
Build
A single execution of a job.
III. Jenkins Architecture
-
Master (Controller)
-
Manages job scheduling, dispatches builds to agents, stores job config and logs.
-
Provides the UI and REST API.
-
-
Agent (Node/Slave)
-
Executes the builds assigned by the master.
-
Can be Linux, Windows, or Docker-based.
-
-
Executor
-
A single task runner within a node.
-
A node may have multiple executors (parallel tasks).
-
IV. Jenkinsfile (Pipeline as Code)
A Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline and is typically stored in a Git repository.
Two Pipeline Syntax Types:
-
Declarative Pipeline (Recommended)
Easier to read and write. Example: -
Scripted Pipeline
Uses full Groovy scripting and offers more flexibility.
V. Jenkins Job Types
-
Freestyle Project
Simple job with GUI-based configuration. -
Pipeline Project
Defined viaJenkinsfile
; supports complex workflows and stages. -
Multibranch Pipeline
Automatically creates pipelines for each branch in a Git repository. -
Folder
Organizes jobs and configurations hierarchically.
VI. Plugins
Jenkins is highly extensible through plugins. Common types:
-
SCM Plugins: Git, GitHub, Bitbucket
-
Build Tools: Maven, Gradle, Ant
-
Notifiers: Slack, Email
-
Container Tools: Docker, Kubernetes
-
Test Reports: JUnit, Allure
VII. Important Jenkins Concepts
Concept | Description |
---|---|
Agent | Machine that runs builds. |
Workspace | Directory where Jenkins builds code. |
Artifacts | Files generated by a build (e.g., .jar , .war ). |
SCM (Source Control Management) | Integrates Git, SVN, etc. |
Parameters | User input or variables for builds. |
Triggers | Start jobs automatically (e.g., on Git push, schedule). |
Post-actions | Steps that run after stages (e.g., always, success, failure). |
VIII. Security in Jenkins
-
Users & Roles
Manage via Matrix Authorization Strategy or Role-Based Plugin. -
Authentication
Integrates with LDAP, Active Directory, GitHub, etc. -
Credentials
Stores secrets like passwords, tokens, and SSH keys.
IX. Jenkins Deployment Options
-
Standalone WAR file:
java -jar jenkins.war
-
As a System Service (e.g., via Linux package manager)
-
In a Container (Docker)
-
In the Cloud (e.g., Jenkins on Kubernetes or AWS)
X. Best Practices
-
Use Pipelines as Code (
Jenkinsfile
). -
Keep master lightweight; offload builds to agents.
-
Use shared libraries for common functions.
-
Secure credentials using Jenkins Credentials Manager.
-
Use folders and multibranch pipelines for large repos.
-
Archive artifacts and store test reports.
-
Monitor with plugins like Prometheus, Audit Trail.
Comments
Post a Comment