Skip to content

Commit

Permalink
Merge branch 'master' into keyboard-shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Apr 15, 2022
2 parents dd5b905 + 4a38d65 commit 34d6c89
Show file tree
Hide file tree
Showing 306 changed files with 2,506 additions and 1,532 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A great PR typically begins with the line below.
Replace XXXXX with the numeric part of the issue's id you created on JIRA.
Please note that if you want your changes backported into LTS, you will need to create a JIRA ticket for it. Read https://www.jenkins.io/download/lts/#backporting-process for more.
-->
See [JENKINS-XXXXX](https://issues.jenkins-ci.org/browse/JENKINS-XXXXX).
See [JENKINS-XXXXX](https://issues.jenkins.io/browse/JENKINS-XXXXX).

<!-- Comment:
If the issue is not fully described in the ticket, add more information here (justification, pull request links, etc.).
Expand Down Expand Up @@ -56,4 +56,4 @@ Before the changes are marked as `ready-for-merge`:
- [ ] Changelog entries in the PR title and/or `Proposed changelog entries` are accurate, human-readable, and in the imperative mood
- [ ] Proper changelog labels are set so that the changelog can be generated automatically
- [ ] If the change needs additional upgrade steps from users, `upgrade-guide-needed` label is set and there is a `Proposed upgrade guidelines` section in the PR title. ([example](https://github.com/jenkinsci/jenkins/pull/4387))
- [ ] 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-ci.org/issues/?filter=12146)).
- [ ] 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)).
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# Drafts your next Release notes as Pull Requests are merged into "master"
- name: Generate GitHub Release Draft
id: release-drafter
uses: release-drafter/release-drafter@v5.19.0
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Generates a YAML changelog file using https://github.com/jenkinsci/jenkins-core-changelog-generator
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
distribution: 'temurin'
java-version: 8
- name: Set version
id: set-version
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- name: Upload Release Asset
id: upload-war
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Upload Release Asset
id: upload-deb
if: always()
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
- name: Upload Release Asset
id: upload-rpm
if: always()
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Upload Release Asset
id: upload-msi
if: always()
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
- name: Upload Release Asset
id: upload-suse-rpm
if: always()
uses: actions/upload-release-asset@v1.0.2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,48 @@ the repository maintainers will integrate it, prepare changelogs, and
ensure it gets released in one of upcoming Weekly releases.
There is no additional action required from pull request authors at this point.

### Pull request management

The Jenkins project uses a well-defined set of labels to mark the status and content of pull requests.
The complete list of labels can be found at https://github.com/jenkinsci/jenkins/labels.
These labels are defined as follows:

