/** * Creates a temporary file in this directory and set the contents to the * given text (encoded in the platform default encoding) * * @param prefix * The prefix string to be used in generating the file's name; must be * at least three characters long * @param suffix * The suffix string to be used in generating the file's name; may be * null, in which case the suffix ".tmp" will be used * @param contents * The initial contents of the temporary file. * @return * The new FilePath pointing to the temporary file * @see File#createTempFile(String, String) */ public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
/** * 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); }
@Override public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException { FilePath dir = preferredLocation(tool, node); // TODO support Unix scripts with interpreter line (see Shell.buildCommandLine) FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command); try { String cmd[] = getCommandCall(script); int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join(); if (r != 0) { throw new IOException("Command returned status " + r); } } finally { script.delete(); } return dir.child(getToolHome()); }
/** * Creates a temporary file in this directory and set the contents by the * given text (encoded in the platform default encoding) */ public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
/** * Creates a temporary file in this directory and set the contents by the * given text (encoded in the platform default encoding) */ public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
/** * Creates a temporary file in this directory and set the contents by the * given text (encoded in the platform default encoding) */ public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix, suffix, contents, true); }
/** * Creates a temporary file in this directory and set the contents by the * given text (encoded in the platform default encoding) */ public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
@Override public FilePath getScriptFile( FilePath projectWorkspace, AbstractBuild<?, ?> build, BuildListener listener ) throws IOException, InterruptedException { return projectWorkspace.createTextTempFile("hudson", ".groovy", command, true); }
/** * 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); }
/** * Creates a script file in a temporary name in the specified directory. */ public FilePath createScriptFile(FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("CommandInterpreterCondition", getFileExtension(), getContents(), false); }
/** * Create content of the script execute. * * @param dir * The folder in which the script is created * @return The script file * @throws IOException * @throws InterruptedException */ protected FilePath createScriptFile(FilePath dir) throws IOException, InterruptedException { return dir.createTextTempFile("shiningpanda", getExtension(), getContents(), false); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
private String createInitScript() throws Exception { GradleInitScriptWriter writer = new GradleInitScriptWriter(tempDir); FilePath initScript = tempDir.createTextTempFile("init-artifactory", "gradle", writer.generateInitScript()); ActionableHelper.deleteFilePathOnExit(initScript); String initScriptPath = initScript.getRemote(); initScriptPath = initScriptPath.replace('\\', '/'); return initScriptPath; } }
private FilePath getRemoteKeyPath(AbstractBuild<?, ?> build, Runner runner) throws IOException, InterruptedException { String keysDir = "debian-package-builder-keys"; String relativeKeyPath = new File(keysDir, getRepo(build, runner).getKeypath()).getPath(); File absoluteKeyPath = new File (Jenkins.getInstance().getRootDir(), relativeKeyPath); FilePath localKey = new FilePath(absoluteKeyPath); FilePath remoteKey = build.getWorkspace().createTextTempFile("private", "key", localKey.readToString()); remoteKey.chmod(0600); return remoteKey; }
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException { FilePath dir = preferredLocation(tool, node); // XXX support Windows batch scripts, Unix scripts with interpreter line, etc. (see CommandInterpreter subclasses) FilePath script = dir.createTextTempFile("hudson", ".sh", command); try { String[] cmd = {"sh", "-e", script.getRemote()}; int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join(); if (r != 0) { throw new IOException("Command returned status " + r); } } finally { script.delete(); } return dir.child(toolHome); }
private void importKeys(FilePath workspace, Runner runner) throws InterruptedException, DebianizingException, IOException { if (!runner.runCommandForResult("gpg --list-key {0}", getDescriptor().getAccountEmail())) { FilePath publicKey = workspace.createTextTempFile("public", "key", getDescriptor().getPublicKey()); runner.runCommand("gpg --import ''{0}''", publicKey.getRemote()); publicKey.delete(); } if (!runner.runCommandForResult("gpg --list-secret-key {0}", getDescriptor().getAccountEmail())) { FilePath privateKey = workspace.createTextTempFile("private", "key", getDescriptor().getPrivateKey()); runner.runCommand("gpg --import ''{0}''", privateKey.getRemote()); privateKey.delete(); } }
private FilePath execConanCollectBuildInfo(EnvVars extendedEnv) throws Exception { FilePath tempDir = ExtractorUtils.createAndGetTempDir(ws); FilePath logFilePath = tempDir.createTextTempFile("conan", "build-info", "", true); ArgumentListBuilder args = new ArgumentListBuilder(); args.add("conan_build_info"); args.add(step.getBuildLogPath()); args.add("--output"); args.add(logFilePath.getRemote()); Utils.exeConan(args, ws, launcher, listener, build, extendedEnv); return logFilePath; }