0
0
Jenkinsdevops~20 mins

Post-build actions in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Post-build Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Post-build Actions in Jenkins

Which of the following best describes the purpose of post-build actions in a Jenkins job?

AThey specify tasks that run after the build completes, such as notifications or archiving artifacts.
BThey define the steps to compile and build the source code before testing.
CThey configure the source code repository and branch to build from.
DThey set environment variables used during the build process.
Attempts:
2 left
💡 Hint

Think about what happens after the build finishes successfully or fails.

💻 Command Output
intermediate
1:30remaining
Result of Archiving Artifacts Post-build

After configuring a Jenkins job to archive the file output.log as a post-build action, what will you see in the Jenkins job page after a successful build?

AThe <code>output.log</code> file will be available for download under the 'Archived Artifacts' section.
BThe build will fail because archiving is not allowed in post-build actions.
CThe <code>output.log</code> file will be deleted from the workspace automatically.
DThe console output will include the contents of <code>output.log</code>.
Attempts:
2 left
💡 Hint

Archiving artifacts means saving files for later access from the build page.

🔀 Workflow
advanced
2:00remaining
Configuring Email Notification as a Post-build Action

You want Jenkins to send an email notification only when a build fails. Which post-build action configuration achieves this?

AAdd 'Post-build Script' to run a shell command that sends email regardless of build status.
BAdd 'Editable Email Notification' post-build action and set triggers to 'Failure'.
CAdd 'Send Email' build step before the build starts.
DAdd 'Email Notification' post-build action and leave triggers empty.
Attempts:
2 left
💡 Hint

Look for a post-build action that supports conditional triggers.

Troubleshoot
advanced
2:00remaining
Troubleshooting Post-build Action Failure

A Jenkins job's post-build action to archive artifacts is not working; no files appear under 'Archived Artifacts' after a successful build. What is the most likely cause?

AThe build steps did not run because the job was disabled.
BThe Jenkins master node is offline.
CThe file pattern specified for archiving does not match any files in the workspace.
DThe post-build action is configured before the build steps.
Attempts:
2 left
💡 Hint

Check if the files you want to archive actually exist after the build.

Best Practice
expert
2:30remaining
Best Practice for Post-build Actions in Pipeline Scripts

In a Jenkins Pipeline script, which is the best way to ensure a post-build action runs regardless of build success or failure?

APlace the post-build action commands at the start of the <code>pipeline</code> block.
BAdd post-build actions only in the Jenkins job configuration UI, not in the pipeline script.
CUse <code>try { ... } catch { ... }</code> blocks inside the <code>stages</code> to run post-build actions.
DUse the <code>post { always { ... } }</code> block to define actions that always run after the build.
Attempts:
2 left
💡 Hint

Look for a pipeline syntax that guarantees execution after all stages.