Skip to content
Permalink
Browse files

[FIXED JENKINS-13888] Add option to turn off default Ant excludes fro…

…m workspace archive.
  • Loading branch information
abayer committed May 24, 2012
1 parent 9549828 commit 0bfecdad2fddc44c43b96f88ed373ab225e330e6
@@ -24,10 +24,9 @@ THE SOFTWARE.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
<relativePath>../pom.xml</relativePath>
<version>1.463</version>
</parent>

<artifactId>clone-workspace-scm</artifactId>
@@ -87,12 +87,17 @@
*/
private final String archiveMethod;

/**
* If true, don't use the Ant default file glob excludes.
*/
private final boolean overrideDefaultExcludes;
@DataBoundConstructor
public CloneWorkspacePublisher(String workspaceGlob, String workspaceExcludeGlob, String criteria, String archiveMethod) {
public CloneWorkspacePublisher(String workspaceGlob, String workspaceExcludeGlob, String criteria, String archiveMethod, boolean overrideDefaultExcludes) {
this.workspaceGlob = workspaceGlob.trim();
this.workspaceExcludeGlob = Util.fixEmptyAndTrim(workspaceExcludeGlob);
this.criteria = criteria;
this.archiveMethod = archiveMethod;
this.overrideDefaultExcludes = overrideDefaultExcludes;
}

public BuildStepMonitor getRequiredMonitorService() {
@@ -120,6 +125,9 @@ public String getArchiveMethod() {
return archiveMethod;
}

public boolean getOverrideDefaultExcludes() {
return overrideDefaultExcludes;
}

@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException {
@@ -166,7 +174,7 @@ public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListene
}
// This means we found something.
if((includeMsg==null) && (excludeMsg==null)) {
DirScanner globScanner = new DirScanner.Glob(realIncludeGlob, realExcludeGlob);
DirScanner globScanner = new DirScanner.Glob(realIncludeGlob, realExcludeGlob, !overrideDefaultExcludes);
build.addAction(snapshot(build, ws, globScanner, listener, archiveMethod));

// Find the next most recent build meeting this criteria with an archived snapshot.
@@ -42,4 +42,7 @@ THE SOFTWARE.
<f:option value="ZIP" selected='${instance.archiveMethod=="ZIP"}'>${%Zipped}</f:option>
</select>
</f:entry>
<f:entry title="${%Override Default Ant Excludes}" field="overrideDefaultExcludes">
<f:checkbox />
</f:entry>
</j:jelly>
@@ -62,12 +62,12 @@ public void testBasicCloning() throws Exception {

public void testSlaveCloning() throws Exception {
FreeStyleProject parentJob = createCloneParentProject();
parentJob.setAssignedLabel(createSlave(new Label("parentSlave")).getSelfLabel());
parentJob.setAssignedLabel(createSlave(Label.get("parentSlave")).getSelfLabel());

buildAndAssertSuccess(parentJob);

FreeStyleProject childJob = createCloneChildProject();
childJob.setAssignedLabel(createSlave(new Label("childSlave")).getSelfLabel());
childJob.setAssignedLabel(createSlave(Label.get("childSlave")).getSelfLabel());
buildAndAssertSuccess(childJob);

FreeStyleBuild fb = childJob.getLastBuild();
@@ -78,7 +78,7 @@ public void testSlaveCloning() throws Exception {
}

public void testGlobCloning() throws Exception {
FreeStyleProject parentJob = createCloneParentProject(new CloneWorkspacePublisher("moduleB/**/*", null, "Any", "ZIP"));
FreeStyleProject parentJob = createCloneParentProject(new CloneWorkspacePublisher("moduleB/**/*", null, "Any", "ZIP", false));

buildAndAssertSuccess(parentJob);

@@ -133,7 +133,7 @@ public void testNotFailedCriteriaDoesAcceptUnstable() throws Exception {
}

public void testNotFailedParentCriteriaDoesNotArchiveFailure() throws Exception {
FreeStyleProject parentJob = createCloneParentProject(new CloneWorkspacePublisher("**/*", null, "Not Failed", "ZIP"));
FreeStyleProject parentJob = createCloneParentProject(new CloneWorkspacePublisher("**/*", null, "Not Failed", "ZIP", false));

parentJob.getBuildersList().add(new FailureBuilder());

@@ -191,7 +191,7 @@ private FreeStyleProject createCloneChildProject(CloneWorkspaceSCM cws) throws E
}

private FreeStyleProject createCloneParentProject() throws Exception {
return createCloneParentProject(new CloneWorkspacePublisher("**/*", null, "Any", "zip"));
return createCloneParentProject(new CloneWorkspacePublisher("**/*", null, "Any", "zip", false));
}

private FreeStyleProject createCloneParentProject(CloneWorkspacePublisher cwp) throws Exception {

5 comments on commit 0bfecda

@davehunt

This comment has been minimized.

Copy link

davehunt replied Jun 19, 2012

Any chance of pushing a release so users can take advantage of this fix?

@davehunt

This comment has been minimized.

Copy link

davehunt replied Aug 17, 2012

@abayer

This comment has been minimized.

Copy link
Member Author

abayer replied Aug 17, 2012

Sorry - pushing a release now.

@davehunt

This comment has been minimized.

Copy link

davehunt replied Aug 20, 2012

Thanks @abayer. I now see 0.5 listed on the plugin page but not via plugin manager in Jenkins. Is there anything else to do or do we just need to wait?

@davehunt

This comment has been minimized.

Copy link

davehunt replied Aug 20, 2012

Ignore my last comment, I forced a refresh and there it is! Many thanks.

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