diff --git a/changelog.html b/changelog.html
index f8348b9193daf25a1bc4f37d2c63726abfa07bb4..84f34f07794e98dd4b71e85b72320e5e3037e38c 100644
--- a/changelog.html
+++ b/changelog.html
@@ -140,6 +140,9 @@ Upcoming changes
Ensuring /log/all
shows only INFO
and above messages, even if custom loggers display FINE
or below.
(issue 18959)
+
+ (re)create build number->id symlink if missing when updating permalink.
+ (issue 19034)
Added a new monitor that detects and fixse out-of-order builds records.
(issue 18289)
diff --git a/core/src/main/java/jenkins/model/PeepholePermalink.java b/core/src/main/java/jenkins/model/PeepholePermalink.java
index 397d035743f63491a2da17c23011e27b11543559..b4667d32a935161ef94392ff9a355bfa7605bb66 100644
--- a/core/src/main/java/jenkins/model/PeepholePermalink.java
+++ b/core/src/main/java/jenkins/model/PeepholePermalink.java
@@ -134,6 +134,11 @@ public abstract class PeepholePermalink extends Permalink implements PredicateId 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);
diff --git a/test/src/test/groovy/jenkins/model/PeepholePermalinkTest.groovy b/test/src/test/groovy/jenkins/model/PeepholePermalinkTest.groovy
index 1c7a04ee9131b649c03c60e4fd041313e249820a..0d0b99653212bc863f3258f881454394565b45c4 100644
--- a/test/src/test/groovy/jenkins/model/PeepholePermalinkTest.groovy
+++ b/test/src/test/groovy/jenkins/model/PeepholePermalinkTest.groovy
@@ -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