Skip to main content

Introduction to Jenkins


What is Jenkins?

Jenkins is an open-source automation server written in Java. It automates the repetitive tasks of the software development lifecycle:

  • Build: Compiling the code
  • Test: Running automated tests
  • Analysis: Code quality (SonarQube, linting)
  • Deployment: Releasing to production

CI/CD with Jenkins

Continuous Integration (CI)

Continuous Deployment (CD)


Architecture

Main components

Controller (Master)

The Jenkins controller:

  • Manages the web interface
  • Schedules builds
  • Stores the configuration
  • Distributes tasks to the agents

Agents (Slaves)

Agents run the builds:

  • Can be on different platforms
  • Connect to the controller via JNLP or SSH
  • Can be static or dynamic (cloud)

Key concepts

Job / Project

A job is an automated task. Job types:

TypeDescriptionUsage
FreestyleConfiguration via UISimple jobs
PipelineGroovy code (Jenkinsfile)Complex CI/CD
MultibranchOne pipeline per branchGit projects
FolderJob organizationStructure

Build

A build is an execution of a job. Each build has:

  • A unique number (#1, #2, ...)
  • A status (Success, Failure, Unstable, Aborted)
  • Logs
  • Artifacts (optional)

Workspace

The workspace is the working directory where the code is cloned and the build runs.

/var/jenkins_home/workspace/
├── my-project/
│ ├── src/
│ ├── pom.xml
│ └── target/
└── another-project/

Artifact

An artifact is a file produced by a build:

  • Java JAR/WAR
  • Compiled binaries
  • Docker images
  • Test reports

Jenkins vs other CI/CD tools

AspectJenkinsGitHub ActionsGitLab CICircleCI
HostingSelf-hostedCloudCloud/SelfCloud
ConfigurationJenkinsfile/UIYAMLYAMLYAML
Plugins1800+ActionsBuilt-inOrbs
CostFreeFreemiumFreemiumPaid
Learning curveMediumEasyEasyEasy
Flexibility⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
When to choose Jenkins?
  • On-premise infrastructure required
  • Need for extreme customization
  • Specific (legacy) integrations
  • Full control over the environment

Typical workflow


Terminology

TermDescription
ControllerMain Jenkins server
AgentBuild execution node
JobAutomated task
BuildExecution of a job
PipelineCI/CD workflow as code
StageStep of a pipeline
StepAction within a stage
WorkspaceWorking directory
ArtifactProduced file
PluginJenkins extension

Benefits of Jenkins

1. Open Source and free

# Pas de licence à payer
# Communauté active
# Documentation abondante

2. Extensibility

More than 1800 plugins for:

  • SCM integrations (Git, SVN, Mercurial)
  • Build tools (Maven, Gradle, npm)
  • Cloud (AWS, Azure, GCP)
  • Containers (Docker, Kubernetes)
  • Notifications (Slack, Email, Teams)
  • Quality (SonarQube, Checkmarx)

3. Pipeline as Code

// Jenkinsfile versionné avec le code
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
stage('Deploy') {
steps {
sh 'kubectl apply -f k8s/'
}
}
}
}

4. Scalability

  • Distributed master/agents architecture
  • Dynamic agents (Kubernetes, Docker, EC2)
  • Build parallelization

Limitations of Jenkins

LimitationMitigation
Dated interfaceBlue Ocean plugin
Complex configurationJenkins Configuration as Code
Server maintenanceJenkins on Kubernetes
Sometimes unstable pluginsLTS versions
Groovy learning curveShared Libraries

Summary

  • Jenkins is an open-source CI/CD automation server
  • Master/agent architecture for scalability
  • Pipeline as Code with Jenkinsfile
  • Rich plugin ecosystem
  • Ideal for on-premise environments

← Table of contents | Installation →