Skip to content
Permalink
Browse files

[FIXED JENKINS-13693] Add option to disable default excludes

  • Loading branch information...
bap2000 committed Jul 24, 2012
1 parent 070612e commit 4595e8598952a17a471da44bbc225b02d3ba1bdb
@@ -69,7 +69,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>publish-over</artifactId>
<version>0.14</version>
<version>0.15-SNAPSHOT</version>

This comment has been minimized.

Copy link
@chantivlad

This comment has been minimized.

Copy link
@bap2000

bap2000 Sep 11, 2012

Author Member

You have to build and install a snapshot yourself - mvn install in publish-over-plugin would have installed a local 0.15-SNAPSHOT

I have released the plugins so a PO 0.15 is available to build against.
New PO-FTP and SSH plugins should be in the update centre in a few hours.

This comment has been minimized.

Copy link
@chantivlad

chantivlad Sep 11, 2012

I see. So you can specify on the mvn command line that you want to use a local build of publish-over-plugin?
Thanks for releasing 0.15, i used it instead, and it worked fine.

This comment has been minimized.

Copy link
@bap2000

bap2000 Sep 11, 2012

Author Member

Snapshot versions are not released. The publish-over-ssh plugin source in git had changes that depended on changes in the source of the publish-over common component. Niether of these had been released.

If you built and installed a snapshot version of publish-over, then when you built po-ssh maven would have found it in your local repository.

</dependency>
<dependency>
<groupId>junit</groupId>
@@ -45,14 +45,14 @@

BapSshTransfer(final String sourceFiles, final String remoteDirectory, final String removePrefix,
final boolean remoteDirectorySDF, final boolean flatten, final String execCommand, final int execTimeout) {
this(sourceFiles, null, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, execCommand, execTimeout, false);
this(sourceFiles, null, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, execCommand, execTimeout, false, false);
}

@DataBoundConstructor
public BapSshTransfer(final String sourceFiles, final String excludes, final String remoteDirectory, final String removePrefix,
final boolean remoteDirectorySDF, final boolean flatten, final String execCommand, final int execTimeout,
final boolean usePty) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten);
final boolean usePty, final boolean noDefaultExcludes) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, false, noDefaultExcludes);
this.execCommand = execCommand;
this.execTimeout = execTimeout;
this.usePty = usePty;
@@ -52,6 +52,10 @@ public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}

public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();
}

public FormValidation doCheckExecTimeout(@QueryParameter final String value) {
return FormValidation.validateNonNegativeInteger(value);
}
@@ -45,11 +45,13 @@
private final boolean flatten;
private final boolean cleanRemote;
private final boolean usePty;
private final boolean noDefaultExcludes;

