Skip to content

Commit 058249a

Browse files
committed
test: restore to last successful master build commit 29a032b
git restore --source 29a032b .
1 parent 0d1363c commit 058249a

File tree

16 files changed

+182
-190
lines changed

16 files changed

+182
-190
lines changed

.github/workflows/publish-release-artifact.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2020
- name: Set up JDK 21
21-
uses: actions/setup-java@1d018f9b8b9b505bb578a83b230fabcce01af93b #v 5.0.0
21+
uses: actions/setup-java@fe779bf55ef683c9413269276a7588bb9cedf07a #v 5.0.0
2222
with:
2323
distribution: "temurin"
2424
java-version: 21

cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<plugin>
114114
<groupId>org.apache.maven.plugins</groupId>
115115
<artifactId>maven-shade-plugin</artifactId>
116-
<version>3.6.2</version>
116+
<version>3.6.1</version>
117117
<executions>
118118
<execution>
119119
<goals>

core/src/main/java/hudson/tasks/LogRotator.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,9 @@ public void perform(Job<?, ?> job) throws IOException, InterruptedException {
163163
Run lsb = removeLastBuild ? null : job.getLastSuccessfulBuild();
164164
Run lstb = removeLastBuild ? null : job.getLastStableBuild();
165165

166-
Map<Integer, ? extends Run<?, ?>> runMap = job.getBuildsAsMap();
167166
if (numToKeep != -1) {
168-
// Iterate through keySet() instead of entrySet() or values() to avoid triggering lazy loading
169-
// for the first `numToKeep` builds
170-
runMap.keySet().stream().skip(numToKeep).map(runMap::get)
171-
.filter(r -> r != null && !shouldKeepRun(r, lsb, lstb)).forEach(r -> {
167+
job.getBuildsAsMap().entrySet().stream().skip(numToKeep).map(Map.Entry::getValue)
168+
.filter(r -> !shouldKeepRun(r, lsb, lstb)).forEach(r -> {
172169
LOGGER.log(FINE, "{0} is to be removed", r);
173170
try { r.delete(); }
174171
catch (IOException ex) { exceptionMap.computeIfAbsent(r, key -> new HashSet<>()).add(ex); }
@@ -193,10 +190,8 @@ public void perform(Job<?, ?> job) throws IOException, InterruptedException {
193190
}
194191

195192
if (artifactNumToKeep != null && artifactNumToKeep != -1) {
196-
// Iterate through keySet() instead of entrySet() or values() to avoid triggering lazy loading
197-
// for the first `artifactNumToKeep` builds
198-
runMap.keySet().stream().skip(artifactNumToKeep).map(runMap::get)
199-
.filter(r -> r != null && !shouldKeepRun(r, lsb, lstb)).forEach(r -> {
193+
job.getBuildsAsMap().entrySet().stream().skip(artifactNumToKeep).map(Map.Entry::getValue)
194+
.filter(r -> !shouldKeepRun(r, lsb, lstb)).forEach(r -> {
200195
LOGGER.log(FINE, "{0} is to be purged of artifacts", r);
201196
try { r.deleteArtifacts(); }
202197
catch (IOException ex) { exceptionMap.computeIfAbsent(r, key -> new HashSet<>()).add(ex); }

core/src/main/java/jenkins/model/lazy/BuildReferenceMapAdapter.java

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,12 @@ public boolean remove(Object o) {
169169

170170
@Override
171171
public Iterator<Integer> iterator() {
172-
return Iterators.removeNull(Iterators.map(
173-
BuildReferenceMapAdapter.this.core.entrySet().iterator(), coreEntry -> {
174-
BuildReference<R> ref = coreEntry.getValue();
175-
if (!ref.isSet()) {
176-
R r = resolver.resolveBuildRef(ref);
177-
if (r == null) {
178-
return null;
179-
}
180-
}
181-
if (ref.isUnloadable()) {
182-
return null;
183-
}
184-
return ref.number;
185-
}));
172+
return new AdaptedIterator<>(BuildReferenceMapAdapter.this.entrySet().iterator()) {
173+
@Override
174+
protected Integer adapt(Map.Entry<Integer, R> e) {
175+
return e.getKey();
176+
}
177+
};
186178
}
187179

188180
@Override
@@ -281,9 +273,19 @@ public Iterator<Map.Entry<Integer, R>> iterator() {
281273
private Map.Entry<Integer, R> current;
282274
private final Iterator<Map.Entry<Integer, R>> it = Iterators.removeNull(Iterators.map(
283275
BuildReferenceMapAdapter.this.core.entrySet().iterator(), coreEntry -> {
284-
R r = resolver.resolveBuildRef(coreEntry.getValue());
285-
// if null - load not allowed or build is unloadable
286-
return r == null ? null : new AbstractMap.SimpleImmutableEntry<>(coreEntry.getKey(), r);
276+
BuildReference<R> ref = coreEntry.getValue();
277+
if (!ref.isSet()) {
278+
R r = resolver.resolveBuildRef(ref);
279+
// load not loaded or unloadable build
280+
if (r == null) {
281+
return null;
282+
}
283+
return new EntryAdapter(coreEntry, r);
284+
}
285+
if (ref.isUnloadable()) {
286+
return null;
287+
}
288+
return new EntryAdapter(coreEntry);
287289
}));
288290

289291
@Override
@@ -312,6 +314,59 @@ public Spliterator<Map.Entry<Integer, R>> spliterator() {
312314
}
313315
}
314316

317+
private class EntryAdapter implements Entry<Integer, R> {
318+
private final Map.Entry<Integer, BuildReference<R>> coreEntry;
319+
private volatile R resolvedValue;
320+
321+
EntryAdapter(Map.Entry<Integer, BuildReference<R>> coreEntry) {
322+
this(coreEntry, null);
323+
}
324+
325+
EntryAdapter(Map.Entry<Integer, BuildReference<R>> coreEntry, R resolvedValue) {
326+
this.coreEntry = coreEntry;
327+
this.resolvedValue = resolvedValue;
328+
}
329+
330+
private Map.Entry<Integer, R> getResolvedEntry() {
331+
return new AbstractMap.SimpleEntry<>(getKey(), getValue());
332+
}
333+
334+
@Override
335+
public Integer getKey() {
336+
return coreEntry.getKey();
337+
}
338+
339+
@Override
340+
public R getValue() {
341+
R value = resolvedValue;
342+
if (value != null) {
343+
return value;
344+
}
345+
return resolvedValue = resolver.resolveBuildRef(coreEntry.getValue());
346+
}
347+
348+
@Override
349+
public R setValue(R value) {
350+
// BuildReferenceAdapter is read only
351+
throw new UnsupportedOperationException();
352+
}
353+
354+
@Override
355+
public String toString() {
356+
return getResolvedEntry().toString();
357+
}
358+
359+
@Override
360+
public boolean equals(Object o) {
361+
return (o instanceof Map.Entry<?, ?>) && getResolvedEntry().equals(o);
362+
}
363+
364+
@Override
365+
public int hashCode() {
366+
return getResolvedEntry().hashCode();
367+
}
368+
}
369+
315370
/**
316371
* An interface for resolving build references into actual build instances
317372
* and extracting basic metadata from them.

core/src/main/resources/hudson/model/Computer/_script.jelly

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ THE SOFTWARE.
2727
-->
2828
<?jelly escape-by-default='true'?>
2929
<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">
30-
<j:set var="script" value='println System.getenv("PATH")' />
31-
<j:set var="script2" value='println "uname -a".execute().text' />
32-
33-
<t:scriptConsole scripts="${[script, script2]}">
34-
<p class="jenkins-section__description">
30+
<t:scriptConsole>
31+
<pre>println System.getenv("PATH")</pre>
32+
<pre>println "uname -a".execute().text</pre>
33+
<p>
3534
${%This execution happens in the agent JVM.}
3635
</p>
3736
</t:scriptConsole>

core/src/main/resources/jenkins/model/Jenkins/_script.jelly

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ THE SOFTWARE.
2727
-->
2828
<?jelly escape-by-default='true'?>
2929
<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">
30-
<j:new var="managementLink" className="jenkins.management.ConsoleLink" />
31-
32-
<l:settings-subpage includeBreadcrumb="true" permission="${app.ADMINISTER}"
33-
header="${null}" noDefer="true" managementLink="${managementLink}">
34-
35-
<t:scriptConsole scripts="${['println(Jenkins.instance.pluginManager.plugins)']}"
36-
layout="none" />
37-
</l:settings-subpage>
38-
</j:jelly>
30+
<t:scriptConsole layout="one-column">
31+
<pre>println(Jenkins.instance.pluginManager.plugins)</pre>
32+
</t:scriptConsole>
33+
</j:jelly>

core/src/main/resources/lib/hudson/scriptConsole.jelly

Lines changed: 35 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -26,101 +26,56 @@ THE SOFTWARE.
2626
Called from doScript() to display the execution result and the form.
2727
-->
2828
<?jelly escape-by-default='true'?>
29-
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
30-
xmlns:f="/lib/form" xmlns:t="/lib/hudson" xmlns:local="local">
29+
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:f="/lib/form">
3130
<st:documentation>
3231
<st:attribute name="layout" use="optional">
33-
Specify which layout to be used for the page.
32+
Specify which layout to be use for the page.
3433
See the type in layout for more details.
35-
Script console also supports `none`, which removes the traditional layout frame.
3634
By default, it is `two-column`.
3735
</st:attribute>
38-
<st:attribute name="scripts" use="optional">
39-
Displays executable example scripts.
40-
</st:attribute>
4136
</st:documentation>
4237

43-
<d:taglib uri="local">
44-
<d:tag name="contents">
45-
<l:app-bar title="${%scriptConsole}">
46-
<t:help href="https://www.jenkins.io/redirect/script-console" />
47-
</l:app-bar>
38+
<j:set var="layout" value="${attrs.layout != null ? attrs.layout : 'two-column'}" />
39+
<l:layout permission="${app.ADMINISTER}" title="${%scriptConsole}" type="${layout}">
40+
<j:if test="${layout == 'two-column'}">
41+
<st:include page="sidepanel.jelly" />
42+
</j:if>
4843

49-
<p class="jenkins-page-description">
50-
${%description}
51-
</p>
44+
<l:breadcrumb title="${%scriptConsole}"/>
45+
<l:main-panel>
46+
<h1>${%scriptConsole}</h1>
5247

5348
<j:choose>
5449
<j:when test="${it.channel != null}">
55-
<f:section title="${%Getting started}">
56-
<p class="jenkins-section__description">
57-
${%instructions}
58-
</p>
59-
60-
<j:forEach var="script" items="${scripts}">
61-
<form action="script" method="post">
62-
<div class="jenkins-quote jenkins-quote--monospace jenkins-!-margin-bottom-5">
63-
${script}
64-
<input type="hidden"
65-
name="script"
66-
value="${script}" />
67-
<button class="jenkins-button jenkins-button--tertiary jenkins-!-build-color"
68-
tooltip="${%Run example}">
69-
<l:icon src="symbol-play" />
70-
</button>
71-
</div>
72-
</form>
73-
</j:forEach>
74-
75-
<!-- this is where the example goes -->
76-
<d:invokeBody />
77-
</f:section>
50+
<p>
51+
${%description}
52+
</p>
53+
<!-- this is where the example goes -->
54+
<d:invokeBody />
55+
<p>
56+
${%description2}
57+
</p>
7858

79-
<f:section title="${%Console}">
80-
<form action="script" method="post">
81-
<textarea id="script" name="script" class="script">${request2.getParameter('script')}</textarea>
82-
<div align="right">
83-
<f:submit value="${%Run}"/>
84-
</div>
85-
</form>
86-
<st:adjunct includes="org.kohsuke.stapler.codemirror.mode.groovy.groovy"/>
87-
<st:adjunct includes="org.kohsuke.stapler.codemirror.theme.default"/>
88-
<j:if test="${output!=null}">
89-
<h2>
90-
${%Result}
91-
<l:copyButton text="${output}"/>
92-
</h2>
93-
<pre><st:out value="${output}"/></pre>
94-
</j:if>
95-
</f:section>
59+
<form action="script" method="post">
60+
<textarea id="script" name="script" class="script">${request2.getParameter('script')}</textarea>
61+
<div align="right">
62+
<f:submit value="${%Run}"/>
63+
</div>
64+
</form>
65+
<st:adjunct includes="org.kohsuke.stapler.codemirror.mode.groovy.groovy"/>
66+
<st:adjunct includes="org.kohsuke.stapler.codemirror.theme.default"/>
67+
<j:if test="${output!=null}">
68+
<h2>
69+
${%Result}
70+
<l:copyButton message="${%successfullyCopied}" tooltip="${%clickToCopy}" text="${output}"/>
71+
</h2>
72+
<pre><st:out value="${output}"/></pre>
73+
</j:if>
9674
</j:when>
9775
<j:otherwise>
9876
${%impossibleOffline}
9977
</j:otherwise>
10078
</j:choose>
101-
</d:tag>
102-
</d:taglib>
103-
104-
<j:choose>
105-
<j:when test="${attrs.layout == 'none'}">
106-
<local:contents>
107-
<d:invokeBody />
108-
</local:contents>
109-
</j:when>
110-
<j:otherwise>
111-
<j:set var="layout" value="${attrs.layout != null ? attrs.layout : 'two-column'}" />
112-
<l:layout permission="${app.ADMINISTER}" title="${%scriptConsole}" type="${layout}">
113-
<j:if test="${layout == 'two-column'}">
114-
<st:include page="sidepanel.jelly" />
115-
</j:if>
116-
117-
<l:breadcrumb title="${%scriptConsole}"/>
118-
<l:main-panel>
119-
<local:contents>
120-
<d:invokeBody />
121-
</local:contents>
122-
</l:main-panel>
123-
</l:layout>
124-
</j:otherwise>
125-
</j:choose>
79+
</l:main-panel>
80+
</l:layout>
12681
</j:jelly>

core/src/main/resources/lib/hudson/scriptConsole.properties

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222

2323
description=\
2424
Type in an arbitrary <a href="https://www.groovy-lang.org">Groovy script</a> and \
25-
execute it on the server. Useful for trouble-shooting and diagnostics.
25+
execute it on the server. Useful for trouble-shooting and diagnostics. \
26+
Use the ‘println’ command to see the output (if you use <code>System.out</code>, \
27+
it will go to the server’s stdout, which is harder to see.) Example:
2628

27-
instructions=\
28-
Use the ‘println’ command to see the output (if you use System.out, it will go to the server’s stdout, which is harder to see). All the classes from all the plugins are visible. <code>jenkins.*</code>, <code>jenkins.model.*</code>, <code>hudson.*</code>, and <code>hudson.model.*</code> are pre-imported.
29+
description2=\
30+
All the classes from all the plugins are visible. <code>jenkins.*</code>, <code>jenkins.model.*</code>, <code>hudson.*</code>, and <code>hudson.model.*</code> are pre-imported.
31+
clickToCopy=Click to copy
32+
successfullyCopied=Copied to clipboard
2933
impossibleOffline=It is not possible to run scripts when agent is offline.
3034
scriptConsole=Script Console

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
"babel-loader": "10.0.0",
3131
"clean-webpack-plugin": "4.0.0",
3232
"css-loader": "7.1.4",
33-
"css-minimizer-webpack-plugin": "8.0.0",
33+
"css-minimizer-webpack-plugin": "7.0.4",
3434
"eslint": "10.0.2",
3535
"eslint-config-prettier": "10.1.8",
3636
"eslint-formatter-checkstyle": "9.0.1",
37-
"globals": "17.4.0",
37+
"globals": "17.3.0",
3838
"handlebars-loader": "1.7.3",
3939
"mini-css-extract-plugin": "2.10.0",
4040
"postcss": "8.5.6",
@@ -48,7 +48,7 @@
4848
"stylelint": "17.4.0",
4949
"stylelint-checkstyle-reporter": "1.1.1",
5050
"stylelint-config-standard-scss": "17.0.0",
51-
"webpack": "5.105.4",
51+
"webpack": "5.105.3",
5252
"webpack-cli": "6.0.1",
5353
"webpack-remove-empty-scripts": "1.1.1"
5454
},

src/main/js/components/dropdowns/hetero-list.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ function convertInputsToButtons(e) {
2727
let btn = document.createElement("button");
2828
btn.setAttribute("type", "button");
2929
btn.classList.add("hetero-list-add", "jenkins-button");
30-
let plus = createElementFromHtml(Symbols.PLUS);
31-
btn.appendChild(plus);
32-
btn.appendChild(document.createTextNode(oldbtn.getAttribute("value")));
30+
btn.innerText = oldbtn.getAttribute("value");
3331
if (oldbtn.hasAttribute("suffix")) {
3432
btn.setAttribute("suffix", oldbtn.getAttribute("suffix"));
3533
}
34+
let chevron = createElementFromHtml(Symbols.CHEVRON_DOWN);
35+
btn.appendChild(chevron);
3636
oldbtn.parentNode.appendChild(btn);
3737
oldbtn.remove();
3838
});

0 commit comments

Comments
 (0)