Skip to content
Permalink
Browse files
[FIXED JENKINS-10094] Retry uploads on bad connections
Moved "Verbose output in console" to new advanced section
Swtiched some of the checkboxes from entry/@title to checkbox/@title to prevent longer descriptions from reformatting the view too much
  • Loading branch information
bap2000 committed Jul 7, 2011
1 parent 5ede793 commit d698fa0def843c52ef4ee326352ffc4aab9e9a81
@@ -46,8 +46,12 @@

@DataBoundConstructor
public BapSshPublisher(final String configName, final boolean verbose, final ArrayList<BapSshTransfer> transfers,
final boolean useWorkspaceInPromotion, final boolean usePromotionTimestamp) {
super(configName, verbose, transfers, useWorkspaceInPromotion, usePromotionTimestamp);
final boolean useWorkspaceInPromotion, final boolean usePromotionTimestamp, final BapSshRetry retry) {
super(configName, verbose, transfers, useWorkspaceInPromotion, usePromotionTimestamp, retry);
}

public BapSshRetry getRetry() {
return (BapSshRetry) super.getRetry();
}

public BapSshPublisherDescriptor getDescriptor() {
@@ -0,0 +1,92 @@
/*
* The MIT License
*
* Copyright (C) 2010-2011 by Anthony Robinson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package jenkins.plugins.publish_over_ssh;

import hudson.Extension;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.util.FormValidation;
import jenkins.plugins.publish_over.Retry;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

public class BapSshRetry extends Retry implements Describable<BapSshRetry> {

@DataBoundConstructor
public BapSshRetry(final int retries, final long retryDelay) {
super(retries, retryDelay);
}

public BapSshRetryDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(BapSshRetryDescriptor.class);
}

public boolean equals(final Object that) {
if (this == that) return true;
if (that == null || getClass() != that.getClass()) return false;

return addToEquals(new EqualsBuilder(), (BapSshRetry) that).isEquals();
}

public int hashCode() {
return addToHashCode(new HashCodeBuilder()).toHashCode();
}

public String toString() {
return addToToString(new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)).toString();
}

@Extension
public static class BapSshRetryDescriptor extends Descriptor<BapSshRetry> {

@Override
public String getDisplayName() {
return Messages.retry_descriptor_displayName();
}

public int getDefaultRetries() {
return Retry.DEFAULT_RETRIES;
}

public long getDefaultRetryDelay() {
return Retry.DEFAULT_RETRY_DELAY;
}

public FormValidation doCheckRetries(@QueryParameter final String value) {
return FormValidation.validateNonNegativeInteger(value);
}

public FormValidation doCheckRetryDelay(@QueryParameter final String value) {
return FormValidation.validatePositiveInteger(value);
}

}

}
@@ -24,7 +24,7 @@
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:poj="/pojelly">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:poj="/pojelly">

<f:entry title="${%hostconfig.title}" field="configName">
<select class="setting-input ssh-config-name" name="configName">
@@ -34,32 +34,30 @@
</select>
</f:entry>

<f:entry title="${%verbose.title}" field="verbose">
<f:checkbox />
</f:entry>

<j:if test="${inPromotion}">
<j:choose>
<j:when test="${it.getClass().canonicalName == 'hudson.matrix.MatrixProject'}">
<j:set var="matrixPromotion" value="true"/>
<f:entry title="${%useWorkspaceInPromotion.title}" help="${descriptor.getHelpFile('useWorkspaceInPromotionForMatrix')}">
<input type="checkbox" checked="true" disabled="true"/>
</f:entry>
<f:invisibleEntry>
<f:checkbox name="useWorkspaceInPromotion" checked="true"/>
</f:invisibleEntry>
<poj:disabled-checkbox field="useWorkspaceInPromotion" title="${%useWorkspaceInPromotion.title}" checked="true" helpField="useWorkspaceInPromotionForMatrix"/>
</j:when>
<j:otherwise>
<f:entry title="${%useWorkspaceInPromotion.title}" field="useWorkspaceInPromotion">
<f:checkbox/>
<f:entry field="useWorkspaceInPromotion">
<poj:checkbox title="${%useWorkspaceInPromotion.title}"/>
</f:entry>
</j:otherwise>
</j:choose>
<f:entry title="${%usePromotionTimestamp.title}" field="usePromotionTimestamp">
<f:checkbox/>
<f:entry field="usePromotionTimestamp">
<poj:checkbox title="${%usePromotionTimestamp.title}"/>
</f:entry>
</j:if>

<f:advanced>
<f:entry field="verbose">
<poj:checkbox title="${%verbose.title}"/>
</f:entry>
<f:optionalProperty title="${%retry.title}" field="retry"/>
</f:advanced>

<f:entry title="${%transfers.section}">
<j:scope>
<j:set var="descriptor" value="${descriptor.transferDescriptor}"/>
@@ -24,10 +24,11 @@

hostconfig.title=Name
hostconfig.noexec.suffix=\ [No Exec]
verbose.title=Verbose output<br />in console
useWorkspaceInPromotion.title=Use the<br />workspace
usePromotionTimestamp.title=Use promotion<br />timestamp
verbose.title=Verbose output in console
useWorkspaceInPromotion.title=Use the workspace
usePromotionTimestamp.title=Use promotion timestamp
transfers.section=Transfers
transfers.dragAndDropLabel=Transfer Set
addTransfer.value=Add Transfer Set
deleteTransfer.value=Delete Transfer Set
retry.title=Retry
@@ -0,0 +1,30 @@
<!--
~ The MIT License
~
~ Copyright (C) 2010-2011 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<div>
<p>If publishing to this server or command execution fails, try again.</p>
<p>Files that were successfully transferred will not be re-sent.<br>
<strong>If <em>Exec command</em> is configured, but fails in any way (including a non zero exit code), then it will be retried.</strong>
</p>
</div>
@@ -24,7 +24,7 @@
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:poj="/pojelly">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form" xmlns:poj="/pojelly">

<j:set var="instance" value="${instance.delegate}"/>

@@ -53,14 +53,14 @@
</j:scope>

<f:advanced>
<f:entry title="${%continueOnError.title}" field="continueOnError">
<f:checkbox/>
<f:entry field="continueOnError">
<poj:checkbox title="${%continueOnError.title}"/>
</f:entry>
<f:entry title="${%failOnError.title}" field="failOnError">
<f:checkbox/>
<f:entry field="failOnError">
<poj:checkbox title="${%failOnError.title}"/>
</f:entry>
<f:entry title="${%alwaysPublishFromMaster.title}" field="alwaysPublishFromMaster">
<f:checkbox/>
<f:entry field="alwaysPublishFromMaster">
<poj:checkbox title="${%alwaysPublishFromMaster.title}"/>
</f:entry>
<j:if test="${descriptor.canSetMasterNodeName()}">
<f:entry title="${%masterNodeName.title}" field="masterNodeName">
@@ -29,4 +29,4 @@ deletePublisher.value=Delete Server
continueOnError.title=Publish to other SSH servers if an error occurs
failOnError.title=Fail the build if an error occurs
alwaysPublishFromMaster.title=Always SSH from master
masterNodeName.title=Give the master a NODE_NAME
masterNodeName.title=Give the master<br>a NODE_NAME
@@ -0,0 +1,36 @@
<?jelly escape-by-default='true'?>

<!--
~ The MIT License
~
~ Copyright (C) 2010-2011 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">

<f:entry title="${%retries.title}" field="retries">
<f:textbox default="${descriptor.defaultRetries}"/>
</f:entry>
<f:entry title="${%retryDelay.title}" field="retryDelay">
<f:textbox default="${descriptor.defaultRetryDelay}"/>
</f:entry>

</j:jelly>
@@ -0,0 +1,26 @@
#
# The MIT License
#
# Copyright (C) 2010-2011 by Anthony Robinson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

retries.title=Retries
retryDelay.title=Delay
@@ -0,0 +1,25 @@
<!--
~ The MIT License
~
~ Copyright (C) 2010-2011 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<div>The number of times to retry this server in the event of failure</div>
@@ -0,0 +1,25 @@
<!--
~ The MIT License
~
~ Copyright (C) 2010-2011 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<div>The time to wait, in milliseconds, before attempting another transfer</div>
@@ -34,6 +34,7 @@ descriptor.sourceFiles.check.configNotFound=Could not find the SSH Server config
- check the System Configuration and then reload this configuration page
transfer.descriptor.displayName=SSH Transfer
publisher.descriptor.displayName=SSH Publisher
retry.descriptor.displayName=SSH Retry
global.common.descriptor=SSH Common Configuration
global.hostconfig.descriptor=SSH Host Configuration

@@ -81,7 +81,7 @@ public JSch createJSch() {
final int execTimeout = 10000;
final BapSshTransfer transfer = new BapSshTransfer("**/*", null, "sub-home", dirToIgnore, false, false, "", execTimeout);
final BapSshPublisher publisher = new BapSshPublisher(testHostConfig.getName(), false,
new ArrayList<BapSshTransfer>(Collections.singletonList(transfer)), false, false);
new ArrayList<BapSshTransfer>(Collections.singletonList(transfer)), false, false, null);
final BapSshPublisherPlugin plugin = new BapSshPublisherPlugin(
new ArrayList<BapSshPublisher>(Collections.singletonList(publisher)), false, false, false, "master");

Loading

0 comments on commit d698fa0

Please sign in to comment.