0
0
Jenkinsdevops~3 mins

Why Agent types (permanent, cloud) in Jenkins? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your Jenkins could magically add helpers only when work piles up, then disappear when done?

The Scenario

Imagine you have a busy bakery where every cake must be baked by hand in the same oven, one after another.

When orders pile up, the single oven slows everything down, and you can't easily add more ovens without a lot of hassle.

The Problem

Using only permanent agents in Jenkins is like having just one oven: it can get overwhelmed, and setting up new agents takes time and effort.

This causes delays, wasted resources, and frustration when many tasks need to run at once.

The Solution

Agent types like permanent and cloud let Jenkins flexibly handle work.

Permanent agents are always ready, like your main oven, while cloud agents can be created on demand, like renting extra ovens only when needed.

This balance speeds up work and saves resources.

Before vs After
Before
node {
  // runs only on one permanent agent
  stage('Build') {
    sh 'make build'
  }
}
After
pipeline {
  agent none
  stages {
    stage('Build') {
      agent { label 'permanent-agent' }
      steps { sh 'make build' }
    }
    stage('Test') {
      agent { label 'cloud-agent' }
      steps { sh 'make test' }
    }
  }
}
What It Enables

It enables Jenkins to handle many tasks efficiently by using fixed agents for steady work and cloud agents for flexible, on-demand scaling.

Real Life Example

A software team uses permanent agents for daily builds and spins up cloud agents to run extra tests only when a big feature is ready, saving time and money.

Key Takeaways

Permanent agents are always available but limited in number.

Cloud agents start and stop as needed, offering flexibility.

Using both types together makes Jenkins faster and more efficient.