0
0
Jenkinsdevops~20 mins

Agent availability and offline handling in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Agent Availability Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Jenkins Agent Offline Causes

Which of the following is NOT a common reason for a Jenkins agent to go offline?

AAgent is configured with an incorrect label
BAgent machine running out of disk space
CJenkins master running out of memory
DNetwork connectivity issues between the master and the agent
Attempts:
2 left
💡 Hint

Think about what causes communication failure versus configuration mismatches.

💻 Command Output
intermediate
2:00remaining
Jenkins CLI Agent Offline Status Command Output

What is the output of the following Jenkins CLI command when the agent named 'build-agent-1' is offline?

java -jar jenkins-cli.jar -s http://jenkins.example.com/ list-agents
Abuild-agent-1 (offline)
Bbuild-agent-1 (online)
CError: Agent build-agent-1 not found
Dbuild-agent-1 (idle)
Attempts:
2 left
💡 Hint

Offline agents are usually marked explicitly in the list.

Configuration
advanced
2:30remaining
Configuring Jenkins Agent to Automatically Reconnect

Which configuration snippet in the Jenkins agent launch method ensures the agent automatically tries to reconnect if disconnected?

Ajava -jar agent.jar -jnlpUrl http://jenkins.example.com/computer/agent/slave-agent.jnlp -workDir "/home/jenkins/agent"
Bjava -jar agent.jar -jnlpUrl http://jenkins.example.com/computer/agent/slave-agent.jnlp -workDir "/home/jenkins/agent" -noReconnect
Cjava -jar agent.jar -jnlpUrl http://jenkins.example.com/computer/agent/slave-agent.jnlp -workDir "/home/jenkins/agent" -retry 5
Djava -jar agent.jar -jnlpUrl http://jenkins.example.com/computer/agent/slave-agent.jnlp -workDir "/home/jenkins/agent" -retry 0
Attempts:
2 left
💡 Hint

Look for options that control retry or reconnect behavior.

Troubleshoot
advanced
2:30remaining
Diagnosing Jenkins Agent Offline Due to Firewall

A Jenkins agent suddenly goes offline. The agent machine's firewall was recently updated. Which troubleshooting step is most effective to confirm if the firewall is causing the offline status?

ACheck Jenkins master logs for connection timeout errors
BTemporarily disable the firewall on the agent machine and try reconnecting
CRestart the Jenkins master service
DReboot the agent machine
Attempts:
2 left
💡 Hint

Think about isolating the firewall as the cause.

🔀 Workflow
expert
3:00remaining
Handling Jenkins Agent Offline in a CI/CD Pipeline

In a Jenkins pipeline, you want to ensure that if the assigned agent goes offline during a build, the pipeline automatically retries on another available agent. Which pipeline script snippet correctly implements this behavior?

A
pipeline {
  agent { label 'linux' }
  stages { stage('Build') { steps { echo 'Building...' } } }
  options { skipDefaultCheckout() }
}
B
pipeline {
  agent any
  options { retry(3) }
  stages { stage('Build') { steps { echo 'Building...' } } }
}
C
pipeline {
  agent { label 'linux' }
  stages { stage('Build') { steps { echo 'Building...' } } }
  post { failure { retry(3) { echo 'Retrying build...' } } }
}
D
pipeline {
  agent { label 'linux' }
  stages { stage('Build') { steps { retry(3) { echo 'Building...' } } } }
}
Attempts:
2 left
💡 Hint

Look for retry inside the build steps to retry on failure.