Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Recorded the fix in changelog.
- Added a separate screen to show the unmigration instruction, which
  makes it easier for people to find it than search logs.
  • Loading branch information
kohsuke committed Dec 23, 2014
1 parent 6f0eb9b commit 711b332
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 42 deletions.
55 changes: 30 additions & 25 deletions changelog.html
Expand Up @@ -55,6 +55,11 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class='major rfe'>
<b><tt>JENKINS_HOME</tt> layout change</b>: builds are now keyed by build numbers and not timestamps.
See <a href="https://wiki.jenkins-ci.org/display/JENKINS/JENKINS-24380+Migration">Wiki</a> for details
and downgrade.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24380">issue 24380</a>)
<li class=bug>
Fingerprint compaction aggravated lazy-loading performance issues.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19392">issue 19392</a>)
Expand Down Expand Up @@ -123,7 +128,7 @@ <h3><a name=v1.591>What's new in 1.591</a> (2014/11/25)</h3>
<ul class=image>
<li class=bug>
Always use forward slashes in path separators during in ZIP archives generated by Directory Browser
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22514">issue 22514</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22514">issue 22514</a>)
</ul>
<h3><a name=v1.590>What's new in 1.590</a> (2014/11/16)</h3>
<ul class=image>
Expand All @@ -135,7 +140,7 @@ <h3><a name=v1.590>What's new in 1.590</a> (2014/11/16)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-25400">issue 25400</a>)
<li class=bug>
Fixed various real or potential resource leaks discovered by <a href="https://scan.coverity.com/projects/94/">Coverity Scan</code>
(<a href="https://github.com/jenkinsci/jenkins/pull/1434">pull request 1434</a>)
(<a href="https://github.com/jenkinsci/jenkins/pull/1434">pull request 1434</a>)
<li class=rfe>
API changes: Expose <code>AbstractProject.AbstractProjectDescriptor#validateLabelExpression</code> for plugins.
(<a href="https://github.com/jenkinsci/jenkins/pull/1456">pull request 1456</a>)
Expand All @@ -144,7 +149,7 @@ <h3><a name=v1.590>What's new in 1.590</a> (2014/11/16)</h3>
(<a href="https://github.com/jenkinsci/jenkins/pull/1458">pull request 1458</a>)
<li class=rfe>
API method to get non-null <code>Jenkins</code> instance with internal validation
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23339">issue 23339</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-23339">issue 23339</a>)
</ul>
<h3><a name=v1.589>What's new in 1.589</a> (2014/11/09)</h3>
<ul class=image>
Expand Down Expand Up @@ -190,7 +195,7 @@ <h3><a name=v1.586>What's new in 1.586</a> (2014/10/26)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-25019">issue 25019</a>)
<li class=bug>
Existing <code>FileParameter</code>s should be handled as different values to avoid merging of queued builds
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19017">issue 19017</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19017">issue 19017</a>)
</ul>
<h3><a name=v1.585>What's new in 1.585</a> (2014/10/19)</h3>
<ul class=image>
Expand All @@ -210,22 +215,22 @@ <h3><a name=v1.585>What's new in 1.585</a> (2014/10/19)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-25065">issue 25065</a>)
<li class=bug>
Greater-than characters are not escaped in HTML outputs like e-mails
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16184">issue 16184</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16184">issue 16184</a>)
<li class=bug>
Thread starvation from <code>OldDataMonitor</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24763">issue 24763</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24763">issue 24763</a>)
<li class=bug>
Integer overflow in quiet-down timeout calculation
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24914">issue 24914</a>)
Integer overflow in quiet-down timeout calculation
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24914">issue 24914</a>)
<li class=bug>
Don't put session IDs in URLs even when cookies are disabled.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22358">issue 22358</a>)
<li class=rfe>
Show keep build log reason in tool tips
(<a href="https://github.com/jenkinsci/jenkins/pull/1422">pull request 1422</a>)
(<a href="https://github.com/jenkinsci/jenkins/pull/1422">pull request 1422</a>)
<li class=bug>
Do not disable projects, which do not support such operation (like Matrix configurations)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24340">issue 24340</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-24340">issue 24340</a>)
<li class=rfe>
Improved the scalability of SSH slaves plugin caused by global lock in <tt>SecureRandom</tt>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20108">issue 20108</a>)
Expand Down Expand Up @@ -479,7 +484,7 @@ <h3><a name=v1.574>What's new in 1.574</a> (2014/07/27)</h3>
<ul class=image>
<li class="rfe">
UI redesign: Use Helvetica as default font
(<a href="https://github.com/jenkinsci/jenkins/pull/1315">pull 1315</a>,
(<a href="https://github.com/jenkinsci/jenkins/pull/1315">pull 1315</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-23840">issue 23840</a>)
<li class="bug">
Synchronization issue during tool installation
Expand Down Expand Up @@ -622,7 +627,7 @@ <h3><a name=v1.567>What's new in 1.567</a> (2014/06/09)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20499">issue 20499</a>)
<li class="bug">
Fixed <code>NullPointerException</code> on plugin installations when invalid update center is set
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20031">issue 20031</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20031">issue 20031</a>)
<li class="bug">
Use DISABLED_ANIME icon while building a disabled project
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-8358">issue 8358</a>)
Expand All @@ -635,22 +640,22 @@ <h3><a name=v1.567>What's new in 1.567</a> (2014/06/09)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18116">issue 18116</a>)
<li class="bug">
Properly close input streams in <code>FileParameterValue</code>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22693">issue 22693</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22693">issue 22693</a>)
<li class="bug">
Incorrect failure age in the JUnit test results
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18626">issue 18626</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18626">issue 18626</a>)
<li class="bug">
Fixed deletion links for JVM Crash error logs
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22617">issue 22617</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22617">issue 22617</a>)
<li class="rfe">
Distinguish &quot;nodes for label offline&quot; from &quot;no nodes for label&quot;
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17114">issue 17114</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17114">issue 17114</a>)
<li class="rfe">
Add causes to queue item tool tip
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19250">issue 19250</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19250">issue 19250</a>)
<li class="rfe">
RPM: added JENKINS_HTTPS_KEYSTORE and JENKINS_HTTPS_KEYSTORE_PASSWORD options to Jenkins sysconfig file
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11673">issue 11673</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11673">issue 11673</a>)
<li class="bug">
RPM: Do not install jenkins.repo file
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22690">issue 22690</a>)
Expand Down Expand Up @@ -1000,7 +1005,7 @@ <h3><a name=v1.553>What's new in 1.553</a> (2014/03/02)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19559">issue 19559</a>)
<li class=bug>
Fix autocompletion for items in folders.
(<a href="https://github.com/jenkinsci/jenkins/pull/1124">pull request 1124</a>)
(<a href="https://github.com/jenkinsci/jenkins/pull/1124">pull request 1124</a>)
</ul>
<h3><a name=v1.552>What's new in 1.552</a> (2014/02/24)</h3>
<ul class=image>
Expand Down Expand Up @@ -1307,7 +1312,7 @@ <h3><a name=v1.538>What's new in 1.538</a> (2013/11/03)</h3>
Added CLI commands that manipulate views
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19996">issue 19996</a>)
<li class=rfe>
Improved the /cli help screen.
Improved the /cli help screen.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20023">issue 20023</a>)
<li class=bug>
Polling-triggered jobs get scheduled en-mass on start-up if slaves aren't online yet.
Expand Down Expand Up @@ -1377,7 +1382,7 @@ <h3><a name=v1.536>What's new in 1.536</a> (2013/10/20)</h3>
<a href="https://issues.jenkins-ci.org/browse/JENKINS-18879">issue 18879</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-19619">issue 19619</a>)
<li class='major rfe'>
Upgrade bundled iplugin versions: ssh-slaves to 1.4, ssh-credentials to 1.5.3 and
Upgrade bundled iplugin versions: ssh-slaves to 1.4, ssh-credentials to 1.5.3 and
credentials to 1.8.3
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19945">issue 19945</a>)
<li class='major rfe'>
Expand Down Expand Up @@ -1967,7 +1972,7 @@ <h3><a name=v1.512>What's new in 1.512</a> (2013/04/21)</h3>
”My Views" links leads to 404 Not Found.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17317">issue 17317</a>)
<li class=bug>
Quoting Issue with JDK Installer with Windows Installer.
Quoting Issue with JDK Installer with Windows Installer.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-5408">issue 5408</a>)
<li class=bug>
Restored compatibility in <code>ArtifactArchiver</code> signature; broken in 1.509 and could affect plugins.
Expand Down Expand Up @@ -2043,7 +2048,7 @@ <h3><a name=v1.509>What's new in 1.509</a> (2013/04/02)</h3>
ChangeLog should produce some output even if some (plugin) annotator fails
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17084">issue 17084</a>)
<li class=bug>
View name should not allow "..".
View name should not allow "..".
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16608">issue 16608</a>)
</ul>
<h3><a name=v1.508>What's new in 1.508</a> (2013/03/25)</h3>
Expand Down Expand Up @@ -2075,7 +2080,7 @@ <h3><a name=v1.507>What's new in 1.507</a> (2013/03/24)</h3>
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16089">issue 16089</a>)
<li class=bug>
Wrong build result in post build steps after failed pre build step in maven projects.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17177">issue 17177</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17177">issue 17177</a>)
</ul>
<h3><a name=v1.506>What's new in 1.506</a> (2013/03/17)</h3>
<ul class=image>
Expand Down Expand Up @@ -2264,7 +2269,7 @@ <h3><a name=v1.501>What's new in 1.501</a> (2013/02/10)</h3>
<li class=bug>
Fixed NullPointerException when copying from existing Maven job
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16499">issue 16499</a>)

