Merge "Add retry support to plugins depend on Publish Over X"

This commit is contained in:
Zuul 2018-12-27 11:33:31 +00:00 committed by Gerrit Code Review
commit 4e55ab1136
7 changed files with 45 additions and 3 deletions

View File

@ -1175,6 +1175,10 @@ def ftp(registry, xml_parent, data):
directories (default false).
:arg bool verbose: adds lots of detail useful for debug to the console
but generally should be left off (default false)
:arg int retries: the number of times to retry this server in the event of
failure (optional)
:arg int retry-delay: the time to wait, in milliseconds, before attempting
another transfer (default 10000)
Minimal Example:
@ -1191,6 +1195,7 @@ def ftp(registry, xml_parent, data):
plugin_tag = 'jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin'
publisher_tag = 'jenkins.plugins.publish__over__ftp.BapFtpPublisher'
transfer_tag = 'jenkins.plugins.publish__over__ftp.BapFtpTransfer'
retry_tag = 'jenkins.plugins.publish_over_ftp.BapFtpRetry'
plugin_reference_tag = 'jenkins.plugins.publish_over_ftp.' \
'BapFtpPublisherPlugin'
(_, transfer_node) = base_publish_over(xml_parent,
@ -1199,6 +1204,7 @@ def ftp(registry, xml_parent, data):
plugin_tag,
publisher_tag,
transfer_tag,
retry_tag,
plugin_reference_tag)
mapping = [('', 'asciiMode', 'false')]
helpers.convert_mapping_to_xml(
@ -1961,6 +1967,10 @@ def ssh(registry, xml_parent, data):
directories (default false).
:arg bool verbose: adds lots of detail useful for debug to the console
but generally should be left off (default false)
:arg int retries: the number of times to retry this server in the event of
failure (optional)
:arg int retry-delay: the time to wait, in milliseconds, before attempting
another transfer (default 10000)
Minimal Example:
@ -1976,6 +1986,7 @@ def ssh(registry, xml_parent, data):
tag_prefix = 'jenkins.plugins.publish'
publisher_tag = '%s__over__ssh.BapSshPublisher' % tag_prefix
transfer_tag = '%s__over__ssh.BapSshTransfer' % tag_prefix
retry_tag = '%s_over_ssh.BapSshRetry' % tag_prefix
reference_tag = '%s_over_ssh.BapSshPublisherPlugin' % tag_prefix
if xml_parent.tag == 'publishers':
@ -1986,7 +1997,8 @@ def ssh(registry, xml_parent, data):
is_builder = True
base_publish_over(xml_parent, data, console_prefix, plugin_tag,
publisher_tag, transfer_tag, reference_tag, is_builder)
publisher_tag, transfer_tag, retry_tag, reference_tag,
is_builder)
def pipeline(registry, xml_parent, data):
@ -2724,8 +2736,8 @@ def groovy_postbuild(registry, xml_parent, data):
def base_publish_over(xml_parent, data, console_prefix,
plugin_tag, publisher_tag,
transferset_tag, reference_plugin_tag,
is_builder=False):
transferset_tag, retry_tag,
reference_plugin_tag, is_builder=False):
outer = XML.SubElement(xml_parent, plugin_tag)
# 'Publish over SSH' builder has an extra top delegate element
if xml_parent.tag == 'builders' or is_builder:
@ -2766,6 +2778,12 @@ def base_publish_over(xml_parent, data, console_prefix,
XML.SubElement(inner, 'useWorkspaceInPromotion').text = 'false'
XML.SubElement(inner, 'usePromotionTimestamp').text = 'false'
if 'retries' in data:
retry = XML.SubElement(inner, 'retry', {'class': retry_tag})
XML.SubElement(retry, 'retries').text = str(data.get('retries', 0))
XML.SubElement(retry, 'retryDelay').text = str(
data.get('retry-delay', 10000))
XML.SubElement(delegate, 'continueOnError').text = 'false'
XML.SubElement(delegate, 'failOnError').text = str(
data.get('fail-on-error', False)).lower()
@ -2798,6 +2816,10 @@ def cifs(registry, xml_parent, data):
directories (default false).
:arg bool verbose: adds lots of detail useful for debug to the console
but generally should be left off (default false)
:arg int retries: the number of times to retry this server in the event of
failure (optional)
:arg int retry-delay: the time to wait, in milliseconds, before attempting
another transfer (default 10000)
Minimal Example:
@ -2819,6 +2841,7 @@ def cifs(registry, xml_parent, data):
is_builder = True
publisher_tag = 'jenkins.plugins.publish__over__cifs.CifsPublisher'
transfer_tag = 'jenkins.plugins.publish__over__cifs.CifsTransfer'
retry_tag = 'jenkins.plugins.publish_over_cifs.CifsRetry'
plugin_reference_tag = ('jenkins.plugins.publish_over_cifs.'
'CifsPublisherPlugin')
base_publish_over(xml_parent,
@ -2827,6 +2850,7 @@ def cifs(registry, xml_parent, data):
plugin_tag,
publisher_tag,
transfer_tag,
retry_tag,
plugin_reference_tag,
is_builder)

View File

@ -21,6 +21,10 @@
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
<retry class="jenkins.plugins.publish_over_cifs.CifsRetry">
<retries>99</retries>
<retryDelay>12345</retryDelay>
</retry>
</jenkins.plugins.publish__over__cifs.CifsPublisher>
</publishers>
<continueOnError>false</continueOnError>

View File

@ -10,3 +10,5 @@ publishers:
fail-on-error: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345

View File

@ -22,6 +22,10 @@
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
<retry class="jenkins.plugins.publish_over_ftp.BapFtpRetry">
<retries>99</retries>
<retryDelay>12345</retryDelay>
</retry>
</jenkins.plugins.publish__over__ftp.BapFtpPublisher>
</publishers>
<continueOnError>false</continueOnError>

View File

@ -10,3 +10,5 @@ publishers:
fail-on-error: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345

View File

@ -24,6 +24,10 @@
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
<retry class="jenkins.plugins.publish_over_ssh.BapSshRetry">
<retries>99</retries>
<retryDelay>12345</retryDelay>
</retry>
</jenkins.plugins.publish__over__ssh.BapSshPublisher>
</publishers>
<continueOnError>false</continueOnError>

View File

@ -14,3 +14,5 @@ publishers:
always-publish-from-master: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345