- `needs-docs` marks a pull request as lacking documentation, either for developers (e.g., Javadoc) or users (e.g., changes to the [Jenkins handbook](https://www.jenkins.io/doc/book/)).
For such pull requests to be approved and merged, the corresponding changes to the documentation should be proposed.
If those changes belong to a separate repository (e.g., `jenkins-infra/jenkins.io`), a secondary pull request should be created in draft state in the other repository and reviewed in tandem with the primary pull request that proposes the code change.
- `needs-fix` marks a pull request which has pending requests for change that have not yet been addressed.
Such pull requests will not be merged until the code has been fixed and the tests pass.
- `needs-justification` marks a pull request where the reasoning is unclear, incomplete or not entirely cogent.
To properly evaluate the solution provided in a pull request, maintainers must be able to understand the high-level problem that the pull request attempts to solve.
While the context might be obvious to the author, it is not always apparent to reviewers and maintainers.
The use of design documents, high-level tracking epics, [minimal reproducible examples (MREs)](https://en.wikipedia.org/wiki/Minimal_reproducible_example), etc. is strongly encouraged.
- `needs-more-review` marks a pull request as lacking a sufficient number of reviews from subject-matter expert(s) (SME), either because the changes are complex and not sufficiently explained or because there is a lack of consensus regarding the proposed solution.
- `on-hold` marks a pull request that depends on another event and cannot be merged until the completion of that event.
When the dependent task has been completed, the pull request will be ready for merge.
- `proposed-for-close` marks a pull request where there is either no consensus on the next steps or where the next steps have not been taken and an extended period of time has elapsed.
Such pull requests are typically closed approximately one week after the label has been applied.
They can always be reopened once consensus has been reached on the next steps or when action is taken regarding these next steps.
- `ready-for-merge` marks a pull request that has met the acceptance criteria, as defined elsewhere in this document.
If there is no negative feedback, such pull requests are typically merged within approximately 24 hours.
- `stalled` marks a pull request that is off to a promising start but requires additional effort to reach completion - effort that appears to have been abandoned.
If the original author lacks the time and interest to continue the original effort, we suggest that someone else pick up where the original author left off to drive the effort to completion.
- `work-in-progress` marks a pull request that remains under active development.
Such pull requests are not ready for final review.

To ensure that pull requests are processed efficiently, the `ready-for-merge`, `stalled`, and `proposed-for-close` labels are subject to time constraints.

A pull request labeled with `ready-for-merge` is merged after approximately 24 hours if there is no negative feedback.

If a pull request has remained incomplete with no activity for over a month, we will make this explicit by labeling the PR as `stalled`.

If a pull request labelled as `stalled` remains inactive for yet another month, we will label it as `proposed-for-close` in order to maintain an orderly PR queue.
Approximately one week after this label is applied to a pull request, it will be closed.

While contributors are strongly encouraged to drive PRs to completion on their own, we recognize that in some situations the help of a maintainer can be valuable.
Yet also, we recognize that some contributors prefer not to receive unsolicited changes.
When opening a pull request, enabling the _Allow edits by maintainers_ option indicates that you accept that maintainers may push new commits into your pull request branch.
As some maintainers are willing to fix typographical errors and merge conflicts while reviewing pull requests, accepting edits from maintainers can speed up the integration of your pull request.

## IntelliJ suggestion

In case you are using IntelliJ, please adjust the default setting in respect to whitespace fixes on save.
Expand All @@ -122,6 +164,15 @@ This will help minimize the diff, which makes reviewing PRs easier.
We also do not recommend `*` imports in the production code.
Please disable them in Settings > Editor > Codestyle > Java by setting _Class count to use import with '*'_ and Names count to use import with '*'_ to a high value, e.g. 100.

The addition of `@{jenkins.addOpens}` to `argLine` exposes a bug in IntelliJ IDEA.
A patch has been proposed in [JetBrains/intellij-community#1976](https://github.com/JetBrains/intellij-community/pull/1976).
Pending the merge and release of this patch, IntelliJ IDEA users should work around the problem as follows:

1. Go to **Settings** > **Build, Execution, Deployment** > **Build Tools** > **Maven** > **Running Tests**.
2. Under "Pass to JUnit process [the] following `maven-surefire-plugin` and `maven-failsafe-plugin` settings", uncheck `argLine`.

Failure to work around the problem as described above will result in a `could not open '{jenkins.addOpens}'` failure when running tests in IntelliJ IDEA.

## Copyright

The Jenkins core is licensed under [MIT license], with a few exceptions in bundled classes.
Expand Down
13 changes: 10 additions & 3 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ THE SOFTWARE.
<description>The module contains dependencies that are used by a specific Jenkins version</description>

<properties>
<asm.version>9.2</asm.version>
<asm.version>9.3</asm.version>
<slf4jVersion>1.7.36</slf4jVersion>
<stapler.version>1669.v95a_4b_919a_b_a_2</stapler.version>
<groovy.version>2.4.21</groovy.version>
Expand All @@ -53,6 +53,13 @@ THE SOFTWARE.
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.19</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!-- https://docs.spring.io/spring-security/site/docs/5.5.4/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
Expand Down Expand Up @@ -166,7 +173,7 @@ THE SOFTWARE.
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.10.0</version>
<version>5.11.0</version>
</dependency>
<dependency>
<groupId>net.java.sezpoz</groupId>
Expand Down Expand Up @@ -242,7 +249,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>version-number</artifactId>
<version>1.9</version>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.3.0</version>
<executions>
<execution>
<goals>
Expand Down
5 changes: 3 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ THE SOFTWARE.
<!-- not in BOM, optional -->
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.8</version>
<version>1.9</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -828,7 +828,8 @@ THE SOFTWARE.
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--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.base/java.util.concurrent=ALL-UNNAMED</argLine>
<!-- Make sure to keep the directives in test/pom.xml and war/pom.xml in sync with these. -->
<argLine>--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>
</configuration>
</plugin>
</plugins>
Expand Down
20 changes: 18 additions & 2 deletions core/src/main/java/hudson/FilePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import hudson.remoting.Which;
import hudson.security.AccessControlled;
import hudson.slaves.WorkspaceList;
import hudson.tasks.ArtifactArchiver;
import hudson.util.DaemonThreadFactory;
import hudson.util.DirScanner;
import hudson.util.ExceptionCatchingThreadFactory;
Expand Down Expand Up @@ -3054,6 +3055,21 @@ public String validateAntFileMask(final String fileMasks, final boolean caseSens
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "for script console")
public static int VALIDATE_ANT_FILE_MASK_BOUND = SystemProperties.getInteger(FilePath.class.getName() + ".VALIDATE_ANT_FILE_MASK_BOUND", 10000);

/**
* A dedicated subtype of {@link InterruptedException} for when no matching Ant file mask
* matches are found.
*
* @see ArtifactArchiver
*/
@Restricted(NoExternalUse.class)
public static class FileMaskNoMatchesFoundException extends InterruptedException {
private FileMaskNoMatchesFoundException(String message) {
super(message);
}

private static final long serialVersionUID = 1L;
}

/**
* Validates the ant file mask (like "foo/bar/*.txt, zot/*.jar") against this directory, and try to point out the problem.
* This performs only a bounded number of operations.
Expand Down Expand Up @@ -3223,7 +3239,7 @@ class Cancel extends RuntimeException {}
if (ds.getIncludedFilesCount() != 0 || ds.getIncludedDirsCount() != 0) {
return true;
} else {
throw (InterruptedException) new InterruptedException("no matches found within " + bound).initCause(c);
throw (FileMaskNoMatchesFoundException) new FileMaskNoMatchesFoundException("no matches found within " + bound).initCause(c);
}
}
return ds.getIncludedFilesCount() != 0 || ds.getIncludedDirsCount() != 0;
Expand Down Expand Up @@ -3455,7 +3471,7 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
private static final long serialVersionUID = 1L;

@Restricted(NoExternalUse.class)
@RestrictedSince("TODO")
@RestrictedSince("2.328")
public static final int SIDE_BUFFER_SIZE = 1024;

private static final Logger LOGGER = Logger.getLogger(FilePath.class.getName());
Expand Down
41 changes: 25 additions & 16 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ public class Functions {
private static final AtomicLong iota = new AtomicLong();
private static Logger LOGGER = Logger.getLogger(Functions.class.getName());

@Restricted(NoExternalUse.class)
@SuppressFBWarnings(value = "MS_SHOULD_BE_FINAL", justification = "for script console")
public static /* non-final */ boolean UI_REFRESH = SystemProperties.getBoolean("jenkins.ui.refresh");

public Functions() {
}

Expand Down Expand Up @@ -520,16 +516,6 @@ public static String getSystemProperty(String key) {
return SystemProperties.getString(key);
}

/**
* Returns true if and only if the UI refresh is enabled.
*
* @since 2.222
*/
@Restricted(DoNotUse.class)
public static boolean isUiRefreshEnabled() {
return UI_REFRESH;
}

public static Map getEnvVars() {
return new TreeMap<>(EnvVars.masterEnvVars);
}
Expand Down Expand Up @@ -2320,6 +2306,26 @@ public static Icon tryGetIcon(String iconGuess) {
return iconMetadata;
}

@Restricted(NoExternalUse.class)
public static String extractPluginNameFromIconSrc(String iconSrc) {
if (iconSrc == null) {
return "";
}

if (!iconSrc.contains("plugin-")) {
return "";
}

String[] arr = iconSrc.split(" ");
for (String element : arr) {
if (element.startsWith("plugin-")) {
return element.replace("plugin-", "");
}
}

return "";
}

@Restricted(NoExternalUse.class)
public static String tryGetIconPath(String iconGuess, JellyContext context) {
if (iconGuess == null) {
Expand All @@ -2341,10 +2347,13 @@ public static String tryGetIconPath(String iconGuess, JellyContext context) {
}

if (iconMetadata == null) {
if (!iconGuess.startsWith("/") && !iconGuess.startsWith("http")) {
//noinspection HttpUrlsUsage
if (iconGuess.startsWith("http://") || iconGuess.startsWith("https://")) {
return iconGuess;
}
if (!iconGuess.startsWith("/")) {
iconGuess = "/" + iconGuess;
}

iconSource = rootURL + (iconGuess.startsWith("/images/") || iconGuess.startsWith("/plugin/") ? getResourcePath() : "") + iconGuess;
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,11 @@ public static void touch(@NonNull File file) throws IOException {
/**
* Copies a single file by using Ant.
*
* @deprecated since TODO; use {@link Files#copy(Path, Path, CopyOption...)} directly
* @deprecated since 2.335; use {@link Files#copy(Path, Path, CopyOption...)} directly
*/
@Deprecated
@Restricted(NoExternalUse.class)
@RestrictedSince("TODO")
@RestrictedSince("2.335")
public static void copyFile(@NonNull File src, @NonNull File dst) throws BuildException {
Copy cp = new Copy();
cp.setProject(new Project());
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/console/UrlAnnotator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package hudson.console;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.MarkupText;
import hudson.MarkupText.SubText;
Expand All @@ -20,7 +21,7 @@ public ConsoleAnnotator newInstance(Object context) {

private static class UrlConsoleAnnotator extends ConsoleAnnotator {
@Override
public ConsoleAnnotator annotate(Object context, MarkupText text) {
public ConsoleAnnotator annotate(@NonNull Object context, @NonNull MarkupText text) {
for (SubText t : text.findTokens(URL)) {
int prev = t.start() - 1;
char ch = prev >= 0 ? text.charAt(prev) : ' ';
Expand Down
13 changes: 0 additions & 13 deletions core/src/main/java/hudson/lifecycle/Lifecycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,6 @@
public abstract class Lifecycle implements ExtensionPoint {
private static Lifecycle INSTANCE = null;

public Lifecycle() {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Jenkins jenkins = Jenkins.getInstanceOrNull();
if (jenkins != null) {
try {
jenkins.cleanUp();
} catch (Throwable t) {
LOGGER.log(Level.SEVERE, "Failed to clean up. Shutdown will continue.", t);
}
}
}));
}

/**
* Gets the singleton instance.
*
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/logging/LogRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class LogRecorder extends AbstractModelObject implements Saveable {
*/
@Deprecated
@Restricted(NoExternalUse.class)
@RestrictedSince("TODO")
@RestrictedSince("2.324")
public final transient CopyOnWriteList<Target> targets = new CopyOnWriteList<>();
private List<Target> loggers = new ArrayList<>();
private static final TargetComparator TARGET_COMPARATOR = new TargetComparator();
Expand Down
Loading

0 comments on commit 34d6c89

Please sign in to comment.