@DataBoundConstructor
public SshOverrideTransferDefaults(final String sourceFiles, final String excludes, final String removePrefix,
final String remoteDirectory, final boolean flatten, final boolean remoteDirectorySDF,
final boolean cleanRemote, final String execCommand, final int execTimeout, final boolean usePty) {
final boolean cleanRemote, final String execCommand, final int execTimeout, final boolean usePty,
final boolean noDefaultExcludes) {
this.cleanRemote = cleanRemote;
this.excludes = excludes;
this.execCommand = execCommand;
@@ -60,6 +62,7 @@ public SshOverrideTransferDefaults(final String sourceFiles, final String exclud
this.removePrefix = removePrefix;
this.sourceFiles = sourceFiles;
this.usePty = usePty;
this.noDefaultExcludes = noDefaultExcludes;
}

public String getExecCommand() {
@@ -106,6 +109,10 @@ public boolean isUsePty() {
return usePty;
}

public boolean isNoDefaultExcludes() {
return noDefaultExcludes;
}

@Extension
public static class SshOverrideTransferDefaultsDescriptor extends Descriptor<SshOverrideTransferDefaults> {

@@ -118,6 +125,10 @@ public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}

public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();
}

public FormValidation doCheckExecTimeout(@QueryParameter final String value) {
return FormValidation.validateNonNegativeInteger(value);
}
@@ -56,6 +56,12 @@
</f:entry>
</j:if>

<j:if test="${descriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>

<f:entry title="${m.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
@@ -0,0 +1,39 @@
<?jelly escape-by-default='true'?>

<!--
~ The MIT License
~
~ Copyright (C) 2012 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">

Select this option to disable the default exclude patterns.
<p>The default exclude patterns are:
<j:invokeStatic var="defaultExcludes" method="getDefaultExcludes" className="org.apache.tools.ant.DirectoryScanner"/>
<pre>
<j:forEach var="pattern" items="${defaultExcludes}">
${pattern}<br/>
</j:forEach>
</pre>
</p>

</j:jelly>
@@ -45,6 +45,11 @@
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>
<f:entry title="${m.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
@@ -294,7 +294,7 @@ private void assertDisconnect() throws Exception {
expect(mockSession.openChannel("exec")).andReturn(exec);
expect(mockSession.getTimeout()).andReturn(timeout);
mockControl.replay();
bapSshClient.endTransfers(new BapSshTransfer("", "", "", "", false, false, command, timeout, true));
bapSshClient.endTransfers(new BapSshTransfer("", "", "", "", false, false, command, timeout, true, false));
assertTrue(exec.isUsePty());
}

@@ -287,8 +287,8 @@ private BapSshClient assertCreateClientWithDefaultKey(final boolean disableExec)
@Test public void testDontConnectSftpIfNoSourceFilesInAnyTransfers() throws Exception {
final BapSshCommonConfiguration defaultKeyInfo = new BapSshCommonConfiguration(TEST_PASSPHRASE, null, null, false);
hostConfig = createWithDefaultKeyInfo(mockJSch, defaultKeyInfo);
final BapSshTransfer transfer1 = new BapSshTransfer("", "", "", "", false, false, "ls -la", 10000, false);
final BapSshTransfer transfer2 = new BapSshTransfer("", "", "", "", false, false, "pwd", 10000, false);
final BapSshTransfer transfer1 = new BapSshTransfer("", "", "", "", false, false, "ls -la", 10000, false, false);
final BapSshTransfer transfer2 = new BapSshTransfer("", "", "", "", false, false, "pwd", 10000, false, false);
final ArrayList<BapSshTransfer> transfers = new ArrayList<BapSshTransfer>();
transfers.addAll(Arrays.asList(transfer1, transfer2));
final BapSshPublisher publisher = new BapSshPublisher(hostConfig.getName(), false, transfers, false, false, null, null, null);
@@ -79,7 +79,7 @@ public JSch createJSch() {
new JenkinsTestHelper().setGlobalConfig(commonConfig, testHostConfig);
final String dirToIgnore = "target";
final int execTimeout = 10000;
final BapSshTransfer transfer = new BapSshTransfer("**/*", null, "sub-home", dirToIgnore, false, false, "", execTimeout, false);
final BapSshTransfer transfer = new BapSshTransfer("**/*", null, "sub-home", dirToIgnore, false, false, "", execTimeout, false, false);
final BapSshPublisher publisher = new BapSshPublisher(testHostConfig.getName(), false,
new ArrayList<BapSshTransfer>(Collections.singletonList(transfer)), false, false, null, null, null);
final BapSshPublisherPlugin plugin = new BapSshPublisherPlugin(
@@ -64,7 +64,7 @@ public void testLoadR0x1Minimal() throws Exception {

final int expectedExecTimeout = 120000;
final List<BapSshTransfer> transfers = Collections.singletonList(
new BapSshTransfer("**/*", null, "", "", false, false, "", expectedExecTimeout, false));
new BapSshTransfer("**/*", null, "", "", false, false, "", expectedExecTimeout, false, false));
final BapSshPublisher publisher = newPublisher("default", false, new ArrayList<BapSshTransfer>(transfers));
final ArrayList<BapSshPublisher> publishers = new ArrayList<BapSshPublisher>();
publishers.add(publisher);
@@ -87,23 +87,23 @@ public void testLoadR0x12() throws Exception {
assertPublisherPluginConfiguration(DEFAULT_EXEC_TIMEOUT);

final List<BapSshTransfer> builderTransfers = Collections.singletonList(
new BapSshTransfer("builderC/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false));
new BapSshTransfer("builderC/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false, false));
final List<BapSshPublisher> builderPublishers = Collections.singletonList(
newPublisher(configName('c'), false, new ArrayList<BapSshTransfer>(builderTransfers)));
final BapSshBuilderPlugin expectedBuilderPlugin = new BapSshBuilderPlugin(new ArrayList<BapSshPublisher>(builderPublishers),
true, false, false, "", null);
assertEquals(expectedBuilderPlugin, getConfiguredBuilderPlugin());

final List<BapSshTransfer> preTransfers = Collections.singletonList(
new BapSshTransfer("beforeA/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false));
new BapSshTransfer("beforeA/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false, false));
final List<BapSshPublisher> prePublishers = Collections.singletonList(
newPublisher(configName('a'), false, new ArrayList<BapSshTransfer>(preTransfers)));
final BapSshPreBuildWrapper expectedPreBuildPlugin = new BapSshPreBuildWrapper(new ArrayList<BapSshPublisher>(prePublishers),
false, true, false, "", null);
assertEquals(expectedPreBuildPlugin, getConfiguredBuildWrapper(BapSshPreBuildWrapper.class));

final List<BapSshTransfer> postTransfers = Collections.singletonList(
new BapSshTransfer("afterD/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false));
new BapSshTransfer("afterD/", null, "", "", false, false, "", DEFAULT_EXEC_TIMEOUT, false, false));
final List<BapSshPublisher> postPublishers = Collections.singletonList(
newPublisher(configName('d'), false, new ArrayList<BapSshTransfer>(postTransfers)));
final BapSshPostBuildWrapper expectedPostBuildPlugin = new BapSshPostBuildWrapper(new ArrayList<BapSshPublisher>(postPublishers),
@@ -132,16 +132,16 @@ private void assertGlobalConfig() {

private void assertPublisherPluginConfiguration(final int transfer11Timeout) {
final int transfer12Timeout = 15000;
final BapSshTransfer transfer11 = new BapSshTransfer("", null, "", "", false, false, "date", transfer11Timeout, false);
final BapSshTransfer transfer11 = new BapSshTransfer("", null, "", "", false, false, "date", transfer11Timeout, false, false);
final BapSshTransfer transfer12 = new BapSshTransfer("target/*.jar", null, "'builds/'yyyy_MM_dd/'build-${BUILD_NUMBER}'", "target",
true, true, "ls -la /tmp", transfer12Timeout, false);
true, true, "ls -la /tmp", transfer12Timeout, false, false);
final ArrayList<BapSshTransfer> transfers1 = new ArrayList<BapSshTransfer>();
transfers1.add(transfer11);
transfers1.add(transfer12);
final BapSshPublisher publisher1 = newPublisher(configName('a'), true, transfers1);
final int transfer21Timeout = 10000;
final BapSshTransfer transfer21 = new BapSshTransfer("out\\dist\\**\\*", null, "", "out\\dist", false, false, "",
transfer21Timeout, false);
transfer21Timeout, false, false);
final ArrayList<BapSshTransfer> transfers2 = new ArrayList<BapSshTransfer>();
transfers2.add(transfer21);
final BapSshPublisher publisher2 = newPublisher(configName('c'), false, transfers2);

0 comments on commit 4595e85

Please sign in to comment.
You can’t perform that action at this time.