未验证 提交 9098ec4d 编写于 作者: A Alexander Brandes 提交者: GitHub

Merge pull request #7517 from krisstern/feat/stable-2.375/backporting-2.375.2-1

Backporting for LTS 2.375.2
/*
* The MIT License
*
* Copyright (c) 2022, 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.
*/
package jenkins.telemetry.impl;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.model.Node;
import hudson.slaves.Cloud;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
import jenkins.diagnostics.ControllerExecutorsAgents;
import jenkins.diagnostics.ControllerExecutorsNoAgents;
import jenkins.model.Jenkins;
import jenkins.telemetry.Telemetry;
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@Restricted(NoExternalUse.class)
@Extension
public class DistributedBuilds extends Telemetry {
@NonNull
@Override
public String getDisplayName() {
return "Distributed Builds";
}
@NonNull
@Override
public LocalDate getStart() {
return LocalDate.of(2022, 12, 1);
}
@NonNull
@Override
public LocalDate getEnd() {
return LocalDate.of(2023, 3, 1);
}
@Override
public JSONObject createContent() {
JSONObject payload = new JSONObject();
payload.put("controllerExecutors", Jenkins.get().getNumExecutors());
// Capture whether admin monitors are dismissed
payload.put("controllerExecutorsWithAgentsWarning", ExtensionList.lookupSingleton(ControllerExecutorsAgents.class).isEnabled());
payload.put("controllerExecutorsWithoutAgentsWarning", ExtensionList.lookupSingleton(ControllerExecutorsNoAgents.class).isEnabled());
Map<String, Integer> clouds = new HashMap<>();
for (Cloud cloud : Jenkins.get().clouds) {
clouds.compute(cloud.getClass().getName(), (key, value) -> value == null ? 1 : value + 1);
}
payload.put("clouds", clouds);
Map<String, Integer> agents = new HashMap<>();
for (Node agent : Jenkins.get().getNodes()) {
agents.compute(agent.getClass().getName(), (key, value) -> value == null ? 1 : value + 1);
}
payload.put("agents", agents);
// Try to understand the complexity of the instance
payload.put("items", Jenkins.get().getAllItems().size());
payload.put("components", buildComponentInformation());
return payload;
}
}
......@@ -68,12 +68,20 @@ public class WebSockets {
return (req, rsp, node) -> {
try {
session.handler = provider.handle(req, rsp, new Provider.Listener() {
private Object providerSession;
@Override
public void onWebSocketConnect() {
public void onWebSocketConnect(Object providerSession) {
this.providerSession = providerSession;
session.startPings();
session.opened();
}
@Override
public Object getProviderSession() {
return providerSession;
}
@Override
public void onWebSocketClose(int statusCode, String reason) {
session.stopPings();
......
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
This trial collects basic information about how distributed builds are set up on this Jenkins instance:
<ul>
<li>The number of executors configured on the controller</li>
<li>The number and kind of agents</li>
<li>The number and kind of clouds</li>
<li>Whether any of the administrative monitors related to distributed builds have been disabled</li>
</ul>
Additionally, the following general information is collected:
<ul>
<li>The total number of items (folders and jobs) on the instance</li>
<li>Jenkins version</li>
<li>Installed plugins and their versions</li>
</ul>
This data will be used to understand how common various distributed builds setups (all local, static agents only, clouds only, mixed, with or without executors on the controller) are, and how they correlate to the number of jobs.
</j:jelly>
......@@ -87,7 +87,7 @@ THE SOFTWARE.
<changelog.url>https://www.jenkins.io/changelog</changelog.url>
<!-- Bundled Remoting version -->
<remoting.version>3071.v7e9b_0dc08466</remoting.version>
<remoting.version>3077.vd69cf116da_6f</remoting.version>
<!-- Minimum Remoting version, which is tested for API compatibility -->
<remoting.minimum.supported.version>4.2.1</remoting.minimum.supported.version>
......
......@@ -316,47 +316,47 @@ THE SOFTWARE.
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.20</version>
<version>785.v06b_7f47b_c631</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1189.vb_a_b_7c8fd5fde</version>
<version>1190.v65867a_a_47126</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1119.1121.vc43d0fc45561</version>
<version>1160.vf1f01a_a_ea_b_7f</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>1164.v760c223ddb_32</version>
<version>1200.v8005c684b_a_c6</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>plugin-util-api</artifactId>
<version>2.16.0</version>
<version>2.18.0</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>bootstrap5-api</artifactId>
<version>5.1.3-6</version>
<version>5.2.1-3</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>checks-api</artifactId>
<version>1.7.4</version>
<version>1.8.0</version>
<type>hpi</type>
</artifactItem>
......@@ -372,14 +372,14 @@ THE SOFTWARE.
<!-- dependency of junit and echarts-api -->
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>2.13.2.20220328-273.v11d70a_b_a_1a_52</version>
<version>2.13.4.20221013-295.v8e29ea_354141</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>echarts-api</artifactId>
<version>5.3.2-1</version>
<version>5.4.0-1</version>
<type>hpi</type>
</artifactItem>
......@@ -403,7 +403,7 @@ THE SOFTWARE.
<!-- dependency of echarts-api and bootstrap4-api -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>jquery3-api</artifactId>
<version>3.6.0-2</version>
<version>3.6.1-2</version>
<type>hpi</type>
</artifactItem>
......@@ -411,7 +411,7 @@ THE SOFTWARE.
<!-- dependency of bootstrap5-api -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>popper2-api</artifactId>
<version>2.11.2-1</version>
<version>2.11.6-2</version>
<type>hpi</type>
</artifactItem>
......@@ -419,7 +419,7 @@ THE SOFTWARE.
<!-- dependency of bootstrap5-api -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>font-awesome-api</artifactId>
<version>6.0.0-1</version>
<version>6.2.0-3</version>
<type>hpi</type>
</artifactItem>
......@@ -427,7 +427,7 @@ THE SOFTWARE.
<!-- dependency of junit and workflow-api -->
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>625.vd896b_f445a_f8</version>
<version>639.v6eca_cd8c04a_a_</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
......@@ -465,7 +465,7 @@ THE SOFTWARE.
<artifactItem>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jaxb</artifactId>
<version>2.3.0</version>
<version>2.3.7-1</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
......@@ -483,7 +483,7 @@ THE SOFTWARE.
<artifactItem>
<groupId>io.jenkins.plugins</groupId>
<artifactId>javax-activation-api</artifactId>
<version>1.2.0-2</version>
<version>1.2.0-5</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
......@@ -498,6 +498,27 @@ THE SOFTWARE.
<version>116.vf8f487400980</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of commons-text-api and plugin-util-api -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-lang3-api</artifactId>
<version>3.12.0-36.vd97de6465d5b_</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of plugin-util-api -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-text-api</artifactId>
<version>1.10.0-27.vb_fa_3896786a_7</version>
<type>hpi</type>
</artifactItem>
<artifactItem>
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>ionicons-api</artifactId>
<version>31.v4757b_6987003</version>
<type>hpi</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/detached-plugins</outputDirectory>
<stripVersion>true</stripVersion>
......
......@@ -37,10 +37,13 @@ window.addEventListener("load", function () {
const headerToScrollTo = document.getElementById(
item.querySelector(".task-link").dataset.sectionId
);
document.documentElement.scrollTop =
i === 0
? 0
: headerToScrollTo.getBoundingClientRect().top + window.scrollY - 70;
const sectionTopPosition =
headerToScrollTo.getBoundingClientRect().top + window.scrollY - 70;
window.scrollTo({
top: i === 0 ? 0 : sectionTopPosition,
behavior: "smooth",
});
});
sidebarItems.insertAdjacentElement("beforeend", item);
......
......@@ -58,5 +58,4 @@ html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-tap-highlight-color: transparent;
scroll-behavior: smooth;
}
......@@ -26,9 +26,6 @@ package jenkins.websocket;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import javax.servlet.http.HttpServletRequest;
......@@ -49,9 +46,6 @@ public class Jetty10Provider implements Provider {
private static final String ATTR_LISTENER = Jetty10Provider.class.getName() + ".listener";
// TODO does not seem possible to use HttpServletRequest.get/setAttribute for this
private static final Map<Listener, Session> sessions = Collections.synchronizedMap(new WeakHashMap<>());
public Jetty10Provider() {
JettyWebSocketServerContainer.class.hashCode();
}
......@@ -101,7 +95,7 @@ public class Jetty10Provider implements Provider {
}
private Session session() {
Session session = sessions.get(listener);
Session session = (Session) listener.getProviderSession();
if (session == null) {
throw new IllegalStateException("missing session");
}
......@@ -151,8 +145,7 @@ public class Jetty10Provider implements Provider {
@Override
public void onWebSocketConnect(Session session) {
sessions.put(listener, session);
listener.onWebSocketConnect();
listener.onWebSocketConnect(session);
}
@Override
......
......@@ -26,9 +26,6 @@ package jenkins.websocket;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.Future;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -48,9 +45,6 @@ public class Jetty9Provider implements Provider {
private static final String ATTR_LISTENER = Jetty9Provider.class.getName() + ".listener";
// TODO does not seem possible to use HttpServletRequest.get/setAttribute for this
private static final Map<Listener, Session> sessions = Collections.synchronizedMap(new WeakHashMap<>());
private WebSocketServletFactory factory;
public Jetty9Provider() {
......@@ -104,7 +98,7 @@ public class Jetty9Provider implements Provider {
}
private Session session() {
Session session = sessions.get(listener);
Session session = (Session) listener.getProviderSession();
if (session == null) {
throw new IllegalStateException("missing session");
}
......@@ -136,8 +130,7 @@ public class Jetty9Provider implements Provider {
@Override
public void onWebSocketConnect(Session session) {
sessions.put(listener, session);
listener.onWebSocketConnect();
listener.onWebSocketConnect(session);
}
@Override
......
......@@ -47,7 +47,9 @@ interface Provider {
interface Listener {
void onWebSocketConnect();
void onWebSocketConnect(Object providerSession);
Object getProviderSession();
void onWebSocketClose(int statusCode, String reason);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册