0
0
Jenkinsdevops~10 mins

Post-build actions in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a post-build action that archives artifacts.

Jenkins
post {
  always {
    archiveArtifacts artifacts: '[1]'
  }
}
Drag options to blanks, or click blank then click option'
A**/*.jar
Bbuild.log
Csrc/**
DREADME.md
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single file name instead of a pattern.
Forgetting to include the wildcard for all folders.
2fill in blank
medium

Complete the code to send an email notification after the build.

Jenkins
post {
  failure {
    mail to: '[1]', subject: 'Build Failed', body: 'Please check the build logs.'
  }
}
Drag options to blanks, or click blank then click option'
Auser@domain.com
Bbuild@localhost
Cdev-team@example.com
Dadmin@company.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using a local or personal email address instead of the team email.
Leaving the email field empty.
3fill in blank
hard

Fix the error in the post-build action that triggers a downstream job.

Jenkins
post {
  success {
    build job: '[1]'
  }
}
Drag options to blanks, or click blank then click option'
ADeployApp
Bdeployapp
CDeploy_App
Ddeploy-app
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect separators in job names.
Misspelling the job name.
4fill in blank
hard

Fill both blanks to add a post-build action that triggers only when the build is unstable and waits for completion.

Jenkins
post {
  unstable {
    build job: '[1]', wait: [2]
  }
}
Drag options to blanks, or click blank then click option'
ARunTests
Btrue
Cfalse
DDeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Setting wait to false when you want to wait.
Using a job name unrelated to testing or unstable builds.
5fill in blank
hard

Fill all three blanks to archive logs only if the build is successful and notify the team.

Jenkins
post {
  success {
    archiveArtifacts artifacts: '[1]'
    mail to: '[2]', subject: '[3]'
  }
}
Drag options to blanks, or click blank then click option'
A**/logs/*.log
Bqa-team@example.com
CBuild Success Notification
Ddev-team@example.com
Attempts:
3 left
💡 Hint
Common Mistakes
Using the QA team email instead of the dev team.
Incorrect artifact pattern that misses log files.