Skip to content

Commit 8690a2c

Browse files
author
Qui Le
committed
Fix bug: Can not run on slave
1 parent 039c72c commit 8690a2c

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

src/main/java/com/katalon/jenkins/plugin/ExecuteKatalonStudioTask.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99
import hudson.model.AbstractBuild;
1010
import hudson.model.AbstractProject;
1111
import hudson.model.BuildListener;
12-
import hudson.model.Environment;
12+
import hudson.remoting.Callable;
1313
import hudson.tasks.BuildStepDescriptor;
1414
import hudson.tasks.Builder;
1515
import net.sf.json.JSONObject;
16+
17+
import org.jenkinsci.remoting.RoleChecker;
1618
import org.kohsuke.stapler.DataBoundConstructor;
1719
import org.kohsuke.stapler.StaplerRequest;
1820

1921
import java.io.IOException;
2022
import java.util.HashMap;
2123
import java.util.Map;
22-
import java.util.function.Consumer;
2324

2425
public class ExecuteKatalonStudioTask extends Builder {
2526

@@ -105,15 +106,25 @@ public boolean perform(AbstractBuild<?, ?> abstractBuild, Launcher launcher, Bui
105106
environmentVariables.putAll(System.getenv());
106107
abstractBuild.getEnvironment(buildListener).entrySet()
107108
.forEach(entry -> environmentVariables.put(entry.getKey(), entry.getValue()));
108-
return KatalonUtils.executeKatalon(
109-
logger,
110-
this.version,
111-
this.location,
112-
workspaceLocation,
113-
this.executeArgs,
114-
this.x11Display,
115-
this.xvfbConfiguration,
116-
environmentVariables);
109+
return launcher.getChannel().call(new Callable<Boolean, Exception>() {
110+
@Override
111+
public Boolean call() throws Exception {
112+
return KatalonUtils.executeKatalon(
113+
logger,
114+
version,
115+
location,
116+
workspaceLocation,
117+
executeArgs,
118+
x11Display,
119+
xvfbConfiguration,
120+
environmentVariables);
121+
}
122+
123+
@Override
124+
public void checkRoles(RoleChecker roleChecker) throws SecurityException {
125+
126+
}
127+
});
117128
}
118129
}
119130

0 commit comments

Comments
 (0)