Skip to content

Commit

Permalink
Add presend and postsend script support in pipeline (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksonlee authored and davidvanlaatum committed May 26, 2017
1 parent af6f882 commit d341c44
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/hudson/plugins/emailext/EmailExtStep.java
Expand Up @@ -58,6 +58,10 @@ public class EmailExtStep extends AbstractStepImpl {

private List<RecipientProvider> recipientProviders;

private String presendScript;

private String postsendScript;

@DataBoundConstructor
public EmailExtStep(String subject, String body) {
this.subject = subject;
Expand Down Expand Up @@ -138,6 +142,24 @@ public List<? extends RecipientProvider> getRecipientProviders() {
return recipientProviders;
}

@DataBoundSetter
public void setPresendScript(String presendScript) {
this.presendScript = presendScript;
}

public String getPresendScript() {
return presendScript == null ? "" : presendScript;
}

@DataBoundSetter
public void setPostsendScript(String postsendScript) {
this.postsendScript = postsendScript;
}

public String getPostsendScript() {
return postsendScript == null ? "" : postsendScript;
}

public static class EmailExtStepExecution extends AbstractSynchronousNonBlockingStepExecution<Void> {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -170,6 +192,8 @@ protected Void run() throws Exception {
publisher.defaultContent = step.body;
publisher.attachBuildLog = step.attachLog;
publisher.compressBuildLog = step.compressLog;
publisher.setPresendScript(step.presendScript);
publisher.setPostsendScript(step.postsendScript);

if (StringUtils.isNotBlank(step.to)) {
publisher.recipientList = step.to;
Expand Down
Expand Up @@ -49,5 +49,11 @@ THE SOFTWARE.
<f:entry field="compressLog" title="Compress Build Log">
<f:checkbox />
</f:entry>
<f:entry field="presendScript" title="Pre-send Script">
<f:textarea />
</f:entry>
<f:entry field="postsendScript" title="Post-send Script">
<f:textarea />
</f:entry>
</f:advanced>
</j:jelly>

0 comments on commit d341c44

Please sign in to comment.