Refine search
public String getCommand() { return RunIdMigrator.getUnmigrationCommandLine(Jenkins.getInstance().getRootDir()); } }
/** * Returns {@code true} if and only if the list of nodes is stored in the legacy location. * * @return {@code true} if and only if the list of nodes is stored in the legacy location. */ public boolean isLegacy() { return !new File(jenkins.getRootDir(), "nodes").isDirectory(); } }
private File getSecretKeyFile() { return new File(Jenkins.getInstance().getRootDir(),"secret.key"); }
public DefaultConfidentialStore() throws IOException, InterruptedException { this(new File(Jenkins.getInstance().getRootDir(),"secrets")); }
@Nonnull private File getMasterKillSwitchFile(@Nonnull Jenkins jenkins) { return new File(jenkins.getRootDir(),"secrets/slave-to-master-security-kill-switch"); }
public DoubleLaunchChecker() { home = Jenkins.getInstance().getRootDir(); }
static File getInstallingPluginsFile() { return new File(Jenkins.getInstance().getRootDir(), "jenkins.install.InstallUtil.installingPlugins"); }
private File getRootDirFor(String name) { return new File(new File(getRootDir(),"jobs"), name); }
@Restricted(NoExternalUse.class) public static String expandVariablesForDirectory(String base, String itemFullName, String itemRootDir) { return Util.replaceMacro(base, ImmutableMap.of( "JENKINS_HOME", Jenkins.getInstance().getRootDir().getPath(), "ITEM_ROOTDIR", itemRootDir, "ITEM_FULLNAME", itemFullName, // legacy, deprecated "ITEM_FULL_NAME", itemFullName.replace(':','$'))); // safe, see JENKINS-12251 }
/** * Returns true if there's some data in the fingerprint database. */ public boolean isReady() { return new File(Jenkins.getInstance().getRootDir(),"fingerprints").exists(); }
/** * Returns the directory that the nodes are stored in. * * @return the directory that the nodes are stored in. * @throws IOException */ private File getNodesDir() throws IOException { final File nodesDir = new File(jenkins.getRootDir(), "nodes"); if (!nodesDir.isDirectory() && !nodesDir.mkdirs()) { throw new IOException(String.format("Could not mkdirs %s", nodesDir)); } return nodesDir; }
protected void doRun() { long free = Jenkins.getInstance().getRootDir().getUsableSpace(); long total = Jenkins.getInstance().getRootDir().getTotalSpace(); if(free<=0 || total<=0) { // information unavailable. pointless to try. LOGGER.info("JENKINS_HOME disk usage information isn't available. aborting to monitor"); cancel(); return; } LOGGER.fine("Monitoring disk usage of JENKINS_HOME. total="+total+" free="+free); // if it's more than 90% full and less than the minimum, activate // it's AND and not OR so that small Hudson home won't get a warning, // and similarly, if you have a 1TB disk, you don't get a warning when you still have 100GB to go. HudsonHomeDiskUsageMonitor.get().activated = (total/free>10 && free< FREE_SPACE_THRESHOLD); }
static File configDir() { return new File(Jenkins.getInstance().getRootDir(), "log"); }
/** * File that captures the state of upgrade. * * This file records the version number that the installation has upgraded to. */ /*package*/ static File getUpdateStateFile() { return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state"); }
/** * Relocate log files in the old location to the new location. * * Files were used to be $JENKINS_ROOT/slave-NAME.log (and .1, .2, ...) * but now they are at $JENKINS_ROOT/logs/slaves/NAME/slave.log (and .1, .2, ...) * * @see #getLogFile() */ @Initializer public static void relocateOldLogs() { relocateOldLogs(Jenkins.getInstance().getRootDir()); }
static File getConfigFile() { return new File(Jenkins.getInstance().getRootDir(), "config.xml"); }
/** * Gets the directory where Hudson stores user information. */ static File getRootDir() { return new File(Jenkins.get().getRootDir(), "users"); }
@Override protected FilePathRule parse(String line) { line = line.trim(); if (line.isEmpty()) return null; line = line.replace("<BUILDDIR>","<JOBDIR>/builds/<BUILDID>"); line = line.replace("<BUILDID>","(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9]|[0-9]+)"); line = line.replace("<JOBDIR>","<JENKINS_HOME>/jobs/.+"); line = line.replace("<JENKINS_HOME>","\\Q"+Jenkins.getInstance().getRootDir().getPath()+"\\E"); // config file is always /-separated even on Windows, so bring it back to \-separation. // This is done in the context of regex, so it has to be \\, which means in the source code it is \\\\ if (isWindows()) line = line.replace("/","\\\\"); Matcher m = PARSER.matcher(line); if (!m.matches()) throw new Failure("Invalid filter rule line: "+line); try { return new FilePathRule( Pattern.compile(m.group(3)), createOpMatcher(m.group(2)), m.group(1).equals("allow")); } catch (Exception e) { throw new Failure("Invalid filter rule line: "+line+"\n"+ Functions.printThrowable(e)); } }
static File getLastExecVersionFile() { return new File(Jenkins.getInstance().getRootDir(), "jenkins.install.InstallUtil.lastExecVersion"); }
/*package*/ File getXMLQueueFile() { return new File(Jenkins.get().getRootDir(), "queue.xml"); }