Skip to content

Commit

Permalink
Merge pull request #152 from sbesson/artifacts_retention
Browse files Browse the repository at this point in the history
Add default retention policy to template jobs
  • Loading branch information
sbesson authored Jul 31, 2019
2 parents c4ae967 + cf7ebd6 commit b03027f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 11 additions & 1 deletion TEMPLATE-pipeline-job-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
</actions>
<description>{DESCRIPTION}</description>
<keepDependencies>false</keepDependencies>
{PROPERTIES}
<properties>
<jenkins.model.BuildDiscarderProperty>
<strategy class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>-1</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>5</artifactNumToKeep>
</strategy>
</jenkins.model.BuildDiscarderProperty>
{PROPERTIES}
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="[email protected]">
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
Expand Down
4 changes: 1 addition & 3 deletions createpipelinejobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
JENKINS_JOBS_DIR = './home/jobs'

PROPERTIES = """\
<properties>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers>
{TRIGGERS}
</triggers>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
"""
TRIGGER = """\
<jenkins.triggers.ReverseBuildTrigger>
Expand Down Expand Up @@ -46,7 +44,7 @@ def main():
for j in jobcfg['after']]
properties = PROPERTIES.format(TRIGGERS='\n'.join(triggers))
else:
properties = '<properties/>'
properties = ''
job_config_xml = template.format(
DESCRIPTION=jobcfg['description'],
REPOSITORY=jobcfg['repository'],
Expand Down

0 comments on commit b03027f

Please sign in to comment.