Skip to content

Commit

Permalink
Fixed other JENKINS-10360 - Added matrix compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Oct 8, 2011
1 parent d9ead3f commit 95178ca
Showing 1 changed file with 25 additions and 5 deletions.
Expand Up @@ -4,8 +4,9 @@
import groovy.lang.GroovyShell;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.maven.MavenModuleSet;
import hudson.matrix.*;
import hudson.model.*;
import hudson.model.listeners.RunListener;
import hudson.tasks.BuildStepDescriptor;
Expand All @@ -32,7 +33,7 @@
/**
* @author Gregory Boissinot
*/
public class ArtifactDeployerPublisher extends Recorder implements Serializable {
public class ArtifactDeployerPublisher extends Recorder implements MatrixAggregatable, Serializable {

private List<ArtifactDeployerEntry> entries = Collections.emptyList();

Expand All @@ -45,10 +46,29 @@ public Collection<? extends Action> getProjectActions(AbstractProject<?, ?> proj
return Arrays.asList(new ArtifactDeployerProjectAction(project));
}

public MatrixAggregator createAggregator(MatrixBuild build, Launcher launcher, BuildListener listener) {
return new MatrixAggregator(build, launcher, listener) {

@Override
public boolean endRun(MatrixRun run) throws InterruptedException, IOException {
return _perform(run, launcher, listener);
}

};
}

@Override
public boolean perform(hudson.model.AbstractBuild<?, ?> build, hudson.Launcher launcher, hudson.model.BuildListener listener) throws java.lang.InterruptedException, java.io.IOException {
if (!(build.getProject() instanceof MatrixConfiguration)) {
return _perform(build, launcher, listener);
}
return true;
}


public boolean _perform(hudson.model.AbstractBuild<?, ?> build, hudson.Launcher launcher, hudson.model.BuildListener listener) throws java.lang.InterruptedException, java.io.IOException {

if (build.getResult().isBetterOrEqualTo(Result.SUCCESS)) {
if (build.getResult() == null || build.getResult().isBetterOrEqualTo(Result.SUCCESS)) {

listener.getLogger().println("[ArtifactDeployer] - Starting deployment...");
DeployedArtifactsActionManager deployedArtifactsService = DeployedArtifactsActionManager.getInstance();
Expand Down Expand Up @@ -130,6 +150,7 @@ public static final class DeleteRemoteArtifact extends RunListener<AbstractBuild
@Override
public void onDeleted(AbstractBuild build) {

@SuppressWarnings("unchecked")
DescribableList<Publisher, Descriptor<Publisher>> projectPublishers = build.getProject().getPublishersList();
Iterator<Publisher> it = projectPublishers.iterator();
ArtifactDeployerPublisher instance = null;
Expand Down Expand Up @@ -199,8 +220,7 @@ public static final class ArtifactDeployerDescriptor extends BuildStepDescriptor

@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return FreeStyleProject.class.isAssignableFrom(jobType)
|| MavenModuleSet.class.isAssignableFrom(jobType);
return true;
}

@Override
Expand Down

0 comments on commit 95178ca

Please sign in to comment.