Skip to content

Commit

Permalink
Initial attempt at supporting workflow/plugin
Browse files Browse the repository at this point in the history
Full support requires refactoring the dataBoundConstructor and properly
supporting the client jelly includes without hacking support via parsing
the JSONObject
  • Loading branch information
Christian McHugh authored and Christian McHugh committed Oct 8, 2016
1 parent f69cdda commit fc87545
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -84,5 +84,10 @@
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>
24 changes: 21 additions & 3 deletions src/main/java/com/waytta/SaltAPIBuilder.java
Expand Up @@ -23,10 +23,13 @@

import hudson.Extension;
import hudson.Launcher;
import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.TaskListener;
import hudson.model.Item;
import hudson.model.Run;
import hudson.security.ACL;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
Expand All @@ -39,7 +42,7 @@
import net.sf.json.JSONSerializer;
import net.sf.json.util.JSONUtils;

public class SaltAPIBuilder extends Builder {
public class SaltAPIBuilder extends Builder implements SimpleBuildStep {
private static final Logger LOGGER = Logger.getLogger("com.waytta.saltstack");

private final String servername;
Expand All @@ -49,7 +52,7 @@ public class SaltAPIBuilder extends Builder {
private final String function;
private String arguments;
private String kwarguments;
private final JSONObject clientInterfaces;
private JSONObject clientInterfaces;
private final String clientInterface;
private final Boolean blockbuild;
private final Integer jobPollTime;
Expand Down Expand Up @@ -203,9 +206,24 @@ public void setSaveEnvVar(Boolean saveEnvVar) {
}

public Boolean getSaveEnvVar() {
return saveEnvVar;
return saveEnvVar;
}

public JSONObject getClientInterfaces() {
return clientInterfaces;
}

@DataBoundSetter
public void setClientInterfaces(JSONObject clientInterfaces) {
this.clientInterfaces = clientInterfaces;
}


@Override
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException{
listener.getLogger().println("Printed from pipeline");
}

@Override
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
// This is where you 'build' the project.
Expand Down

0 comments on commit fc87545

Please sign in to comment.