Jenkins Jenkins Agents and Distributed Builds 1 — Questions and Answers
Question 1: What is a Jenkins agent (formerly called slave)?
- A secondary Jenkins controller
- A machine that connects to the Jenkins controller to run build jobs (Correct answer)
- A plugin that orchestrates parallel builds
- A Docker container running the Jenkins server
Correct answer: A machine that connects to the Jenkins controller to run build jobs
A Jenkins agent is a machine (physical, virtual, or container) that connects to the controller and executes builds assigned to it.
Question 2: What protocol does Jenkins use by default to communicate with agents?
- SSH
- JNLP/Remoting protocol (TCP) (Correct answer)
- WebSocket
- REST over HTTP
Correct answer: JNLP/Remoting protocol (TCP)
Jenkins uses the Remoting protocol over TCP (JNLP) by default for controller-to-agent communication, with WebSocket as an alternative.
Question 3: What is a Jenkins label used for in relation to agents?
- Naming build artifacts
- Associating jobs or pipeline stages with specific agents or agent groups that have matching labels (Correct answer)
- Tagging source code commits
- Identifying plugin versions
Correct answer: Associating jobs or pipeline stages with specific agents or agent groups that have matching labels
Labels are applied to agents and referenced in jobs or pipeline `agent` directives to route builds to agents with specific capabilities.
Question 4: What does the `agent { label 'linux' }` directive do in a Declarative Pipeline?
- Installs the Linux OS on a new agent
- Runs the pipeline on any agent with the 'linux' label (Correct answer)
- Creates a new Docker agent named linux
- Restricts the pipeline to run only on the controller
Correct answer: Runs the pipeline on any agent with the 'linux' label
The `label 'linux'` agent directive tells Jenkins to run the pipeline on any available agent that has been tagged with the 'linux' label.
Question 5: What is the Jenkins agent.jar (remoting.jar) file?
- The Jenkins war file
- The Java executable that runs on the agent machine and communicates with the controller (Correct answer)
- A plugin for agent management
- The Jenkins CLI client
Correct answer: The Java executable that runs on the agent machine and communicates with the controller
The agent.jar (remoting.jar) is the Java process launched on the agent machine that establishes and manages communication with the Jenkins controller.
Question 6: Which agent connection method allows Jenkins to initiate the connection to the agent via SSH?
- JNLP inbound agent
- SSH Build Agents (Launch via SSH) (Correct answer)
- WebSocket agent
- Cloud agent
Correct answer: SSH Build Agents (Launch via SSH)
The SSH Build Agents method lets the Jenkins controller SSH into the agent machine and launch the remoting jar automatically.
What is a Jenkins agent (formerly called slave)?