Skip to content

Commit

Permalink
Merge branch 'master' into JENKINS-71699
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinter69 authored Sep 18, 2023
2 parents e5c7ac6 + c5fbbbe commit 852b05e
Show file tree
Hide file tree
Showing 232 changed files with 3,203 additions and 2,095 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
private_key: ${{ secrets.JENKINS_CHANGELOG_UPDATER_PRIVATE_KEY }}
repository: jenkins-infra/jenkins.io
- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Publish jenkins.io changelog draft
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/label-lts-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Label PRs targeting LTS branches

on: [pull_request_target]

permissions:
pull-requests: write

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check if PR targets LTS branch
if: startsWith(github.event.pull_request.base.ref, 'stable-')
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.addLabels({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
issue_number: context.payload.pull_request.number,
labels: ['into-lts']
});
2 changes: 1 addition & 1 deletion .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
project-version: ${{ steps.set-version.outputs.project-version }}
is-lts: ${{ steps.set-version.outputs.is-lts }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitpod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM gitpod/workspace-full

ARG MAVEN_VERSION=3.9.3
ARG MAVEN_VERSION=3.9.4

RUN brew install gh && \
bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk default maven ${MAVEN_VERSION}"
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ properties([

def axes = [
platforms: ['linux', 'windows'],
jdks: [11, 17, 19],
jdks: [11, 17, 21],
]

stage('Record build') {
Expand Down
2 changes: 1 addition & 1 deletion ath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o xtrace
cd "$(dirname "$0")"

# https://github.com/jenkinsci/acceptance-test-harness/releases
export ATH_VERSION=5659.v28d85a_47a_73a_
export ATH_VERSION=5699.v27deb_ef5796c

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
10 changes: 5 additions & 5 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THE SOFTWARE.

<properties>
<asm.version>9.5</asm.version>
<slf4jVersion>2.0.7</slf4jVersion>
<slf4jVersion>2.0.9</slf4jVersion>
<stapler.version>1802.v9e2750160d01</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>
Expand All @@ -64,7 +64,7 @@ THE SOFTWARE.
<!-- https://docs.spring.io/spring-security/site/docs/5.5.4/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.8.5</version>
<version>5.8.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -82,7 +82,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version>
<version>32.1.2-jre</version>
</dependency>
<dependency>
<!-- Overriding Stapler’s 1.1.3 version to diagnose JENKINS-20618: -->
Expand Down Expand Up @@ -189,12 +189,12 @@ THE SOFTWARE.
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.13</version>
<version>1.10.14</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.23.0</version>
<version>1.24.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ THE SOFTWARE.
<!-- Version specified in grandparent POM -->
<configuration>
<!-- Make sure to keep the directives in test/pom.xml and war/pom.xml in sync with these. -->
<argLine>@{jacocoSurefireArgs} --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED</argLine>
<argLine>@{jacocoSurefireArgs} --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</argLine>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/hudson/TcpSlaveAgentListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ private void respondHello(String header, Socket s) throws IOException {
if (header.startsWith("GET / ")) {
response = "HTTP/1.0 200 OK\r\n" +
"Content-Type: text/plain;charset=UTF-8\r\n" +
"X-Content-Type-Options: nosniff\r\n" +
"\r\n" +
"Jenkins-Agent-Protocols: " + getAgentProtocolNames() + "\r\n" +
"Jenkins-Version: " + Jenkins.VERSION + "\r\n" +
Expand Down
25 changes: 25 additions & 0 deletions core/src/main/java/hudson/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1927,4 +1927,29 @@ public static long daysElapsedSince(@NonNull Date date) {
private static PathRemover newPathRemover(@NonNull PathRemover.PathChecker pathChecker) {
return PathRemover.newFilteredRobustRemover(pathChecker, DELETION_RETRIES, GC_AFTER_FAILED_DELETE, WAIT_BETWEEN_DELETION_RETRIES);
}

/**
* Returns SHA-256 Digest of input bytes
*/
@Restricted(NoExternalUse.class)
public static byte[] getSHA256DigestOf(@NonNull byte[] input) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(input);
return messageDigest.digest();
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
throw new IllegalStateException("SHA-256 could not be instantiated, but is required to" +
" be implemented by the language specification", noSuchAlgorithmException);
}
}

/**
* Returns Hex string of SHA-256 Digest of passed input
*/
@Restricted(NoExternalUse.class)
public static String getHexOfSHA256DigestOf(byte[] input) throws IOException {
//get hex string of sha 256 of payload
byte[] payloadDigest = Util.getSHA256DigestOf(input);
return (payloadDigest != null) ? Util.toHexString(payloadDigest) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.StringEscapeUtils;

/**
* Filters out console notes.
Expand All @@ -36,6 +40,8 @@
*/
public class PlainTextConsoleOutputStream extends LineTransformationOutputStream.Delegating {

private static final Logger LOGGER = Logger.getLogger(PlainTextConsoleOutputStream.class.getName());

/**
*
*/
Expand Down Expand Up @@ -64,7 +70,11 @@ protected void eol(byte[] in, int sz) throws IOException {
int rest = sz - next;
ByteArrayInputStream b = new ByteArrayInputStream(in, next, rest);

ConsoleNote.skip(new DataInputStream(b));
try {
ConsoleNote.skip(new DataInputStream(b));
} catch (IOException x) {
LOGGER.log(Level.FINE, "Failed to skip annotation from \"" + StringEscapeUtils.escapeJava(new String(in, next, rest, Charset.defaultCharset())) + "\"", x);
}

int bytesUsed = rest - b.available(); // bytes consumed by annotations
written += bytesUsed;
Expand Down
14 changes: 11 additions & 3 deletions core/src/main/java/hudson/init/InitStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;
Expand Down Expand Up @@ -64,7 +65,11 @@ private void listPluginFiles(PluginManager pm, String extension, Collection<File
if (files == null)
throw new IOException("Jenkins is unable to create " + pm.rootDir + "\nPerhaps its security privilege is insufficient");

all.addAll(Arrays.asList(files));
List<File> pluginFiles = new ArrayList<>();
pluginFiles.addAll(List.of(files));
pluginFiles.sort(Comparator.comparing(File::getName));

all.addAll(pluginFiles);
}

/**
Expand All @@ -76,15 +81,16 @@ private void listPluginFiles(PluginManager pm, String extension, Collection<File
protected void getBundledPluginsFromProperty(final List<File> r) {
String hplProperty = SystemProperties.getString("hudson.bundled.plugins");
if (hplProperty != null) {
List<File> pluginFiles = new ArrayList<>();
for (String hplLocation : hplProperty.split(",")) {
File hpl = new File(hplLocation.trim());
if (hpl.exists()) {
r.add(hpl);
pluginFiles.add(hpl);
} else if (hpl.getName().contains("*")) {
try {
new DirScanner.Glob(hpl.getName(), null).scan(hpl.getParentFile(), new FileVisitor() {
@Override public void visit(File f, String relativePath) throws IOException {
r.add(f);
pluginFiles.add(f);
}
});
} catch (IOException x) {
Expand All @@ -94,6 +100,8 @@ protected void getBundledPluginsFromProperty(final List<File> r) {
LOGGER.warning("bundled plugin " + hplLocation + " does not exist");
}
}
pluginFiles.sort(Comparator.comparing(File::getName));
r.addAll(pluginFiles);
}
}

Expand Down
12 changes: 9 additions & 3 deletions core/src/main/java/hudson/model/Label.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,16 @@ public static Set<LabelAtom> parse(@CheckForNull String labels) {
final Set<LabelAtom> r = new TreeSet<>();
labels = fixNull(labels);
if (labels.length() > 0) {
final QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(labels);
while (tokenizer.hasMoreTokens())
r.add(Jenkins.get().getLabelAtom(tokenizer.nextToken()));
Jenkins j = Jenkins.get();
LabelAtom labelAtom = j.tryGetLabelAtom(labels);
if (labelAtom == null) {
final QuotedStringTokenizer tokenizer = new QuotedStringTokenizer(labels);
while (tokenizer.hasMoreTokens())
r.add(j.getLabelAtom(tokenizer.nextToken()));
} else {
r.add(labelAtom);
}
}
return r;
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/hudson/model/ManageJenkinsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse respons
* menu.
*/
@Restricted(NoExternalUse.class)
public void addContextMenuItem(ContextMenu menu, String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge) {
public void addContextMenuItem(ContextMenu menu, String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge, String message) {
if (Stapler.getCurrentRequest().findAncestorObject(this.getClass()) != null || !Util.isSafeToRedirectTo(url)) {
// Default behavior if the URL is absolute or scheme-relative, or the current object is an ancestor (i.e. would resolve correctly)
menu.add(url, icon, iconXml, text, post, requiresConfirmation, badge);
menu.add(url, icon, iconXml, text, post, requiresConfirmation, badge, message);
return;
}
// If neither is the case, rewrite the relative URL to point to inside the /manage/ URL space
menu.add("manage/" + url, icon, iconXml, text, post, requiresConfirmation, badge);
menu.add("manage/" + url, icon, iconXml, text, post, requiresConfirmation, badge, message);
}
}
16 changes: 14 additions & 2 deletions core/src/main/java/hudson/model/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import net.sf.json.JSONObject;
import org.jvnet.localizer.Localizable;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.accmod.restrictions.ProtectedExternally;
import org.kohsuke.stapler.BindInterceptor;
import org.kohsuke.stapler.Stapler;
Expand Down Expand Up @@ -298,20 +299,31 @@ public OfflineCause getTemporaryOfflineCause() {
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<>(getAssignedLabels(), Label::getTiedJobCount);
}

/**
* @return An immutable set of LabelAtom associated with the current node label.
*/
@NonNull
@Restricted(NoExternalUse.class)
protected Set<LabelAtom> getLabelAtomSet() {
// Default implementation doesn't cache, since we can't hook on label updates.
return Collections.unmodifiableSet(Label.parse(getLabelString()));
}

/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a agent
* and should be called after events that will change that - e.g. an agent
* connecting.
*/

@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
Set<LabelAtom> r = new HashSet<>(getLabelAtomSet());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
Expand Down
7 changes: 1 addition & 6 deletions core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -1242,12 +1242,7 @@ private static int addArtifacts(@NonNull VirtualFile dir,
/**
* Maximum number of artifacts to list before using switching to the tree view.
*/
public static final int LIST_CUTOFF = Integer.parseInt(SystemProperties.getString("hudson.model.Run.ArtifactList.listCutoff", "16"));

/**
* Maximum number of artifacts to show in tree view before just showing a link.
*/
public static final int TREE_CUTOFF = Integer.parseInt(SystemProperties.getString("hudson.model.Run.ArtifactList.treeCutoff", "40"));
public static final int LIST_CUTOFF = Integer.parseInt(SystemProperties.getString("hudson.model.Run.ArtifactList.listCutoff", "20"));

// ..and then "too many"

Expand Down
Loading

0 comments on commit 852b05e

Please sign in to comment.