0
0
Jenkinsdevops~10 mins

Disk space management 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 disable deferred wipeout in the Jenkins workspace cleanup step.

Jenkins
steps {
  cleanWs(disableDeferredWipeout: [1])
}
Drag options to blanks, or click blank then click option'
AdisableDeferredWipeout()
BdisableDeferredWipeout
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
disableDeferredWipeout() or disableDeferredWipeout without ': true' causes a syntax error.
Using false keeps the default deferred wipeout behavior.
2fill in blank
medium

Complete the code to delete old builds after 10 days.

Jenkins
properties {
  buildDiscarder(logRotator([1]: 10))
}
Drag options to blanks, or click blank then click option'
AdaysToKeep
BdaysToKeepStr
CnumToKeep
DartifactDaysToKeep
Attempts:
3 left
💡 Hint
Common Mistakes
Using daysToKeepStr instead of daysToKeep causes type errors.
Using numToKeep controls number of builds, not days.
3fill in blank
hard

Fix the error in the code to archive artifacts only if they exist.

Jenkins
post {
  always {
    archiveArtifacts artifacts: '[1]', allowEmptyArchive: true
  }
}
Drag options to blanks, or click blank then click option'
A**/*.jar
B**/*.txt
C**/*.xml
D**/*.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pattern that does not match existing files causes no artifacts archived.
Not setting allowEmptyArchive to true causes build failure if no files found.
4fill in blank
hard

Fill both blanks to configure disk usage cleanup with days and number of builds.

Jenkins
properties {
  buildDiscarder(logRotator([1]: 7, [2]: 5))
}
Drag options to blanks, or click blank then click option'
AdaysToKeep
BnumToKeep
CartifactNumToKeep
DartifactDaysToKeep
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing artifactDaysToKeep with numToKeep causes unexpected behavior.
Using artifactNumToKeep instead of numToKeep affects artifacts, not builds.
5fill in blank
hard

Fill all three blanks to archive only jar files, keep 3 builds, and keep artifacts for 14 days.

Jenkins
properties {
  buildDiscarder(logRotator([1]: 3, [2]: 14))
}

post {
  success {
    archiveArtifacts artifacts: '[3]'
  }
}
Drag options to blanks, or click blank then click option'
AnumToKeep
BartifactDaysToKeep
C**/*.jar
DdaysToKeep
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing daysToKeep with artifactDaysToKeep.
Using wrong artifact pattern causes no files archived.