diff options
author | David Caro <dcaroest@redhat.com> | 2016-01-28 21:55:39 +0100 |
---|---|---|
committer | David Caro <dcaroest@redhat.com> | 2016-03-02 12:17:45 +0100 |
commit | 1cf271a96e977e71829fc0858e4ce22dfeff0ca4 (patch) | |
tree | 61791671727f4ba2ec01266c318e5d979ef40384 /jenkins_jobs/modules/general.py | |
parent | d36262728bca751fc3b9ae14e8114f6163d0b224 (diff) | |
download | python-jenkins-job-builder-1cf271a96e977e71829fc0858e4ce22dfeff0ca4.tar.gz python-jenkins-job-builder-1cf271a96e977e71829fc0858e4ce22dfeff0ca4.tar.xz python-jenkins-job-builder-1cf271a96e977e71829fc0858e4ce22dfeff0ca4.zip |
Adding the build-discarder property
This deprecates the logrotate generic element of the jobs, as it's not
supported anymore on jenkins>1.637, see:
https://github.com/jenkinsci/jenkins/commit/1cbbb23923d002dc6e676bfcaecbf8cbddb2e974
Change-Id: Ib086aef43e4833855b5827ad0ed3310e8db7d7b9
Signed-off-by: David Caro <dcaroest@redhat.com>
Diffstat (limited to 'jenkins_jobs/modules/general.py')
-rw-r--r-- | jenkins_jobs/modules/general.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py index 2ba890f2..8b6db3c9 100644 --- a/jenkins_jobs/modules/general.py +++ b/jenkins_jobs/modules/general.py @@ -94,6 +94,8 @@ Example: The Logrotate section allows you to automatically remove old build history. It adds the ``logrotate`` attribute to the :ref:`Job` definition. All logrotate attributes default to "-1" (keep forever). + **Deprecated on jenkins >=1.637**: use the ``build-discarder`` + property instead * **raw**: If present, this section should contain a single **xml** entry. This XML @@ -101,6 +103,7 @@ Example: """ +import logging import xml.etree.ElementTree as XML import jenkins_jobs.modules.base @@ -109,6 +112,7 @@ from jenkins_jobs.xml_config import remove_ignorable_whitespace class General(jenkins_jobs.modules.base.Base): sequence = 10 + logrotate_warn_issued = False def gen_xml(self, parser, xml, data): jdk = data.get('jdk', None) @@ -165,6 +169,12 @@ class General(jenkins_jobs.modules.base.Base): str(data['retry-count']) if 'logrotate' in data: + if not self.logrotate_warn_issued: + logging.warn('logrotate is deprecated on jenkins>=1.637, use ' + 'the property build-discarder on newer jenkins ' + 'instead') + self.logrotate_warn_issued = True + lr_xml = XML.SubElement(xml, 'logRotator') logrotate = data['logrotate'] lr_days = XML.SubElement(lr_xml, 'daysToKeep') |