try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); if(isErrorlevelForUnstableBuild(r)) { build.setResult(Result.UNSTABLE); r = 0;
@Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException { return perform(build,launcher,(TaskListener)listener); }
/** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(@Nonnull FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("jenkins", getFileExtension(), getContents(), false); }
private List<String> buildArguments(Command command, String scriptContent) throws IOException, InterruptedException { CommandInterpreter interpreter = createInterpreter(scriptContent); FilePath scriptFile = interpreter.createScriptFile(workspace); List<String> args = new ArrayList<>(Arrays.asList(interpreter.buildCommandLine(scriptFile))); args.addAll(command.getParameters()); return args; }
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, TaskListener listener) throws InterruptedException { if (isDisabled()){ try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e, listener); r = launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).join(); } catch (IOException e) { Util.displayIOException(e, listener);
@Override public DescriptorImpl getDescriptor() { return (DescriptorImpl)super.getDescriptor(); }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException { if (isDisabled()){ listener.getLogger().print("\nThe command interpreter builder is temporarily disabled.\n"); return true; } return perform(build, launcher, (TaskListener) listener); }
private int executeScriptContent(@Nonnull FilePath scriptExecutionRoot, @Nonnull String scriptContent, @Nonnull Map<String, String> scriptExecutionEnvVars) throws EnvInjectException { try { CommandInterpreter batchRunner; if (launcher.isUnix()) { batchRunner = new Shell(scriptContent); } else { batchRunner = new BatchFile(scriptContent); } FilePath tmpFile = batchRunner.createScriptFile(scriptExecutionRoot); logger.info(String.format("Executing and processing the following script content: %n%s%n", scriptContent)); int cmdCode = launcher.launch().cmds(batchRunner.buildCommandLine(tmpFile)).stdout(launcher.getListener()) .envs(scriptExecutionEnvVars).pwd(scriptExecutionRoot).join(); if (cmdCode != 0) { logger.info(String.format("Script executed. The exit code is %s.", cmdCode)); } else { logger.info("Script executed successfully."); } return cmdCode; } catch (IOException ioe) { throw new EnvInjectException("Error occurs on execution script file path", ioe); } catch (InterruptedException ie) { throw new EnvInjectException("Error occurs on execution script file path", ie); } }
@Override public DescriptorImpl getDescriptor() { return (DescriptorImpl)super.getDescriptor(); }
try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); envVars.put(e.getKey(),e.getValue()); r = launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).join(); } catch (IOException e) { Util.displayIOException(e,listener);
try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); if(isErrorlevelForUnstableBuild(r)) { build.setResult(Result.UNSTABLE); r = 0;
/** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("hudson", getFileExtension(), getContents(), false); }
@Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException { return perform(build,launcher,(TaskListener)listener); }
@Override public DescriptorImpl getDescriptor() { return (DescriptorImpl) super.getDescriptor(); }
try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); envVars.put(e.getKey(),e.getValue()); r = launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).join(); } catch (IOException e) { Util.displayIOException(e,listener);
/** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("hudson", getFileExtension(), getContents(), false); }
@Override public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException { return perform(build,launcher,(TaskListener)listener); }
@Override public DescriptorImpl getDescriptor() { return (DescriptorImpl)super.getDescriptor(); }
try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); envVars.put(e.getKey(),e.getValue()); r = launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).join(); } catch (IOException e) { Util.displayIOException(e,listener);
/** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("hudson", getFileExtension(), getContents(), false); }