提交 0d3d6b65 编写于 作者: D Daniel Beck

[FIX JENKINS-41765] Allow groovy CLI command via SSH

上级 c4dcffaf
......@@ -71,14 +71,17 @@ public class GroovyCommand extends CLICommand {
binding.setProperty("stdout",stdout);
binding.setProperty("stderr",stderr);
binding.setProperty("channel",channel);
String j = getClientEnvironmentVariable("JOB_NAME");
if (j!=null) {
Item job = Jenkins.getActiveInstance().getItemByFullName(j);
binding.setProperty("currentJob", job);
String b = getClientEnvironmentVariable("BUILD_NUMBER");
if (b!=null && job instanceof AbstractProject) {
Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
binding.setProperty("currentBuild", r);
if (channel != null) {
String j = getClientEnvironmentVariable("JOB_NAME");
if (j != null) {
Item job = Jenkins.getActiveInstance().getItemByFullName(j);
binding.setProperty("currentJob", job);
String b = getClientEnvironmentVariable("BUILD_NUMBER");
if (b != null && job instanceof AbstractProject) {
Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
binding.setProperty("currentBuild", r);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册