本文整理了Java中jenkins.model.Jenkins.getRawBuildsDir()
方法的一些代码示例,展示了Jenkins.getRawBuildsDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getRawBuildsDir()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getRawBuildsDir
暂无
代码示例来源:origin: jenkinsci/jenkins
@Override
public void onLocationChanged(Item item, String oldFullName, String newFullName) {
final Jenkins jenkins = Jenkins.getInstance();
if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
File newBuildDir = ((Job)item).getBuildDir();
try {
if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
//OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
//So let's try even though we lack some information
String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
if (oldBuildsDir.contains("<NOPE>")) {
LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
" but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
} else {
File oldDir = new File(oldBuildsDir);
if (oldDir.isDirectory()) {
try {
FileUtils.moveDirectory(oldDir, newBuildDir);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
}
}
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
}
}
}
}
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
@Test
@ConfiguredWithCode(value = "SelfConfiguratorTest.yml")
public void self_configure() {
assertEquals("/tmp", Jenkins.getInstance().getRawBuildsDir());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void onLocationChanged(Item item, String oldFullName, String newFullName) {
final Jenkins jenkins = Jenkins.getInstance();
if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
File newBuildDir = ((Job)item).getBuildDir();
try {
if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
//OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
//So let's try even though we lack some information
String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
if (oldBuildsDir.contains("<NOPE>")) {
LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
" but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
} else {
File oldDir = new File(oldBuildsDir);
if (oldDir.isDirectory()) {
try {
FileUtils.moveDirectory(oldDir, newBuildDir);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
}
}
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!