Complete the code to set the number of builds to keep in Jenkins.
properties([buildDiscarder(logRotator(numToKeepStr: '[1]'))])
The numToKeepStr parameter sets how many builds Jenkins keeps. Here, 5 means only the last 5 builds are kept.
Complete the code to keep artifacts for 14 days in Jenkins.
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '[1]'))])
The artifactDaysToKeepStr parameter sets how many days Jenkins keeps build artifacts. 14 means artifacts older than 14 days are deleted.
Fix the error in the retention policy syntax.
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', daysToKeepStr: '10'))])
The numToKeepStr must be a string representing a positive integer. '10' is correct; 'ten' is invalid.
Fill both blanks to keep 7 builds and artifacts for 30 days.
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', artifactDaysToKeepStr: '[2]'))])
numToKeepStr is set to 7 to keep 7 builds, and artifactDaysToKeepStr is set to 30 to keep artifacts for 30 days.
Fill all three blanks to keep 10 builds, artifacts for 7 days, and no artifact days limit.
properties([buildDiscarder(logRotator(numToKeepStr: '[1]', daysToKeepStr: '[2]', artifactDaysToKeepStr: '[3]'))])
Set numToKeepStr to 10 builds, daysToKeepStr to 7 days, and artifactDaysToKeepStr to 0 to disable artifact days limit.