0
0
Jenkinsdevops~10 mins

Agent types (permanent, cloud) in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Agent types (permanent, cloud)
Start Jenkins Job
Check Agent Type
Permanent
Use Existing
Agent Node
Run Job
Job Complete
Cloud Agent Cleanup
End
Jenkins decides if the job runs on a permanent or cloud agent, then runs the job accordingly. Cloud agents are created and removed dynamically.
Execution Sample
Jenkins
node('permanent-agent') {
  echo 'Running on permanent agent'
}

node('cloud-agent') {
  echo 'Running on cloud agent'
}
Runs a Jenkins job on either a permanent or a cloud agent node.
Process Table
StepAgent TypeActionAgent StateJob State
1PermanentSelect existing permanent agentAgent readyJob queued
2PermanentRun job on permanent agentAgent busyJob running
3PermanentJob completesAgent readyJob complete
4CloudProvision new cloud agentAgent provisioningJob queued
5CloudCloud agent readyAgent readyJob queued
6CloudRun job on cloud agentAgent busyJob running
7CloudJob completesAgent readyJob complete
8CloudCloud agent cleanupAgent removedJob complete
💡 Job finishes on permanent agent or cloud agent; cloud agent is removed after job.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 5After Step 7Final
Agent StateNot assignedBusy (permanent)Ready (permanent)Ready (cloud)Ready (cloud)Removed (cloud)
Job StateNot startedRunningCompleteQueuedCompleteComplete
Key Moments - 2 Insights
Why does the cloud agent get removed after the job but the permanent agent stays?
Cloud agents are created dynamically for each job and removed after to save resources, as shown in steps 4 to 8 in the execution table. Permanent agents are always available and stay ready for new jobs.
What happens if the permanent agent is busy when a job starts?
The job waits in the queue until the permanent agent becomes ready, as indicated by the 'Agent ready' and 'Job queued' states in steps 1 and 2.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the cloud agent get provisioned?
AStep 2
BStep 6
CStep 4
DStep 8
💡 Hint
Check the 'Action' column for 'Provision new cloud agent' in the execution table.
According to the variable tracker, what is the agent state after step 7 for the cloud agent?
ARemoved
BReady
CBusy
DProvisioning
💡 Hint
Look at the 'Agent State' row under 'After Step 7' in the variable tracker.
If the permanent agent is busy, what happens to the job state at step 1?
AJob is queued
BJob runs immediately
CJob fails
DAgent is removed
💡 Hint
Refer to the 'Job State' column at step 1 in the execution table.
Concept Snapshot
Jenkins agents run jobs either on permanent or cloud nodes.
Permanent agents are always available.
Cloud agents are created and removed dynamically per job.
Jobs wait if agents are busy.
Cloud agents save resources by cleaning up after use.
Full Transcript
This visual execution shows how Jenkins handles two types of agents: permanent and cloud. When a job starts, Jenkins checks the agent type. For permanent agents, it uses an existing node that stays ready for jobs. For cloud agents, Jenkins provisions a new node, runs the job, then removes the node to save resources. The execution table traces each step, showing agent and job states. The variable tracker highlights how agent and job states change over time. Key moments clarify why cloud agents are removed and how jobs queue if agents are busy. The quiz tests understanding of provisioning steps, agent states, and job queuing behavior.