jenkins.model.Jenkins.getRootDir()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(266)

本文整理了Java中jenkins.model.Jenkins.getRootDir()方法的一些代码示例,展示了Jenkins.getRootDir()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getRootDir()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getRootDir

Jenkins.getRootDir介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. public String getCommand() {
  2. return RunIdMigrator.getUnmigrationCommandLine(Jenkins.getInstance().getRootDir());
  3. }
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns {@code true} if and only if the list of nodes is stored in the legacy location.
  3. *
  4. * @return {@code true} if and only if the list of nodes is stored in the legacy location.
  5. */
  6. public boolean isLegacy() {
  7. return !new File(jenkins.getRootDir(), "nodes").isDirectory();
  8. }
  9. }

代码示例来源:origin: jenkinsci/jenkins

  1. private File getSecretKeyFile() {
  2. return new File(Jenkins.getInstance().getRootDir(),"secret.key");
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. public DefaultConfidentialStore() throws IOException, InterruptedException {
  2. this(new File(Jenkins.getInstance().getRootDir(),"secrets"));
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Nonnull
  2. private File getMasterKillSwitchFile(@Nonnull Jenkins jenkins) {
  3. return new File(jenkins.getRootDir(),"secrets/slave-to-master-security-kill-switch");
  4. }

代码示例来源:origin: jenkinsci/jenkins

  1. public DoubleLaunchChecker() {
  2. home = Jenkins.getInstance().getRootDir();
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. static File getInstallingPluginsFile() {
  2. return new File(Jenkins.getInstance().getRootDir(), "jenkins.install.InstallUtil.installingPlugins");
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. private File getRootDirFor(String name) {
  2. return new File(new File(getRootDir(),"jobs"), name);
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Restricted(NoExternalUse.class)
  2. public static String expandVariablesForDirectory(String base, String itemFullName, String itemRootDir) {
  3. return Util.replaceMacro(base, ImmutableMap.of(
  4. "JENKINS_HOME", Jenkins.getInstance().getRootDir().getPath(),
  5. "ITEM_ROOTDIR", itemRootDir,
  6. "ITEM_FULLNAME", itemFullName, // legacy, deprecated
  7. "ITEM_FULL_NAME", itemFullName.replace(':','$'))); // safe, see JENKINS-12251
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns true if there's some data in the fingerprint database.
  3. */
  4. public boolean isReady() {
  5. return new File(Jenkins.getInstance().getRootDir(),"fingerprints").exists();
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns the directory that the nodes are stored in.
  3. *
  4. * @return the directory that the nodes are stored in.
  5. * @throws IOException
  6. */
  7. private File getNodesDir() throws IOException {
  8. final File nodesDir = new File(jenkins.getRootDir(), "nodes");
  9. if (!nodesDir.isDirectory() && !nodesDir.mkdirs()) {
  10. throw new IOException(String.format("Could not mkdirs %s", nodesDir));
  11. }
  12. return nodesDir;
  13. }

代码示例来源:origin: jenkinsci/jenkins

  1. protected void doRun() {
  2. long free = Jenkins.getInstance().getRootDir().getUsableSpace();
  3. long total = Jenkins.getInstance().getRootDir().getTotalSpace();
  4. if(free<=0 || total<=0) {
  5. // information unavailable. pointless to try.
  6. LOGGER.info("JENKINS_HOME disk usage information isn't available. aborting to monitor");
  7. cancel();
  8. return;
  9. }
  10. LOGGER.fine("Monitoring disk usage of JENKINS_HOME. total="+total+" free="+free);
  11. // if it's more than 90% full and less than the minimum, activate
  12. // it's AND and not OR so that small Hudson home won't get a warning,
  13. // and similarly, if you have a 1TB disk, you don't get a warning when you still have 100GB to go.
  14. HudsonHomeDiskUsageMonitor.get().activated = (total/free>10 && free< FREE_SPACE_THRESHOLD);
  15. }

代码示例来源:origin: jenkinsci/jenkins

  1. static File configDir() {
  2. return new File(Jenkins.getInstance().getRootDir(), "log");
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * File that captures the state of upgrade.
  3. *
  4. * This file records the version number that the installation has upgraded to.
  5. */
  6. /*package*/ static File getUpdateStateFile() {
  7. return new File(Jenkins.get().getRootDir(),"jenkins.install.UpgradeWizard.state");
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Relocate log files in the old location to the new location.
  3. *
  4. * Files were used to be $JENKINS_ROOT/slave-NAME.log (and .1, .2, ...)
  5. * but now they are at $JENKINS_ROOT/logs/slaves/NAME/slave.log (and .1, .2, ...)
  6. *
  7. * @see #getLogFile()
  8. */
  9. @Initializer
  10. public static void relocateOldLogs() {
  11. relocateOldLogs(Jenkins.getInstance().getRootDir());
  12. }

代码示例来源:origin: jenkinsci/jenkins

  1. static File getConfigFile() {
  2. return new File(Jenkins.getInstance().getRootDir(), "config.xml");
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Gets the directory where Hudson stores user information.
  3. */
  4. static File getRootDir() {
  5. return new File(Jenkins.get().getRootDir(), "users");
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. @Override
  2. protected FilePathRule parse(String line) {
  3. line = line.trim();
  4. if (line.isEmpty()) return null;
  5. line = line.replace("<BUILDDIR>","<JOBDIR>/builds/<BUILDID>");
  6. 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]+)");
  7. line = line.replace("<JOBDIR>","<JENKINS_HOME>/jobs/.+");
  8. line = line.replace("<JENKINS_HOME>","\\Q"+Jenkins.getInstance().getRootDir().getPath()+"\\E");
  9. // config file is always /-separated even on Windows, so bring it back to \-separation.
  10. // This is done in the context of regex, so it has to be \\, which means in the source code it is \\\\
  11. if (isWindows()) line = line.replace("/","\\\\");
  12. Matcher m = PARSER.matcher(line);
  13. if (!m.matches())
  14. throw new Failure("Invalid filter rule line: "+line);
  15. try {
  16. return new FilePathRule(
  17. Pattern.compile(m.group(3)),
  18. createOpMatcher(m.group(2)),
  19. m.group(1).equals("allow"));
  20. } catch (Exception e) {
  21. throw new Failure("Invalid filter rule line: "+line+"\n"+ Functions.printThrowable(e));
  22. }
  23. }

代码示例来源:origin: jenkinsci/jenkins

  1. static File getLastExecVersionFile() {
  2. return new File(Jenkins.getInstance().getRootDir(), "jenkins.install.InstallUtil.lastExecVersion");
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. /*package*/ File getXMLQueueFile() {
  2. return new File(Jenkins.get().getRootDir(), "queue.xml");
  3. }

相关文章

Jenkins类方法