提交 62ed20ee 编写于 作者: J Jesse Glick

Merge pull request #891 from ndeloof/JENKINS-19034

[FIXED JENKINS-19034] restore missing buildnumber-ID symlink
......@@ -191,6 +191,9 @@ Upcoming changes</a>
<li class=bug>
Ensuring <code>/log/all</code> shows only <code>INFO</code> and above messages, even if custom loggers display <code>FINE</code> or below.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18959">issue 18959</a>)
<li class=bug>
(re)create build number->id symlink if missing when updating permalink.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19034">issue 19034</a>)
<li class=rfe>
Added a new monitor that detects and fixse out-of-order builds records.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18289">issue 18289</a>)
......
......@@ -134,6 +134,11 @@ public abstract class PeepholePermalink extends Permalink implements Predicate<R
cache.getParentFile().mkdirs();
try {
String target = String.valueOf(n);
if (b != null && !new File(job.getBuildDir(), target).exists()) {
// (re)create the build Number->Id symlink
Util.createSymlink(job.getBuildDir(),b.getId(),target,TaskListener.NULL);
}
writeSymlink(cache, String.valueOf(n));
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to update "+job+" "+getId()+" permalink for " + b, e);
......
......@@ -72,4 +72,16 @@ class PeepholePermalinkTest extends HudsonTestCase {
assert new File(p.rootDir,"$n/build.xml").length() == new File(b1.rootDir,"build.xml").length()
}
}
void testRebuildBuildNumberPermalinks() {
def p = createFreeStyleProject()
def b = assertBuildStatusSuccess(p.scheduleBuild2(0))
File f = new File(p.getBuildDir(), "1")
// assertTrue(Util.isSymlink(f))
f.delete()
PeepholePermalink link = p.getPermalinks().find({l -> l instanceof PeepholePermalink})
println(link)
link.updateCache(p, b)
assertTrue("build symlink hasn't been restored", f.exists())
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册