Skip to content

Commit

Permalink
[FIXED JENKINS-10006] Parameterized publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
bap2000 committed Jul 8, 2011
1 parent d1d845d commit 5c4434a
Show file tree
Hide file tree
Showing 24 changed files with 461 additions and 27 deletions.
Expand Up @@ -41,8 +41,9 @@ public class BapSshAlwaysRunPublisherPlugin extends BapSshPublisherPlugin {
private static final long serialVersionUID = 1L;

public BapSshAlwaysRunPublisherPlugin(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError,
final boolean failOnError, final boolean alwaysPublishFromMaster, final String masterNodeName) {
super(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean failOnError, final boolean alwaysPublishFromMaster, final String masterNodeName,
final BapSshParamPublish paramPublish) {
super(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName, paramPublish);
}

@Override
Expand Down
Expand Up @@ -49,8 +49,9 @@ public class BapSshBuilderPlugin extends Builder {

@DataBoundConstructor
public BapSshBuilderPlugin(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError, final boolean failOnError,
final boolean alwaysPublishFromMaster, final String masterNodeName) {
this.delegate = new BapSshPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean alwaysPublishFromMaster, final String masterNodeName, final BapSshParamPublish paramPublish) {
this.delegate = new BapSshPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName,
paramPublish);
}

public BapSshPublisherPlugin getDelegate() {
Expand Down
@@ -0,0 +1,74 @@
/*
* 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 jenkins.plugins.publish_over.ParamPublish;
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;

public class BapSshParamPublish extends ParamPublish implements Describable<BapSshParamPublish> {

@DataBoundConstructor
public BapSshParamPublish(final String parameterName) {
super(parameterName);
}

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

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

return addToEquals(new EqualsBuilder(), (BapSshParamPublish) 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 BapSshParamPublishDescriptor extends Descriptor<BapSshParamPublish> {

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

}

}
Expand Up @@ -48,8 +48,10 @@ public class BapSshPostBuildWrapper extends BuildWrapper {

@DataBoundConstructor
public BapSshPostBuildWrapper(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError, final boolean failOnError,
final boolean alwaysPublishFromMaster, final String masterNodeName) {
postBuild = new BapSshAlwaysRunPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean alwaysPublishFromMaster, final String masterNodeName,
final BapSshParamPublish paramPublish) {
postBuild = new BapSshAlwaysRunPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName,
paramPublish);
}

public BapSshPublisherPlugin getPostBuild() {
Expand Down
Expand Up @@ -48,8 +48,10 @@ public class BapSshPreBuildWrapper extends BuildWrapper {

@DataBoundConstructor
public BapSshPreBuildWrapper(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError, final boolean failOnError,
final boolean alwaysPublishFromMaster, final String masterNodeName) {
preBuild = new BapSshAlwaysRunPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean alwaysPublishFromMaster, final String masterNodeName,
final BapSshParamPublish paramPublish) {
preBuild = new BapSshAlwaysRunPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName,
paramPublish);
}

public BapSshPublisherPlugin getPreBuild() {
Expand Down
Expand Up @@ -51,8 +51,10 @@ public class BapSshPromotionPublisherPlugin extends Notifier {

@DataBoundConstructor
public BapSshPromotionPublisherPlugin(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError,
final boolean failOnError, final boolean alwaysPublishFromMaster, final String masterNodeName) {
this.delegate = new BapSshPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean failOnError, final boolean alwaysPublishFromMaster, final String masterNodeName,
final BapSshParamPublish paramPublish) {
this.delegate = new BapSshPublisherPlugin(publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName,
paramPublish);
}

@Override
Expand Down
Expand Up @@ -46,14 +46,19 @@ public class BapSshPublisher extends BapPublisher<BapSshTransfer> implements Des

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

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

public BapSshPublisherLabel getLabel() {
return (BapSshPublisherLabel) super.getLabel();
}

public BapSshPublisherDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(BapSshPublisherDescriptor.class);
}
Expand Down
@@ -0,0 +1,74 @@
/*
* 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 jenkins.plugins.publish_over.PublisherLabel;
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;

public class BapSshPublisherLabel extends PublisherLabel implements Describable<BapSshPublisherLabel> {

@DataBoundConstructor
public BapSshPublisherLabel(final String label) {
super(label);
}

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

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

return addToEquals(new EqualsBuilder(), (BapSshPublisherLabel) 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 BapSshPublisherLabelDescriptor extends Descriptor<BapSshPublisherLabel> {

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

}

}
Expand Up @@ -44,8 +44,14 @@ public class BapSshPublisherPlugin extends BPPlugin<BapSshPublisher, BapSshClien

@DataBoundConstructor
public BapSshPublisherPlugin(final ArrayList<BapSshPublisher> publishers, final boolean continueOnError, final boolean failOnError,
final boolean alwaysPublishFromMaster, final String masterNodeName) {
super(Messages.console_message_prefix(), publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName);
final boolean alwaysPublishFromMaster, final String masterNodeName,
final BapSshParamPublish paramPublish) {
super(Messages.console_message_prefix(), publishers, continueOnError, failOnError, alwaysPublishFromMaster, masterNodeName,
paramPublish);
}

public BapSshParamPublish getParamPublish() {
return (BapSshParamPublish) getDelegate().getParamPublish();
}

public boolean equals(final Object that) {
Expand Down
@@ -0,0 +1,33 @@
<?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="${%parameterName.title}" field="parameterName">
<f:textbox/>
</f:entry>

</j:jelly>
@@ -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.
#

parameterName.title=Parameter name
@@ -0,0 +1,27 @@
<!--
~ 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 name of the parameter or environment variable that will contain the expression for matching the labels.
</div>
Expand Up @@ -56,6 +56,7 @@
<poj:checkbox title="${%verbose.title}"/>
</f:entry>
<f:optionalProperty title="${%retry.title}" field="retry"/>
<f:optionalProperty title="${%label.title}" field="label"/>
</f:advanced>

<f:entry title="${%transfers.section}">
Expand Down
Expand Up @@ -32,3 +32,4 @@ transfers.dragAndDropLabel=Transfer Set
addTransfer.value=Add Transfer Set
deleteTransfer.value=Delete Transfer Set
retry.title=Retry
label.title=Label
@@ -0,0 +1,29 @@
<!--
~ 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>Set the label for this Server instance - for use with Parameterized publishing</p>

<p>Expand the help for Parameterized publishing for more details</p>
</div>

0 comments on commit 5c4434a

Please sign in to comment.