mirror of https://github.com/jenkinsci/jenkins.git
Merge pull request #9830 from MarkEWaite/stable-2.479-backport-1
Backporting for 2.479.1
This commit is contained in:
commit
7849dfb89d
|
@ -352,6 +352,12 @@ THE SOFTWARE.
|
|||
<artifactId>stapler-groovy</artifactId>
|
||||
<version>${stapler.version}</version>
|
||||
</dependency>
|
||||
<!-- Override the outdated managed dependency on asm in guice-parent -->
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
<version>9.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.samba.jcifs</groupId>
|
||||
<artifactId>jcifs</artifactId>
|
||||
|
|
|
@ -538,14 +538,17 @@ public class UpdateSite {
|
|||
|
||||
/**
|
||||
* Is this the legacy default update center site?
|
||||
* @deprecated
|
||||
* Will be removed, currently returns always false.
|
||||
* @since 2.343
|
||||
* @since 1.357
|
||||
*/
|
||||
@Deprecated
|
||||
@Restricted(NoExternalUse.class)
|
||||
public boolean isLegacyDefault() {
|
||||
return false;
|
||||
return isJenkinsCI();
|
||||
}
|
||||
|
||||
private boolean isJenkinsCI() {
|
||||
return url != null
|
||||
&& UpdateCenter.PREDEFINED_UPDATE_SITE_ID.equals(id)
|
||||
&& url.startsWith("http://updates.jenkins-ci.org/");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -949,9 +949,28 @@ public abstract class View extends AbstractModelObject implements AccessControll
|
|||
|
||||
/**
|
||||
* Accepts {@code config.xml} submission, as well as serve it.
|
||||
*
|
||||
* @since 2.475
|
||||
*/
|
||||
@WebMethod(name = "config.xml")
|
||||
public HttpResponse doConfigDotXml(StaplerRequest2 req) throws IOException {
|
||||
if (Util.isOverridden(View.class, getClass(), "doConfigDotXml", StaplerRequest.class)) {
|
||||
return doConfigDotXml(StaplerRequest.fromStaplerRequest2(req));
|
||||
} else {
|
||||
return doConfigDotXmlImpl(req);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #doConfigDotXml(StaplerRequest2)}
|
||||
*/
|
||||
@Deprecated
|
||||
@StaplerNotDispatchable
|
||||
public HttpResponse doConfigDotXml(StaplerRequest req) throws IOException {
|
||||
return doConfigDotXmlImpl(StaplerRequest.toStaplerRequest2(req));
|
||||
}
|
||||
|
||||
private HttpResponse doConfigDotXmlImpl(StaplerRequest2 req) throws IOException {
|
||||
if (req.getMethod().equals("GET")) {
|
||||
// read
|
||||
checkPermission(READ);
|
||||
|
|
|
@ -32,6 +32,7 @@ import jenkins.model.Jenkins;
|
|||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
import org.kohsuke.args4j.Option;
|
||||
import org.kohsuke.stapler.StaplerRequest2;
|
||||
|
||||
/**
|
||||
* Safe Restart Jenkins - do not accept any new jobs and try to pause existing.
|
||||
|
@ -53,7 +54,7 @@ public class SafeRestartCommand extends CLICommand {
|
|||
|
||||
@Override
|
||||
protected int run() throws Exception {
|
||||
Jenkins.get().doSafeRestart(null, message);
|
||||
Jenkins.get().doSafeRestart((StaplerRequest2) null, message);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4665,7 +4665,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
|||
/**
|
||||
* Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.
|
||||
*
|
||||
* @since 2.414
|
||||
* @since 2.475
|
||||
*/
|
||||
public HttpResponse doSafeRestart(StaplerRequest2 req, @QueryParameter("message") String message) throws IOException, ServletException, RestartNotSupportedException {
|
||||
checkPermission(MANAGE);
|
||||
|
@ -4684,6 +4684,20 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
|
|||
return HttpResponses.redirectToDot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #doSafeRestart(StaplerRequest2, String)}
|
||||
* @since 2.414
|
||||
*/
|
||||
@Deprecated
|
||||
@StaplerNotDispatchable
|
||||
public HttpResponse doSafeRestart(StaplerRequest req, @QueryParameter("message") String message) throws IOException, javax.servlet.ServletException, RestartNotSupportedException {
|
||||
try {
|
||||
return doSafeRestart(StaplerRequest.toStaplerRequest2(req), message);
|
||||
} catch (ServletException e) {
|
||||
throw ServletExceptionWrapper.fromJakartaServletException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Lifecycle restartableLifecycle() throws RestartNotSupportedException {
|
||||
if (Main.isUnitTest) {
|
||||
throw new RestartNotSupportedException("Restarting the controller JVM is not supported in JenkinsRule-based tests");
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package hudson.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.jvnet.hudson.test.Issue;
|
||||
import org.jvnet.hudson.test.JenkinsRule;
|
||||
import org.jvnet.hudson.test.recipes.LocalData;
|
||||
|
||||
public class UpdateCenterMigrationTest {
|
||||
|
||||
@Rule
|
||||
public JenkinsRule j = new JenkinsRule() {
|
||||
@Override
|
||||
protected void configureUpdateCenter() {
|
||||
// Avoid reverse proxy
|
||||
DownloadService.neverUpdate = true;
|
||||
UpdateSite.neverUpdate = true;
|
||||
}
|
||||
};
|
||||
|
||||
@Issue("JENKINS-73760")
|
||||
@LocalData
|
||||
@Test
|
||||
public void updateCenterMigration() {
|
||||
UpdateSite site = j.jenkins.getUpdateCenter().getSites().stream()
|
||||
.filter(s -> UpdateCenter.PREDEFINED_UPDATE_SITE_ID.equals(s.getId()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
assertFalse(site.isLegacyDefault());
|
||||
assertEquals(j.jenkins.getUpdateCenter().getDefaultBaseUrl() + "update-center.json", site.getUrl());
|
||||
}
|
||||
}
|
|
@ -72,6 +72,7 @@ import org.junit.After;
|
|||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.jvnet.hudson.test.Issue;
|
||||
import org.jvnet.hudson.test.JenkinsRule;
|
||||
|
||||
public class UpdateSiteTest {
|
||||
|
@ -205,6 +206,19 @@ public class UpdateSiteTest {
|
|||
assertNotEquals("plugin data is present", Collections.emptyMap(), site.getData().plugins);
|
||||
}
|
||||
|
||||
@Issue("JENKINS-73760")
|
||||
@Test
|
||||
public void isLegacyDefault() {
|
||||
assertFalse("isLegacyDefault should be false with null id", new UpdateSite(null, "url").isLegacyDefault());
|
||||
assertFalse(
|
||||
"isLegacyDefault should be false when id is not default and url is http://updates.jenkins-ci.org/",
|
||||
new UpdateSite("dummy", "http://updates.jenkins-ci.org/").isLegacyDefault());
|
||||
assertTrue(
|
||||
"isLegacyDefault should be true when id is default and url is http://updates.jenkins-ci.org/",
|
||||
new UpdateSite(UpdateCenter.PREDEFINED_UPDATE_SITE_ID, "http://updates.jenkins-ci.org/").isLegacyDefault());
|
||||
assertFalse("isLegacyDefault should be false with null url", new UpdateSite(null, null).isLegacyDefault());
|
||||
}
|
||||
|
||||
@Test public void getAvailables() throws Exception {
|
||||
UpdateSite site = getUpdateSite("/plugins/available-update-center.json");
|
||||
List<UpdateSite.Plugin> available = site.getAvailables();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<sites>
|
||||
<site>
|
||||
<id>default</id>
|
||||
<url>http://updates.jenkins-ci.org/update-center.json</url>
|
||||
</site>
|
||||
</sites>
|
|
@ -129,9 +129,12 @@
|
|||
font-weight: 450;
|
||||
flex-grow: 1;
|
||||
padding: 0.45rem 0 0;
|
||||
word-break: normal;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
.app-builds-container__item__time {
|
||||
color: var(--text-color-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,6 +171,8 @@
|
|||
padding-left: 2.25rem;
|
||||
margin-top: -2px;
|
||||
grid-column: 1 / span 2;
|
||||
word-break: normal;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
|
|
Loading…
Reference in New Issue