0
0
Jenkinsdevops~10 mins

Artifact retention policies 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 set the number of builds to keep in Jenkins.

Jenkins
properties([buildDiscarder(logRotator(numToKeepStr: '[1]'))])
Drag options to blanks, or click blank then click option'
A10
B5
C20
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 will keep no builds, which might delete all artifacts.
2fill in blank
medium

Complete the code to keep artifacts for 14 days in Jenkins.

Jenkins
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '[1]'))])
Drag options to blanks, or click blank then click option'
A7
B0
C14
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0, which deletes artifacts immediately.
3fill in blank
hard

Fix the error in the retention policy syntax.

Jenkins
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', daysToKeepStr: '10'))])
Drag options to blanks, or click blank then click option'
A10
B0
C-10
Dten
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'ten' instead of '10'.
Using negative numbers.
4fill in blank
hard

Fill both blanks to keep 7 builds and artifacts for 30 days.

Jenkins
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', artifactDaysToKeepStr: '[2]'))])
Drag options to blanks, or click blank then click option'
A7
B14
C30
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the two parameters.
Using 0 which disables retention.
5fill in blank
hard

Fill all three blanks to keep 10 builds, artifacts for 7 days, and no artifact days limit.

Jenkins
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', daysToKeepStr: '[2]', artifactDaysToKeepStr: '[3]'))])
Drag options to blanks, or click blank then click option'
A10
B7
C0
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing artifactDaysToKeepStr with daysToKeepStr.
Using non-numeric values.