protected int run() throws Exception { // this allows the caller to manipulate the JVM state, so require the execute script privilege. Jenkins.getActiveInstance().checkPermission(Jenkins.RUN_SCRIPTS); Binding binding = new Binding(); binding.setProperty("out",new PrintWriter(stdout,true)); binding.setProperty("stdin",stdin); 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); 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); } } } GroovyShell groovy = new GroovyShell(Jenkins.getActiveInstance().getPluginManager().uberClassLoader, binding); groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()])); return 0; }
protected int run() throws Exception { // this allows the caller to manipulate the JVM state, so require the admin privilege. Hudson.getInstance().checkPermission(Hudson.ADMINISTER); Binding binding = new Binding(); binding.setProperty("out",new PrintWriter(stdout,true)); String j = getClientEnvironmentVariable("JOB_NAME"); if (j!=null) { Item job = Hudson.getInstance().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); } } GroovyShell groovy = new GroovyShell(binding); groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()])); return 0; }
protected int run() throws Exception { // this allows the caller to manipulate the JVM state, so require the admin privilege. Hudson.getInstance().checkPermission(Hudson.ADMINISTER); Binding binding = new Binding(); binding.setProperty("out",new PrintWriter(stdout,true)); String j = getClientEnvironmentVariable("JOB_NAME"); if (j!=null) { Item job = Hudson.getInstance().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); } } GroovyShell groovy = new GroovyShell(binding); groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()])); return 0; }
protected int run() throws Exception { // this allows the caller to manipulate the JVM state, so require the execute script privilege. Jenkins.getActiveInstance().checkPermission(Jenkins.RUN_SCRIPTS); Binding binding = new Binding(); binding.setProperty("out",new PrintWriter(stdout,true)); binding.setProperty("stdin",stdin); 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); 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); } } } GroovyShell groovy = new GroovyShell(Jenkins.getActiveInstance().getPluginManager().uberClassLoader, binding); groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()])); return 0; }