Skip to content
Permalink
Browse files

[FIXED JENKINS-34246] Make AbstractWorkflowMultiBranchProjectFactory …

…handle deletion or update of existing children.
  • Loading branch information...
jglick committed Jun 8, 2016
1 parent 04d9355 commit a7d63ecf3fc97a4657514c1b0495dd039aeafbc0
@@ -84,7 +84,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>branch-api</artifactId>
<version>1.9</version>
<version>1.10-SNAPSHOT</version> <!-- TODO https://github.com/jenkinsci/branch-api-plugin/pull/45 -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
@@ -28,9 +28,12 @@
import hudson.model.Action;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.TaskListener;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import jenkins.branch.MultiBranchProject;
import jenkins.branch.MultiBranchProjectFactory;
import jenkins.branch.OrganizationFolder;
import jenkins.model.TransientActionFactory;
@@ -47,6 +50,12 @@
return project;
}

@Override public final void updateExistingProject(MultiBranchProject<?, ?> project, Map<String, Object> attributes, TaskListener listener) throws IOException, InterruptedException {
if (project instanceof WorkflowMultiBranchProject) {
customize((WorkflowMultiBranchProject) project);
} // otherwise got recognized by something else before, oh well
}

protected void customize(WorkflowMultiBranchProject project) {}

@Extension public static class PerFolderAdder extends TransientActionFactory<OrganizationFolder> {
@@ -115,6 +115,12 @@
b1 = p.getLastBuild();
assertEquals(1, b1.getNumber());
r.assertLogContains("ran two", b1);
// JENKINS-34246: also delete Jenkinsfile
sampleRepo2.git("rm", WorkflowBranchProjectFactory.SCRIPT);
sampleRepo2.git("commit", "--message=noflow");
top.scheduleBuild2(0).getFuture().get();
top.getComputation().writeWholeLogTo(System.out);
assertEquals(1, top.getItems().size());
}

}

0 comments on commit a7d63ec

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