@WebMethod(name="heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Jenkins.RUN_SCRIPTS); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException { FilePath expected = preferredLocation(tool, node); Installable inst = getInstallable(); if(inst==null) { log.getLogger().println("Invalid tool ID "+id); return expected; } if (inst instanceof NodeSpecific) { inst = (Installable) ((NodeSpecific) inst).forNode(node, log); } if(isUpToDate(expected,inst)) return expected; if(expected.installIfNecessaryFrom(new URL(inst.url), log, "Unpacking " + inst.url + " to " + expected + " on " + node.getDisplayName())) { expected.child(".timestamp").delete(); // we don't use the timestamp FilePath base = findPullUpDirectory(expected); if(base!=null && base!=expected) base.moveAllChildrenTo(expected); // leave a record for the next up-to-date check expected.child(".installedFrom").write(inst.url,"UTF-8"); expected.act(new ZipExtractionInstaller.ChmodRecAPlusX()); } return expected; }
@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()); }
try { if(script!=null) script.delete(); } catch (IOException e) { if (r==-1 && e.getCause() instanceof ChannelClosedException) {
getInitialAdminPasswordFile().delete(); } catch (InterruptedException e) { throw new IOException(e);
private void deleteFilePathQuietly(FilePath file) { try { file.delete(); } catch (IOException | InterruptedException ignore) { } }
public void close() throws IOException, InterruptedException { // TODO implement AutoCloseable in Java 7+ if (sshPrivateKey != null) { sshPrivateKey.delete(); } }
@Override public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { listener.getLogger().println("Deleting " + tempFiles.size() + " temporary files"); for (String tempFile : tempFiles) { LOGGER.log(Level.FINE, "Delete: {0}", new Object[]{tempFile}); new FilePath(workspace, tempFile).delete(); } }
private static void deleteFilePathQuietly(FilePath filePath) { try { if (filePath != null && filePath.exists()) { filePath.delete(); } } catch (Exception e) { // Ignore exceptions } }
@Override public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { for (String configFile : configFiles) { workspace.child(configFile).delete(); } } }
@Override public void delete(String file) throws IOException, InterruptedException { $(file).delete(); }
public void delete(String file) throws IOException, InterruptedException { $(file).delete(); }
public void run() { try { writeToFilePath.delete(); } catch (Exception e) { // swallow - file may not exist } final byte[] bytes = getHttpBytes(readFromURL, runnerWithTimeOut, builder.getFitnesseHttpTimeout(envVars)); writeFitnesseResults(writeToFilePath, bytes); } };
@Override public KubernetesClientWrapper buildClient(FilePath workspace) throws Exception { FilePath kubeconfig = fetchConfig(workspace); try { return new KubernetesClientWrapper(kubeconfig.getRemote()); } finally { kubeconfig.delete(); } }
@Override public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { FilePath patch = build.getWorkspace().child(PatchParameterDefinition.LOCATION); patch.delete(); Environment env = nested.setUp(build,launcher,listener); if (patch.exists()) { listener.getLogger().println("Applying "+ PatchNote.encodeTo("a patch")); patch.act(new ApplyTask()); } return env; } };
@WebMethod(name="heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Jenkins.RUN_SCRIPTS); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
@WebMethod(name = "heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Hudson.ADMINISTER); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
@WebMethod(name = "heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Hudson.ADMINISTER); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
@WebMethod(name="heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Hudson.ADMINISTER); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }
@WebMethod(name="heapdump.hprof") public void doHeapDump(StaplerRequest req, StaplerResponse rsp) throws IOException, InterruptedException { owner.checkPermission(Hudson.ADMINISTER); rsp.setContentType("application/octet-stream"); FilePath dump = obtain(); try { dump.copyTo(rsp.getCompressedOutputStream(req)); } finally { dump.delete(); } }