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

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

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

Jenkins.getRawBuildsDir介绍

暂无

代码示例

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

  1. @Override
  2. public void onLocationChanged(Item item, String oldFullName, String newFullName) {
  3. final Jenkins jenkins = Jenkins.getInstance();
  4. if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
  5. File newBuildDir = ((Job)item).getBuildDir();
  6. try {
  7. if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
  8. //OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
  9. //So let's try even though we lack some information
  10. String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
  11. if (oldBuildsDir.contains("<NOPE>")) {
  12. LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
  13. " but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
  14. } else {
  15. File oldDir = new File(oldBuildsDir);
  16. if (oldDir.isDirectory()) {
  17. try {
  18. FileUtils.moveDirectory(oldDir, newBuildDir);
  19. } catch (IOException e) {
  20. LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
  21. }
  22. }
  23. }
  24. }
  25. } catch (IOException e) {
  26. LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
  27. }
  28. }
  29. }
  30. }

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

  1. @Test
  2. @ConfiguredWithCode(value = "SelfConfiguratorTest.yml")
  3. public void self_configure() {
  4. assertEquals("/tmp", Jenkins.getInstance().getRawBuildsDir());
  5. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. @Override
  2. public void onLocationChanged(Item item, String oldFullName, String newFullName) {
  3. final Jenkins jenkins = Jenkins.getInstance();
  4. if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
  5. File newBuildDir = ((Job)item).getBuildDir();
  6. try {
  7. if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
  8. //OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
  9. //So let's try even though we lack some information
  10. String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
  11. if (oldBuildsDir.contains("<NOPE>")) {
  12. LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
  13. " but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
  14. } else {
  15. File oldDir = new File(oldBuildsDir);
  16. if (oldDir.isDirectory()) {
  17. try {
  18. FileUtils.moveDirectory(oldDir, newBuildDir);
  19. } catch (IOException e) {
  20. LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
  21. }
  22. }
  23. }
  24. }
  25. } catch (IOException e) {
  26. LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
  27. }
  28. }
  29. }
  30. }

相关文章

Jenkins类方法