Jenkins Icon

Jenkins Basics

Essential Jenkins for continuous integration and delivery

What is Jenkins?

Jenkins is an open-source automation server that helps automate the parts of software development related to building, testing, and deploying. It's a key tool in implementing Continuous Integration and Continuous Delivery (CI/CD).

Think of Jenkins as your automated assistant that builds, tests, and deploys your code whenever changes are made.

Jenkins Infrastructure

Master Server

The Jenkins master is the central control unit that manages all aspects of your build system.

  • Schedules and coordinates build jobs
  • Manages user interfaces and configuration
  • Distributes work to agents
  • Stores build results and artifacts

Agents/Minions

Agents are worker machines that perform the actual build tasks assigned by the master.

  • Execute build steps
  • Run tests and compile code
  • Can be on different operating systems
  • Can have different tools installed

How Jenkins Works

1. Commit Triggers Pipeline

Developer pushes code changes

2. Agent Selected

Based on configured labels

3. Agent Runs Build

Executes the pipeline steps

Agent Types

Permanent Agents

These are dedicated servers always available to run Jenkins jobs.

  • Always running and connected to the master
  • Good for stable, predictable workloads
  • Can have specialized tools installed
  • Typically physical machines or long-running VMs

Best for: Teams with consistent build needs and specialized environments

Cloud Agents

These are temporary agents created on-demand in cloud environments.

  • Ephemeral/Dynamic agents spun up when needed
  • Automatically terminated after job completion
  • Cost-effective for variable workloads
  • Can scale based on demand

Best for: Teams with fluctuating build needs or using cloud infrastructure like AWS, Azure, or GCP

Build Types

Freestyle Build

The simplest way to create a build in Jenkins, perfect for straightforward projects.

  • Simple configuration through web UI
  • Feels like shell scripting with a GUI
  • Uses Groovy syntax for advanced features
  • Use stages to break down components of builds

Good for: Simple projects, one-off tasks, or when you're just getting started with Jenkins

Pipelines

A more advanced approach that models your entire build process as code.

  • Defined as code in a Jenkinsfile
  • Can be version controlled with your project
  • Supports complex workflows with parallel execution
  • Provides better visualization of the build process

Good for: Complex projects, teams practicing Infrastructure as Code, or when you need advanced workflow control

Getting Started with Jenkins

1. Install Jenkins

Download and install Jenkins on your server or use a Docker container.

2. Configure Your First Job

Create a freestyle project or pipeline to build your application.

3. Run and Monitor

Execute your build and monitor the results through the Jenkins dashboard.