From a12e1c1d35386eaede50a17cb3e9b233e1aebd3e Mon Sep 17 00:00:00 2001 From: brayquentin Date: Sat, 16 Mar 2019 12:00:08 +0100 Subject: [PATCH] Add SimpleBuild step and README for pipeline integration --- README.md | 3 +++ .../ArtifactDeployerPublisher.java | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..773f4ae --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +### ArtifactDeployer + +This plug-in makes it possible to deploy artifacts from workspace to output directories. \ No newline at end of file diff --git a/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerPublisher.java b/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerPublisher.java index 79f97ab..3d98a82 100644 --- a/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerPublisher.java +++ b/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerPublisher.java @@ -36,6 +36,7 @@ import hudson.tasks.Recorder; import hudson.util.DescribableList; import hudson.util.FormValidation; +import jenkins.tasks.SimpleBuildStep; import org.jenkinsci.plugins.artifactdeployer.service.ArtifactDeployerCopy; import org.jenkinsci.plugins.artifactdeployer.service.ArtifactDeployerManager; import org.jenkinsci.plugins.artifactdeployer.service.DeployedArtifactsActionManager; @@ -43,6 +44,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; +import javax.annotation.Nonnull; import java.io.IOException; import java.io.Serializable; import java.util.*; @@ -52,7 +54,7 @@ /** * @author Gregory Boissinot */ -public class ArtifactDeployerPublisher extends Recorder implements MatrixAggregatable, Serializable { +public class ArtifactDeployerPublisher extends Recorder implements MatrixAggregatable, Serializable, SimpleBuildStep { private List entries = Collections.emptyList(); private boolean deployEvenBuildFail; @@ -259,6 +261,16 @@ public void setDeployEvenBuildFail(boolean deployEvenBuildFail) { this.deployEvenBuildFail = deployEvenBuildFail; } + @Override + public void perform(@Nonnull Run run, @Nonnull FilePath filePath, @Nonnull Launcher launcher, @Nonnull TaskListener taskListener) throws InterruptedException, IOException { + if(!(run instanceof AbstractBuild) || !(taskListener instanceof BuildListener)) + { + return; + } + + _perform((AbstractBuild)run, launcher, (BuildListener)taskListener); + } + @Extension @SuppressWarnings("unused") public static final class DeleteRemoteArtifact extends RunListener {