From c9c784aecc0a96fd2adf7b9bcc002686b51cdaac Mon Sep 17 00:00:00 2001 From: Vitaliy Lotorev Date: Fri, 28 Mar 2014 00:29:07 +0400 Subject: [PATCH] add retry-count in general.py implement retry-coutn in general.py; update doc and add test fixtures Change-Id: Ifeb4fb645ad0e4bc12d41ef4481aca1888a4041a --- doc/source/general.rst | 5 +++++ jenkins_jobs/modules/general.py | 4 ++++ tests/general/fixtures/set-retry-count001.xml | 10 ++++++++++ tests/general/fixtures/set-retry-count001.yaml | 3 +++ 4 files changed, 22 insertions(+) create mode 100644 tests/general/fixtures/set-retry-count001.xml create mode 100644 tests/general/fixtures/set-retry-count001.yaml diff --git a/doc/source/general.rst b/doc/source/general.rst index 17dab03db..0d21fafa3 100644 --- a/doc/source/general.rst +++ b/doc/source/general.rst @@ -24,6 +24,7 @@ later. There are a few basic optional fields for a Job definition:: quiet-period: 5 block-downstream: false block-upstream: false + retry-count: 3 :Job Parameters: * **project-type**: @@ -76,5 +77,9 @@ later. There are a few basic optional fields for a Job definition:: triggered by accessing a special predefined URL. Only those who know the token will be able to trigger builds remotely. + * **retry-count**: + If a build fails to checkout from the repository, Jenkins will + retry the specified number of times before giving up. + .. automodule:: general :members: diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py index f1d6a7bbd..e25813c86 100644 --- a/jenkins_jobs/modules/general.py +++ b/jenkins_jobs/modules/general.py @@ -99,6 +99,10 @@ class General(jenkins_jobs.modules.base.Base): XML.SubElement(xml, 'canRoam').text = 'false' else: XML.SubElement(xml, 'canRoam').text = 'true' + if 'retry-count' in data: + XML.SubElement(xml, 'scmCheckoutRetryCount').text = \ + str(data['retry-count']) + if 'logrotate' in data: lr_xml = XML.SubElement(xml, 'logRotator') logrotate = data['logrotate'] diff --git a/tests/general/fixtures/set-retry-count001.xml b/tests/general/fixtures/set-retry-count001.xml new file mode 100644 index 000000000..10629704d --- /dev/null +++ b/tests/general/fixtures/set-retry-count001.xml @@ -0,0 +1,10 @@ + + + + false + false + false + false + true + 8 + diff --git a/tests/general/fixtures/set-retry-count001.yaml b/tests/general/fixtures/set-retry-count001.yaml new file mode 100644 index 000000000..8e785428e --- /dev/null +++ b/tests/general/fixtures/set-retry-count001.yaml @@ -0,0 +1,3 @@ +name: openstack-infra +project-type: freestyle +retry-count: 8