0
0
Jenkinsdevops~20 mins

Build history and logs in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Build History and Logs Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins Build History Command Output
What is the output of the following Jenkins CLI command when run on a job with 3 completed builds?
Jenkins
java -jar jenkins-cli.jar -s http://localhost:8080/ list-builds my-job
A
Build #3 SUCCESS
Build #2 FAILURE
Build #1 SUCCESS
B
Build #1 SUCCESS
Build #2 FAILURE
Build #3 SUCCESS
CNo builds found
DError: Job 'my-job' not found
Attempts:
2 left
💡 Hint
Jenkins CLI lists builds in descending order by default.
Troubleshoot
intermediate
2:00remaining
Troubleshooting Missing Build Logs
A Jenkins user reports that build logs for a specific job are missing from the Jenkins UI. Which of the following is the most likely cause?
AThe Jenkins master has run out of disk space and deleted old logs
BThe job was never executed
CThe Jenkins agent is offline
DThe build was triggered manually
Attempts:
2 left
💡 Hint
Jenkins may delete old logs automatically when disk space is low.
Configuration
advanced
2:30remaining
Configuring Build Log Retention
Which configuration snippet in a Jenkins Pipeline script correctly sets the build log retention to keep logs for 10 days and a maximum of 5 builds?
Jenkins
pipeline {
  agent any
  options {
    // Your configuration here
  }
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
}
AdiscardOldBuilds(days: 10, maxBuilds: 5)
BbuildDiscarder(logRotator(daysToKeepStr: '10', numToKeepStr: '5'))
ClogRetention(days: 10, builds: 5)
DkeepBuilds(daysToKeep: 10, maxBuildsToKeep: 5)
Attempts:
2 left
💡 Hint
Use the 'buildDiscarder' option with 'logRotator' in declarative pipelines.
🔀 Workflow
advanced
2:00remaining
Accessing Build Logs via REST API
Which HTTP request correctly retrieves the console log of build number 15 for a Jenkins job named 'deploy-app'?
AGET http://jenkins-server/api/json/job/deploy-app/build/15/log
BPOST http://jenkins-server/job/deploy-app/builds/15/log
CGET http://jenkins-server/job/deploy-app/15/consoleText
DGET http://jenkins-server/job/deploy-app/console/15
Attempts:
2 left
💡 Hint
Jenkins exposes console logs at the 'consoleText' endpoint for a build.
Best Practice
expert
3:00remaining
Best Practice for Managing Jenkins Build Logs in Large Environments
In a large Jenkins environment with many jobs and builds, what is the best practice to efficiently manage build history and logs?
ADisable build logs to save disk space and rely on external monitoring tools
BKeep all build logs indefinitely on the Jenkins master to ensure full history
CManually delete old build logs weekly to free up space
DConfigure build discarders to limit log retention and archive important artifacts externally
Attempts:
2 left
💡 Hint
Automate log retention and use external storage for important data.