Bird
Raised Fist0
Jenkinsdevops~20 mins

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

Choose your learning style10 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.

Practice

(1/5)
1. What does the Build History section in Jenkins primarily show?
easy
A. The configuration settings of the Jenkins server
B. The detailed logs of the current build
C. A list of past builds with their results and status
D. The list of users who accessed Jenkins

Solution

  1. Step 1: Understand the purpose of Build History

    The Build History section shows a timeline of previous builds with their success or failure status.
  2. Step 2: Differentiate from build logs and settings

    Build logs show detailed steps, not the summary list. Configuration and user lists are separate sections.
  3. Final Answer:

    A list of past builds with their results and status -> Option C
  4. Quick Check:

    Build History = past build results [OK]
Hint: Build History = summary of past builds, not logs [OK]
Common Mistakes:
  • Confusing Build History with build logs
  • Thinking Build History shows Jenkins settings
  • Assuming Build History lists users
2. Which Jenkins UI element do you click to view the detailed logs of a specific build?
easy
A. The build number link in Build History
B. The 'Configure' button on the job page
C. The 'New Item' button on the dashboard
D. The 'Manage Jenkins' link

Solution

  1. Step 1: Identify where build logs are accessed

    Clicking the build number in Build History opens that build's details including logs.
  2. Step 2: Exclude unrelated UI elements

    'Configure' edits job settings, 'New Item' creates jobs, 'Manage Jenkins' is for admin tasks.
  3. Final Answer:

    The build number link in Build History -> Option A
  4. Quick Check:

    Build logs accessed via build number link [OK]
Hint: Click build number in history to see logs [OK]
Common Mistakes:
  • Clicking 'Configure' instead of build number
  • Trying 'New Item' to see logs
  • Using 'Manage Jenkins' for build logs
3. Given a Jenkins job with three builds: #1 (SUCCESS), #2 (FAILURE), #3 (SUCCESS). What will the Build History show after build #3 completes?
medium
A. Build #3 FAILURE, Build #2 SUCCESS, Build #1 FAILURE
B. Build #1 SUCCESS, Build #2 FAILURE, Build #3 SUCCESS
C. Build #2 FAILURE only
D. Build #3 SUCCESS, Build #2 FAILURE, Build #1 SUCCESS

Solution

  1. Step 1: Understand Build History order

    Build History lists builds in reverse order: newest first.
  2. Step 2: Match build statuses and order

    Build #3 is latest and successful, then #2 failed, then #1 successful.
  3. Final Answer:

    Build #3 SUCCESS, Build #2 FAILURE, Build #1 SUCCESS -> Option D
  4. Quick Check:

    Newest builds appear first in history [OK]
Hint: Build History shows newest builds first [OK]
Common Mistakes:
  • Reading builds oldest to newest
  • Mixing up build statuses
  • Assuming only failed builds show
4. You try to view build logs but see an empty page. What is the most likely cause?
medium
A. You clicked the wrong build number
B. The build has not started or produced logs yet
C. Jenkins server is offline
D. You lack permission to view logs

Solution

  1. Step 1: Consider build status and logs availability

    If the build is queued or just started, logs may be empty.
  2. Step 2: Exclude other causes

    Wrong build number still shows logs if build exists; server offline shows error; permission issues show access denied.
  3. Final Answer:

    The build has not started or produced logs yet -> Option B
  4. Quick Check:

    Empty logs usually mean build not started [OK]
Hint: Empty logs = build not started or no output yet [OK]
Common Mistakes:
  • Assuming server offline causes empty logs
  • Thinking wrong build number shows empty logs
  • Ignoring permission errors
5. You want to analyze why a Jenkins build failed by checking logs but the logs are very long. Which Jenkins feature helps you quickly find errors in the logs?
hard
A. The 'Console Output' search box to filter keywords
B. The 'Build History' to rerun the build
C. The 'Configure' page to edit build steps
D. The 'Manage Jenkins' to restart the server

Solution

  1. Step 1: Identify how to search logs

    Jenkins Console Output page often has a search/filter box to find keywords like 'error'.
  2. Step 2: Exclude unrelated features

    Build History shows past builds but no search; Configure edits jobs; Manage Jenkins is for admin tasks.
  3. Final Answer:

    The 'Console Output' search box to filter keywords -> Option A
  4. Quick Check:

    Use Console Output search to find errors fast [OK]
Hint: Use Console Output search box to find errors fast [OK]
Common Mistakes:
  • Trying to find errors via Build History
  • Editing job instead of checking logs
  • Restarting Jenkins unnecessarily
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard