Skip to content

Commit 9f6af46

Browse files
Merge pull request arangamani#203 from sab3d/sabari_dob
adding jenkins "discard old builds" feature
2 parents 3a97743 + c337632 commit 9f6af46

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/jenkins_api_client/job.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ def build_freestyle_config(params)
299299
xml.description
300300
xml.keepDependencies "#{params[:keep_dependencies]}"
301301
xml.properties
302+
#buildlogs related stuff
303+
if params[:discard_old_builds]
304+
xml.logRotator(:class => 'hudson.tasks.LogRotator') do
305+
xml.daysToKeep params[:discard_old_builds][:daysToKeep] || -1
306+
xml.numToKeep params[:discard_old_builds][:numToKeep] || -1
307+
xml.artifactDaysToKeep params[:discard_old_builds][:artifactDaysToKeep] || -1
308+
xml.artifactNumToKeep params[:discard_old_builds][:artifactNumToKeep] || -1
309+
end
310+
end
311+
302312
# SCM related stuff
303313
if params[:scm_provider] == 'subversion'
304314
# Build subversion related XML portion

0 commit comments

Comments
 (0)