Refine search
listener.getLogger().println("Cycle detected: "+dir); return 0; if (cn.endsWith(".xml")) { if ((count++)%100==0) listener.getLogger().println("Scanning "+child); try { if (rewrite(child)) { listener.getLogger().println("Rewritten "+child); rewritten++; Functions.printStackTrace(e, listener.error("Failed to rewrite " + child));
@Override protected void fix(TaskListener listener) throws Exception { LOGGER.info("Initiating a re-keying of secrets. See "+getLogFile()); SecretRewriter rewriter = new SecretRewriter(); try { PrintStream log = listener.getLogger(); log.println("Started re-keying " + new Date()); int count = rewriter.rewriteRecursive(Jenkins.getInstance().getRootDir(), listener); log.printf("Completed re-keying %d files on %s\n",count,new Date()); new RekeySecretAdminMonitor().done.on(); LOGGER.info("Secret re-keying completed"); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Fatal failure in re-keying secrets",e); Functions.printStackTrace(e, listener.error("Fatal failure in rewriting secrets")); } }
/** * On Windows, error messages for IOException aren't very helpful. * This method generates additional user-friendly error message to the listener */ public static void displayIOException(@Nonnull IOException e, @Nonnull TaskListener listener ) { String msg = getWin32ErrorMessage(e); if(msg!=null) listener.getLogger().println(msg); }
/** * Examines the file and returns true if a file was deleted. */ private boolean check(File fingerprintFile, TaskListener listener) { try { Fingerprint fp = loadFingerprint(fingerprintFile); if (fp == null || !fp.isAlive()) { listener.getLogger().println("deleting obsolete " + fingerprintFile); fingerprintFile.delete(); return true; } else { // get the fingerprint in the official map so have the changes visible to Jenkins // otherwise the mutation made in FingerprintMap can override our trimming. fp = getFingerprint(fp); return fp.trim(); } } catch (IOException e) { Functions.printStackTrace(e, listener.error("Failed to process " + fingerprintFile)); return false; } }
listener.getLogger().println("Skipping installation of " + archive + " to " + remote + ": " + x); listener.getLogger().println("Following redirect " + archive.toExternalForm() + " -> " + location); return installIfNecessaryFrom(getUrlFactory().newURL(location), listener, message, maxRedirects - 1); } else { listener.getLogger().println("Skipping installation of " + archive + " to " + remote + " due to too many redirects."); return false; return false; } else if (responseCode != HttpURLConnection.HTTP_OK) { listener.getLogger().println("Skipping installation of " + archive + " to " + remote + " due to server error: " + responseCode + " " + httpCon.getResponseMessage()); return false; listener.getLogger().println(message); } catch (IOException x) { if (listener != null) { Functions.printStackTrace(x, listener.error("Failed to download " + archive + " from agent; will retry from master"));
@Restricted(NoExternalUse.class) // TODO Java 9 make private default PrintWriter _error(String prefix, String msg) { PrintStream out = getLogger(); out.print(prefix); out.println(msg); // annotate(new HudsonExceptionNote()) if and when this is made to do something Charset charset = getCharset(); return new PrintWriter(charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out), true); }
PrintStream out = listener.getLogger(); ZFSFileSystem existing = zfs.getFileSystemByMountPoint(home); if(existing!=null) { out.println(home+" is already on ZFS. Doing nothing"); return true; out.println("Opening "+target); ZFSFileSystem hudson = zfs.open(target, ZFSFileSystem.class); hudson.setMountPoint(tmpDir); out.println("Copying all existing data files"); if(system(home,listener, "/usr/bin/cp","-pR",".", tmpDir.getAbsolutePath())!=0) { out.println("Failed to copy "+home+" to "+tmpDir); hudson.share(); } catch (ZFSException e) { listener.error("Failed to share the file systems: "+e.getCode());
@Override public final void run() { isRunning = true; try { perform(listener); listener.getLogger().println("Completed"); owner.workerThread = null; } catch (InterruptedException e) { listener.getLogger().println("Aborted"); } catch (Exception e) { Functions.printStackTrace(e, listener.getLogger()); } finally { listener = null; isRunning =false; } log.markAsComplete(); }
continue; // children will typically have their own workspaces as subdirectories; probably no real workspace of its own listener.getLogger().println("Checking " + item.getFullDisplayName()); for (Node node : nodes) { FilePath ws = node.getWorkspaceFor(item); check = shouldBeDeleted(item, ws, node); } catch (IOException x) { Functions.printStackTrace(x, listener.error("Failed to check " + node.getDisplayName())); continue; } catch (InterruptedException x) { Functions.printStackTrace(x, listener.error("Failed to check " + node.getDisplayName())); continue; listener.getLogger().println("Deleting " + ws + " on " + node.getDisplayName()); try { ws.deleteRecursive(); WorkspaceList.tempDir(ws).deleteRecursive(); } catch (IOException x) { Functions.printStackTrace(x, listener.error("Failed to delete " + ws + " on " + node.getDisplayName())); } catch (InterruptedException x) { Functions.printStackTrace(x, listener.error("Failed to delete " + ws + " on " + node.getDisplayName()));
@Override public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException { try { listener.getLogger().println(Messages.Fingerprinter_Recording()); Map<String,String> record = new HashMap<String,String>(); EnvVars environment = build.getEnvironment(listener); if(targets.length()!=0) { String expandedTargets = environment.expand(targets); record(build, workspace, listener, record, expandedTargets); } FingerprintAction fingerprintAction = build.getAction(FingerprintAction.class); if (fingerprintAction != null) { fingerprintAction.add(record); } else { build.addAction(new FingerprintAction(build,record)); } if (enableFingerprintsInDependencyGraph) { Jenkins.getInstance().rebuildDependencyGraphAsync(); } } catch (IOException e) { Functions.printStackTrace(e, listener.error(Messages.Fingerprinter_Failed())); build.setResult(Result.FAILURE); } // failing to record fingerprints is an error but not fatal }