Skip to content

Commit 45db35d

Browse files
authored
Merge branch 'master' into add-experimental-plugin-manager
2 parents 6e71b41 + 5f529ab commit 45db35d

File tree

87 files changed

+4579
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+4579
-286
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<!-- Comment:
22
A great PR typically begins with the line below.
3-
Replace XXXXX with the numeric part of the issue ID you created in Jira.
4-
Note that if you want your changes backported into LTS, you need to create a Jira issue. See https://www.jenkins.io/download/lts/#backporting-process for more information.
3+
Replace <issue-number> with the issue number.
54
-->
65

7-
See [JENKINS-XXXXX](https://issues.jenkins.io/browse/JENKINS-XXXXX).
6+
Fixes #<issue-number>
87

98
<!-- Comment:
10-
If the issue is not fully described in Jira, add more information here (justification, pull request links, etc.).
9+
If the issue is not fully described in the issue tracker, add more information here (justification, pull request links, etc.).
1110
12-
* We do not require Jira issues for minor improvements.
13-
* Bug fixes should have a Jira issue to facilitate the backporting process.
14-
* Major new features should have a Jira issue.
11+
* We do not require an issue for minor improvements.
12+
* Major new features should have an issue created.
1513
-->
1614

1715
### Testing done
@@ -34,8 +32,8 @@ For refactoring and code cleanup changes, exercise the code before and after the
3432
The changelog entry should be in the imperative mood; e.g., write "do this"/"return that" rather than "does this"/"returns that".
3533
For examples, see: https://www.jenkins.io/changelog/
3634
37-
Do not include the Jira issue in the changelog entry.
38-
Include the Jira issue in the description of the pull request so that the changelog generator can find it and include it in the generated changelog.
35+
Do not include the issue in the changelog entry.
36+
Include the issue in the description of the pull request so that the changelog generator can find it and include it in the generated changelog.
3937
4038
You may add multiple changelog entries if applicable by adding a new entry to the list, e.g.
4139
- First changelog entry
@@ -82,7 +80,7 @@ The changelog generator relies on the presence of the upgrade guidelines section
8280

8381
### Submitter checklist
8482

85-
- [ ] The Jira issue, if it exists, is well-described.
83+
- [ ] The issue, if it exists, is well-described.
8684
- [ ] The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see [examples](https://github.com/jenkins-infra/jenkins.io/blob/master/content/_data/changelogs/weekly.yml)). Fill in the **Proposed upgrade guidelines** section only if there are breaking changes or changes that may require extra steps from users during upgrade.
8785
- [ ] There is automated testing or an explanation as to why this change has no tests.
8886
- [ ] New public classes, fields, and methods are annotated with `@Restricted` or have `@since TODO` Javadocs, as appropriate.
@@ -108,4 +106,4 @@ Before the changes are marked as `ready-for-merge`:
108106
- [ ] Changelog entries in the pull request title and/or **Proposed changelog entries** are accurate, human-readable, and in the imperative mood.
109107
- [ ] Proper changelog labels are set so that the changelog can be generated automatically.
110108
- [ ] If the change needs additional upgrade steps from users, the `upgrade-guide-needed` label is set and there is a **Proposed upgrade guidelines** section in the pull request title (see [example](https://github.com/jenkinsci/jenkins/pull/4387)).
111-
- [ ] If it would make sense to backport the change to LTS, a Jira issue must exist, be a _Bug_ or _Improvement_, and be labeled as `lts-candidate` to be considered (see [query](https://issues.jenkins.io/issues/?filter=12146)).
109+
- [ ] If it would make sense to backport the change to LTS, be a _Bug_ or _Improvement_, and either the issue or pull request must be labeled as `lts-candidate` to be considered.

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
runs-on: ubuntu-latest
4545
if: github.repository_owner == 'jenkinsci'
4646
steps:
47-
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
47+
- uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
4848
id: generate-token
4949
with:
5050
app-id: ${{ secrets.JENKINS_CHANGELOG_UPDATER_APP_ID }}

.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@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2020
- name: Set up JDK 21
21-
uses: actions/setup-java@46c56d6f92c88cf540acf95a12a4a41197499222 #v 5.0.0
21+
uses: actions/setup-java@4e7e684fbb6e33f88ecb2cf1e6b3797739cf499b #v 5.0.0
2222
with:
2323
distribution: "temurin"
2424
java-version: 21

.github/workflows/run-since-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
id: run_script
3030
shell: bash
3131
- name: Create Pull Request
32-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
32+
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
3333
with:
3434
token: ${{ secrets.GITHUB_TOKEN }}
3535
commit-message: Fill in since annotations

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ This page provides information about contributing code to the Jenkins core codeb
1818

1919
If you want to contribute to Jenkins, or just learn about the project,
2020
you can start by fixing some easier issues.
21-
In the Jenkins issue tracker we mark such issues as `newbie-friendly`.
22-
You can find them by using this query (check the link) for [newbie friendly issues](<https://issues.jenkins.io/issues/?jql=project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20component%20%3D%20core%20AND%20labels%20in%20(newbie-friendly)>).
21+
In the Jenkins issue tracker we mark such issues as `good first issue`.
22+
You can find them by using this query (check the link) for [good first issues](https://github.com/jenkinsci/jenkins/issues?q=is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22).
2323

2424
## Building and Debugging
2525

@@ -261,4 +261,4 @@ just submit a pull request.
261261
- [Jenkins Contribution Landing Page](https://www.jenkins.io/participate/)
262262
- [Jenkins Chat Channels](https://www.jenkins.io/chat/)
263263
- [Beginners Guide To Contributing](https://www.jenkins.io/participate/)
264-
- [List of newbie-friendly issues in the core](<https://issues.jenkins.io/issues/?jql=project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20component%20%3D%20core%20AND%20labels%20in%20(newbie-friendly)>)
264+
- [List of good first issues in core](<https://github.com/jenkinsci/jenkins/issues?q=is%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22)

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ properties([
1414

1515
def axes = [
1616
platforms: ['linux', 'windows'],
17-
jdks: [17, 21, 25],
17+
jdks: [21, 25],
1818
]
1919

2020
stage('Record build') {
2121
retry(conditions: [kubernetesAgent(handleNonKubernetes: true), nonresumable()], count: 2) {
22-
node('maven-17') {
22+
node('maven-21') {
2323
infra.checkoutSCM()
2424

2525
/*

core/src/main/java/hudson/markup/MarkupFormatter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@
3535
import java.io.Writer;
3636
import java.util.Collections;
3737
import java.util.Map;
38-
import java.util.function.Function;
3938
import java.util.logging.Level;
4039
import java.util.logging.Logger;
41-
import java.util.stream.Collectors;
42-
import java.util.stream.Stream;
4340
import jenkins.util.SystemProperties;
4441
import org.kohsuke.accmod.Restricted;
4542
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -133,7 +130,7 @@ public HttpResponse doPreviewDescription(@QueryParameter String text) throws IOE
133130
translate(text, w);
134131
Map<String, String> extraHeaders = Collections.emptyMap();
135132
if (PREVIEWS_SET_CSP) {
136-
extraHeaders = Stream.of("Content-Security-Policy", "X-WebKit-CSP", "X-Content-Security-Policy").collect(Collectors.toMap(Function.identity(), v -> "default-src 'none';"));
133+
extraHeaders = Map.of("Content-Security-Policy", "default-src 'none';");
137134
}
138135
return html(200, w.toString(), extraHeaders);
139136
}

core/src/main/java/hudson/model/ComputerSet.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import hudson.util.FormApply;
4545
import hudson.util.FormValidation;
4646
import jakarta.servlet.ServletException;
47+
import jakarta.servlet.http.HttpServletResponse;
4748
import java.io.File;
4849
import java.io.IOException;
4950
import java.lang.reflect.InvocationTargetException;
@@ -281,6 +282,12 @@ public synchronized void doCreateItem(StaplerRequest2 req, StaplerResponse2 rsp,
281282
final Jenkins app = Jenkins.get();
282283
app.checkPermission(Computer.CREATE);
283284

285+
String requestContentType = req.getContentType();
286+
287+
boolean isXmlSubmission = requestContentType != null
288+
&& (requestContentType.startsWith("application/xml")
289+
|| requestContentType.startsWith("text/xml"));
290+
284291
if (mode != null && mode.equals("copy")) {
285292
name = checkName(name);
286293

@@ -319,6 +326,22 @@ public synchronized void doCreateItem(StaplerRequest2 req, StaplerResponse2 rsp,
319326
// send the browser to the config page
320327
rsp.sendRedirect2(result.getNodeName() + "/configure");
321328
} else {
329+
if (isXmlSubmission) {
330+
final Node newNode = (Node) Jenkins.XSTREAM2.fromXML(req.getInputStream());
331+
name = Util.fixEmptyAndTrim(name);
332+
333+
if (name != null) {
334+
newNode.setNodeName(name);
335+
}
336+
337+
if (app.getNode(newNode.getNodeName()) != null) {
338+
throw new Failure("Node '" + newNode.getNodeName() + "' already exists");
339+
}
340+
341+
app.addNode(newNode);
342+
rsp.setStatus(HttpServletResponse.SC_OK);
343+
return;
344+
}
322345
// proceed to step 2
323346
if (mode == null) {
324347
throw new Failure("No mode given");

core/src/main/java/hudson/model/DirectoryBrowserSupport.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import jenkins.security.MasterToSlaveCallable;
6565
import jenkins.security.ResourceDomainConfiguration;
6666
import jenkins.security.ResourceDomainRootAction;
67+
import jenkins.security.csp.CspHeader;
6768
import jenkins.util.SystemProperties;
6869
import jenkins.util.VirtualFile;
6970
import org.apache.commons.io.IOUtils;
@@ -398,13 +399,14 @@ private void serveFile(StaplerRequest2 req, StaplerResponse2 rsp, VirtualFile ro
398399
rsp.sendRedirect(302, ResourceDomainRootAction.get().getRedirectUrl(resourceToken, req.getRestOfPath()));
399400
} else {
400401
if (!ResourceDomainConfiguration.isResourceRequest(req)) {
401-
// if we're serving this from the main domain, set CSP headers
402+
// If we're serving this from the main domain, set CSP headers. These override the default CSP headers.
402403
String csp = SystemProperties.getString(CSP_PROPERTY_NAME, DEFAULT_CSP_VALUE);
403404
if (!csp.trim().isEmpty()) {
404405
// allow users to prevent sending this header by setting empty system property
405-
for (String header : new String[]{"Content-Security-Policy", "X-WebKit-CSP", "X-Content-Security-Policy"}) {
406-
rsp.setHeader(header, csp);
407-
}
406+
rsp.setHeader(CspHeader.ContentSecurityPolicy.getHeaderName(), csp);
407+
} else {
408+
// Clear the header value if configured by the user.
409+
rsp.setHeader(CspHeader.ContentSecurityPolicy.getHeaderName(), null);
408410
}
409411
}
410412
InputStream in;

core/src/main/java/hudson/model/Job.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,12 +1119,15 @@ public long getEstimatedDuration() {
11191119
*
11201120
* @return never null
11211121
*/
1122+
@SuppressWarnings("deprecation")
11221123
public PermalinkList getPermalinks() {
11231124
PeepholePermalink.initialized();
11241125
// TODO: shall we cache this?
11251126
PermalinkList permalinks = new PermalinkList(Permalink.BUILTIN);
1126-
for (PermalinkProjectAction ppa : getActions(PermalinkProjectAction.class)) {
1127-
permalinks.addAll(ppa.getPermalinks());
1127+
for (var action : getActions()) {
1128+
if (action instanceof PermalinkProjectAction ppa) {
1129+
permalinks.addAll(ppa.getPermalinks());
1130+
}
11281131
}
11291132
return permalinks;
11301133
}

0 commit comments

Comments
 (0)