Skip to content
Permalink
Browse files

Merge pull request #15 from jglick/MultiBranchProjectFactory-update-J…

…ENKINS-34246

[JENKINS-34246] Make AbstractWorkflowMultiBranchProjectFactory handle deletion or update of existing children
  • Loading branch information
jglick committed Jun 9, 2016
2 parents 04d9355 + 44dc510 commit c0d0368994973cc3d6d2d542c36304b4acd71de3
@@ -84,7 +84,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>branch-api</artifactId>
<version>1.9</version>
<version>1.10</version>
</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 c0d0368

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