Using an External Agent in a Freestyle Job
Ensure your external Ubuntu agent is online and labeled correctly before proceeding.Verify the agent’s status under Manage Jenkins > Manage Nodes and confirm that SSH connectivity and labels are configured.
1. Inspect Available Nodes
Navigate to Manage Jenkins > Manage Nodes to view connected agents:
2. Create a New Freestyle Job
- Click New Item, enter
freestyle-external-agent, and select Freestyle project:

- In the job configuration, add a Build Step → Execute shell:

3. Restrict Execution to the Ubuntu Agent
Copy theubuntu-agent label:


Label expressions are case-sensitive. A mismatch will cause the job to remain in the queue.
4. Save and Build
After saving, trigger a build. The job will run on the external agent:

Console Output
Using an External Agent in a Pipeline Job
Next, we’ll build a Declarative Pipeline using both the Jenkins controller and the Ubuntu agent.1. Clone or Migrate Your Repository
Point Jenkins to your Git repo containingJenkinsfile:

2. Add a Declarative Jenkinsfile
Place this in your repository root:
3. Configure and Run the Pipeline
- In Jenkins, create a Pipeline job and point it to the main branch of your repo.
- Save and click Build Now.
Console Output Highlights
Verifying Agent Workspaces
SSH into your Ubuntu agent and list workspace directories:Job and Agent Summary
| Job Type | Agent Label | Key Commands |
|---|---|---|
| Freestyle-External-Agent | ubuntu-docker-jdk17-node20 | cat /etc/os-release, node -v, npm -v |
| Pipeline Stage “S1” | any (controller) | cat /etc/os-release, node -v, npm -v |
| Pipeline Stage “S2” | ubuntu-docker-jdk17-node20 | cat /etc/os-release, node -v, npm -v |