</ul>
<h3><a name=v1.500>What's new in 1.500</a> (2013/01/26)</h3>
<ul class=image>
Expand Down
71 changes: 54 additions & 17 deletions core/src/main/java/jenkins/model/RunIdMigrator.java
Expand Up @@ -24,8 +24,10 @@

package jenkins.model;

import hudson.Extension;
import hudson.Util;
import hudson.model.Job;
import hudson.model.RootAction;
import hudson.model.Run;
import hudson.util.AtomicFileWriter;
import hudson.util.StreamTaskListener;
Expand Down Expand Up @@ -58,6 +60,8 @@
import org.apache.tools.ant.BuildException;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.framework.io.WriterOutputStream;

import static java.util.logging.Level.*;
Expand Down Expand Up @@ -158,26 +162,29 @@ public synchronized boolean migrate(File dir, @CheckForNull File jenkinsHome) {
LOGGER.log(INFO, "Migrating build records in {0}", dir);
doMigrate(dir);
save(dir);
if (jenkinsHome != null && offeredToUnmigrate.add(jenkinsHome)) {
StringBuilder cp = new StringBuilder();
for (Class<?> c : new Class<?>[] {RunIdMigrator.class, /* TODO how to calculate transitive dependencies automatically? */Charsets.class, WriterOutputStream.class, BuildException.class, FastDateFormat.class}) {
URL location = c.getProtectionDomain().getCodeSource().getLocation();
String locationS = location.toString();
if (location.getProtocol().equals("file")) {
try {
locationS = new File(location.toURI()).getAbsolutePath();
} catch (URISyntaxException x) {
// never mind
}
}
if (cp.length() > 0) {
cp.append(File.pathSeparator);
if (jenkinsHome != null && offeredToUnmigrate.add(jenkinsHome))
LOGGER.log(WARNING, "Build record migration is one-way. If you need to downgrade Jenkins, run: {0}", getUnmigrationCommandLine(jenkinsHome));
return true;
}

private static String getUnmigrationCommandLine(File jenkinsHome) {
StringBuilder cp = new StringBuilder();
for (Class<?> c : new Class<?>[] {RunIdMigrator.class, /* TODO how to calculate transitive dependencies automatically? */Charsets.class, WriterOutputStream.class, BuildException.class, FastDateFormat.class}) {
URL location = c.getProtectionDomain().getCodeSource().getLocation();
String locationS = location.toString();
if (location.getProtocol().equals("file")) {
try {
locationS = new File(location.toURI()).getAbsolutePath();
} catch (URISyntaxException x) {
// never mind
}
cp.append(locationS);
}
LOGGER.log(WARNING, "Build record migration is one-way. If you need to downgrade Jenkins, run: java -classpath {0} {1} \"{2}\"", new Object[] {cp, RunIdMigrator.class.getName(), jenkinsHome});
if (cp.length() > 0) {
cp.append(File.pathSeparator);
}
cp.append(locationS);
}
return true;
return String.format("java -classpath \"%s\" %s \"%s\"", cp, RunIdMigrator.class.getName(), jenkinsHome);
}

private static final Pattern NUMBER_ELT = Pattern.compile("(?m)^ <number>(\\d+)</number>(\r?\n)");
Expand Down Expand Up @@ -367,4 +374,34 @@ private static void unmigrateBuildsDir(File builds) throws Exception {
System.err.println(builds + " has been restored to its original format");
}

/**
* Expose unmigration instruction to the user.
*/
@Extension
public static class UnmigrationInstruction implements RootAction, StaplerProxy {
@Override
public String getIconFileName() {
return null;
}

@Override
public String getDisplayName() {
return null;
}

@Override
public String getUrlName() {
return "JENKINS-24380";
}

@Override
public Object getTarget() {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
return this;
}

This comment has been minimized.

Copy link
@jglick

jglick Dec 29, 2014

Member

This seems gratuitous. Why not just add the permission attribute to l:layout?


public String getCommand() {
return RunIdMigrator.getUnmigrationCommandLine(Jenkins.getInstance().getRootDir());
}
}
}
@@ -0,0 +1,47 @@
<!--
The MIT License
Copyright (c) 2014, CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="Jenkins">
<l:header />
<l:main-panel>
<p>
To reverse the effect of <a href="http://jenkins-ci.org/issue/24380">JENKINS-24380</a> fix, run the following command
on the server. See <a href="https://wiki.jenkins-ci.org/display/JENKINS/JENKINS-24380+Migration">Wiki page</a>
for more details:
</p>
<table style="width:100%">
<tr>
<td style="line-height:2em; width:80%">
<input type="text" value="${it.command}" style="width:100%"/>
</td>
<td style="line-height:2em">
<l:copyButton message="${%Copied}" text="${it.command}"/>
</td>
</tr>
</table>
</l:main-panel>
</l:layout>
</j:jelly>

9 comments on commit 711b332

@daniel-beck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not hit users unprepared. While there's a bold changelog entry, there should be a post to the users list, and possibly a blog post about this as well.

@kohsuke
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll ask @jglick to do a blog post on http://jenkins-ci.org/node/

@jglick
Copy link
Member

@jglick jglick commented on 711b332 Dec 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if any blog content other than a link to the wiki (which I just edited BTW) is really needed.

There should be a link to the wiki in the server log message. Possibly this RootAction should really be a AdministrativeMonitor activated by the migration, with a page from which you can look at the instructions, or disable the notice; WDYT?

@jglick
Copy link
Member

@jglick jglick commented on 711b332 Dec 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference: #1379. (@kohsuke BTW it is helpful to refer to the PR number in the commit comment when merging manually, as this sets up bidirectional links automatically.)

@daniel-beck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this an AdministrativeMonitor is a great idea, however it should still be possible to reach the downgrade page even if dismissed once (i.e. use a real page with URL, not just the monitor notice).

There should be a link to the wiki in the server log message.

Perfect for users wondering why Jenkins takes so long to start.

@jglick
Copy link
Member

@jglick jglick commented on 711b332 Jan 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel strongly about how it should look, please file a blocking issue at least.

@daniel-beck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick From what you wrote this seems to be the plan already ("with a page from which you can look at the instructions").

@jglick
Copy link
Member

@jglick jglick commented on 711b332 Jan 9, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what you wrote

Sorry, where?

@daniel-beck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick The part I quoted. I asked for:

possible to reach the downgrade page even if dismissed once (i.e. use a real page with URL, not just the monitor notice).

You wrote:

with a page from which you can look at the instructions

Just wanted to emphasize that it really needs to be a separate page with its own URL, and not just in the AdministrativeMontor's message.jelly (which could be dismissed and lost forever).

Please sign in to comment.