[FIX Allow groovy CLI command via SSH
@@ -71,6 +71,8 @@ public class GroovyCommand extends CLICommand {
binding.setProperty("stdout",stdout);
binding.setProperty("stderr",stderr);
binding.setProperty("channel",channel);
+
+ if (channel != null) {
String j = getClientEnvironmentVariable("JOB_NAME");
if (j != null) {
Item job = Jenkins.getActiveInstance().getItemByFullName(j);
@@ -81,6 +83,7 @@ public class GroovyCommand extends CLICommand {
binding.setProperty("currentBuild", r);
}
}
+ }
GroovyShell groovy = new GroovyShell(Jenkins.getActiveInstance().getPluginManager().uberClassLoader, binding);
groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()]));
