Skip to content

Commit

Permalink
Merge branch 'master' into add-search-keyboard-shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jul 20, 2022
2 parents db5612a + 237b9ca commit cb34850
Show file tree
Hide file tree
Showing 123 changed files with 1,336 additions and 888 deletions.
74 changes: 28 additions & 46 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

This page provides information about contributing code to the Jenkins core codebase.

:exclamation: There's a lot more to the Jenkins project than just code. For more information on the ways that you can contribute to the Jenkins project, see [Participate].
:exclamation: There's a lot more to the Jenkins project than just code. For more information on the ways that you can contribute to the Jenkins project, see [Participate](https://www.jenkins.io/participate/).

## Getting started

1. Fork the repository on GitHub
2. Clone the forked repository to your machine
3. Install the necessary development tools. In order to develop Jenkins, you need the following:
* Java Development Kit (JDK) 11 or 8.
In the Jenkins project we usually use [Eclipse Adoptium](https://adoptium.net/) or [OpenJDK](https://openjdk.java.net/), but you can use other JDKs as well.
* Apache Maven 3.8.1 or above. You can [download Maven here].
In the Jenkins project we usually use the most recent Maven release.
* Any IDE which supports importing Maven projects.
* Install [NodeJS](https://nodejs.org/en/). **Note:** only needed to work on the frontend assets found in the `war` module.
* Frontend tasks are run using [yarn](https://yarnpkg.com/lang/en/). Run `npm install -g yarn` to install it.
4. Set up your development environment as described in [Preparing for Plugin Development]
* Java Development Kit (JDK) 11 or 17.
In the Jenkins project we usually use [Eclipse Temurin](https://adoptium.net/) or [OpenJDK](https://openjdk.java.net/), but you can use other JDKs as well.
* Apache Maven 3.8.1 or above. You can [download Maven here](https://maven.apache.org/download.cgi).
In the Jenkins project we usually use the most recent Maven release.
* Any IDE which supports importing Maven projects.
* Install [NodeJS](https://nodejs.org/en/). **Note:** only needed to work on the frontend assets found in the `war` module.
* Frontend tasks are run using [yarn](https://yarnpkg.com/lang/en/). Run `npm install -g yarn` to install it.
4. Set up your development environment as described in [Preparing for Plugin Development](https://www.jenkins.io/doc/developer/tutorial/prepare/)

If you want to contribute to Jenkins, or just learn about the project,
you can start by fixing some easier issues.
In the Jenkins issue tracker we mark such issues as `newbie-friendly`.
You can find them by using this query (check the link) for [newbie friendly issues].
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)).

## Building and Debugging

The Jenkins core build flow is built around Maven.
You can read a description of the [building and debugging process here].
You can read a description of the [building and debugging process here](https://www.jenkins.io/doc/developer/building/).

If you want simply to build the `jenkins.war` file as fast as possible without tests, run:

Expand All @@ -35,9 +35,9 @@ mvn -am -pl war,bom -Pquick-build clean install
```

The WAR file will be created in `war/target/jenkins.war`.
After that, you can start Jenkins using Java CLI ([guide]).
After that, you can start Jenkins using Java CLI ([guide](https://www.jenkins.io/doc/book/installing/war-file/#run-the-war-file)).
If you want to debug the WAR file without using Maven plugins,
You can run the executable with [Remote Debug Flags]
You can run the executable with [Remote Debug Flags](https://stackoverflow.com/questions/975271/remote-debugging-a-java-application)
and then attach IDE Debugger to it.

To launch a development instance, after the above command, run:
Expand Down Expand Up @@ -87,7 +87,7 @@ There are 3 profiles for tests:
* `all-tests` - runs all tests, with re-run (default)

In addition to the included tests, you can also find extra integration and UI
tests in the [Acceptance Test Harness (ATH)] repository.
tests in the [Acceptance Test Harness (ATH)](https://github.com/jenkinsci/acceptance-test-harness) repository.
If you propose complex UI changes, you should create new ATH tests for them.

### JavaScript unit tests
Expand All @@ -100,23 +100,23 @@ cd war; yarn test
## Proposing Changes

The Jenkins project source code repositories are hosted at GitHub.
All proposed changes are submitted, and code reviewed, using a [GitHub pull request] process.
All proposed changes are submitted, and code reviewed, using a [GitHub pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) process.

To submit a pull request:

1. Commit your changes and push them to your fork on GitHub.
It is a good practice is to create branches instead of pushing to master.
2. In the GitHub Web UI, click the _New Pull Request_ button.
3. Select `jenkinsci` as _base fork_ and `master` as `base`, then click _Create Pull Request_.
* We integrate all changes into the master branch towards the Weekly releases.
* After that, the changes may be backported to the current LTS baseline by the LTS Team.
Read more about the [backporting process].
4. Fill in the Pull Request description according to the [proposed template].
* We integrate all changes into the master branch towards the Weekly releases.
* After that, the changes may be backported to the current LTS baseline by the LTS Team.
Read more about the [backporting process](https://www.jenkins.io/download/lts/).
4. Fill in the Pull Request description according to the [proposed template](.github/PULL_REQUEST_TEMPLATE.md).
5. Click _Create Pull Request_.
6. Wait for CI results/reviews, process the feedback.
* If you do not get feedback after 3 days, feel free to ping `@jenkinsci/core-pr-reviewers` in the comments.
* Usually we merge pull requests after 2 approvals from reviewers, no requested changes, and having waited some more time to give others an opportunity to provide their feedback.
See [this page](/docs/MAINTAINERS.adoc) for more information about our review process.
* If you do not get feedback after 3 days, feel free to ping `@jenkinsci/core-pr-reviewers` in the comments.
* Usually we merge pull requests after 2 approvals from reviewers, no requested changes, and having waited some more time to give others an opportunity to provide their feedback.
See [this page](/docs/MAINTAINERS.adoc) for more information about our review process.

Once your Pull Request is ready to be merged,
the repository maintainers will integrate it, prepare changelogs, and
Expand Down Expand Up @@ -185,25 +185,25 @@ Failure to work around the problem as described above will result in a `could no

## Copyright

The Jenkins core is licensed under [MIT license], with a few exceptions in bundled classes.
The Jenkins core is licensed under [MIT license](./LICENSE.txt), with a few exceptions in bundled classes.
We consider all contributions as MIT unless it's explicitly stated otherwise.
MIT-incompatible code contributions will be rejected.
Contributions under MIT-compatible licenses may also be rejected if they are not ultimately necessary.

We **Do NOT** require pull request submitters to sign the [contributor agreement]
We **Do NOT** require pull request submitters to sign the [contributor agreement](https://www.jenkins.io/project/governance/#cla)
as long as the code is licensed under MIT, and merged by one of the contributors with the signed agreement.

We still encourage people to sign the contributor agreement if they intend to submit more than a few pull requests.
Signing is also a mandatory prerequisite for getting merge/push permissions to core repositories
and for joining teams like the [Jenkins Security Team].
and for joining teams like the [Jenkins Security Team](https://www.jenkins.io/security/#team).

## Continuous Integration

The Jenkins project has a Continuous Integration server... powered by Jenkins, of course.
It is located at [ci.jenkins.io].
It is located at [ci.jenkins.io](https://ci.jenkins.io/).

The Jenkins project uses [Jenkins Pipeline] to run builds.
The code for the core build flow is stored in the [Jenkinsfile] in the repository root.
The Jenkins project uses [Jenkins Pipeline](https://www.jenkins.io/doc/book/pipeline/) to run builds.
The code for the core build flow is stored in the [Jenkinsfile](./Jenkinsfile) in the repository root.
If you want to update that build flow (e.g. "add more checks"),
just submit a pull request.

Expand All @@ -213,21 +213,3 @@ just submit a pull request.
* [Jenkins Chat Channels](https://www.jenkins.io/chat/)
* [Beginners Guide To Contributing](https://www.jenkins.io/participate/)
* [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))

[Preparing for Plugin Development]: https://www.jenkins.io/doc/developer/tutorial/prepare/
[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)
[Participate]: https://www.jenkins.io/participate/
[building and debugging process here]: https://www.jenkins.io/doc/developer/building/
[guide]: https://www.jenkins.io/doc/book/installing/war-file/#run-the-war-file
[Remote Debug Flags]: https://stackoverflow.com/questions/975271/remote-debugging-a-java-application
[Acceptance Test Harness (ATH)]: https://github.com/jenkinsci/acceptance-test-harness
[backporting process]: https://www.jenkins.io/download/lts/
[proposed template]: .github/PULL_REQUEST_TEMPLATE.md
[MIT license]: ./LICENSE.txt
[contributor agreement]: https://www.jenkins.io/project/governance/#cla
[Jenkins Security Team]: https://www.jenkins.io/security/#team
[ci.jenkins.io]: https://ci.jenkins.io/
[Jenkins Pipeline]: https://www.jenkins.io/doc/book/pipeline/
[Jenkinsfile]: ./Jenkinsfile
[download Maven here]: https://maven.apache.org/download.cgi
[GitHub pull request]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
7 changes: 7 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ for (i = 0; i < buildTypes.size(); i++) {
qualityGates: [
[threshold: 1, type: 'TOTAL', unstable: true],
]])
recordIssues([tool: styleLint(pattern: '**/target/stylelint-warnings.xml'),
sourceCodeEncoding: 'UTF-8',
skipBlames: true,
trendChartType: 'TOOLS_ONLY',
qualityGates: [
[threshold: 1, type: 'TOTAL', unstable: true],
]])
if (failFast && currentBuild.result == 'UNSTABLE') {
error 'Static analysis quality gates not passed; halting early'
}
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Latest releases:


# Source
Our latest and greatest source of Jenkins can be found on [GitHub]. Fork us!
Our latest and greatest source of Jenkins can be found on [GitHub](https://github.com/jenkinsci/jenkins). Fork us!

# Contributing to Jenkins

Expand All @@ -57,7 +57,7 @@ Documentation for Jenkins core maintainers is in the [maintainers guidelines](do

# News and Website

All information about Jenkins can be found on our [website].
All information about Jenkins can be found on our [website](https://www.jenkins.io/).
Follow us on [Twitter](https://twitter.com/jenkinsci) or [LinkedIn](https://www.linkedin.com/company/jenkins-project/).

# Governance
Expand All @@ -71,8 +71,4 @@ Jenkins is used by millions of users and thousands of companies.
See [adopters](https://www.jenkins.io/project/adopters/) for the list of Jenkins adopters and their success stories.

# License
Jenkins is **licensed** under the **[MIT License]**.

[MIT License]: https://github.com/jenkinsci/jenkins/blob/master/LICENSE.txt
[GitHub]: https://github.com/jenkinsci/jenkins
[website]: https://www.jenkins.io/
Jenkins is **licensed** under the **[MIT License](https://github.com/jenkinsci/jenkins/blob/master/LICENSE.txt)**.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.21</version>
<version>5.3.22</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
12 changes: 0 additions & 12 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
12 changes: 0 additions & 12 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -521,18 +521,6 @@ THE SOFTWARE.
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
Expand Down
34 changes: 28 additions & 6 deletions core/src/main/java/hudson/model/AbstractProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1100,33 +1100,55 @@ public CauseOfBlockage getCauseOfBlockage() {

/**
* Returns the project if any of the downstream project is either
* building, waiting, pending or buildable.
* building, or queued and not blocked by an upstream/downstream project build.
* <p>
* This means eventually there will be an automatic triggering of
* the given project (provided that all builds went smoothly.)
*/
public AbstractProject getBuildingDownstream() {
Set<Task> unblockedTasks = Jenkins.get().getQueue().getUnblockedTasks();
// Unblocked downstream tasks must block this project.
Set<Task> tasks = Jenkins.get().getQueue().getUnblockedTasks();
// Blocked downstream tasks must block this project.
// Projects blocked by upstream or downstream builds
// are ignored to break deadlocks.
for (Queue.Item item : Jenkins.get().getQueue().getBlockedItems()) {
if (item.getCauseOfBlockage() instanceof AbstractProject.BecauseOfUpstreamBuildInProgress ||
item.getCauseOfBlockage() instanceof AbstractProject.BecauseOfDownstreamBuildInProgress) {
continue;
}
tasks.add(item.task);
}

for (AbstractProject tup : getTransitiveDownstreamProjects()) {
if (tup != this && (tup.isBuilding() || unblockedTasks.contains(tup)))
if (tup != this && (tup.isBuilding() || tasks.contains(tup)))
return tup;
}
return null;
}

/**
* Returns the project if any of the upstream project is either
* building or is in the queue.
* building, or queued and not blocked by an upstream/downstream project build.
* <p>
* This means eventually there will be an automatic triggering of
* the given project (provided that all builds went smoothly.)
*/
public AbstractProject getBuildingUpstream() {
Set<Task> unblockedTasks = Jenkins.get().getQueue().getUnblockedTasks();
// Unblocked upstream tasks must block this project.
Set<Task> tasks = Jenkins.get().getQueue().getUnblockedTasks();
// Blocked upstream tasks must block this project.
// Projects blocked by upstream or downstream builds
// are ignored to break deadlocks.
for (Queue.Item item : Jenkins.get().getQueue().getBlockedItems()) {
if (item.getCauseOfBlockage() instanceof AbstractProject.BecauseOfUpstreamBuildInProgress ||
item.getCauseOfBlockage() instanceof AbstractProject.BecauseOfDownstreamBuildInProgress) {
continue;
}
tasks.add(item.task);
}

for (AbstractProject tup : getTransitiveUpstreamProjects()) {
if (tup != this && (tup.isBuilding() || unblockedTasks.contains(tup)))
if (tup != this && (tup.isBuilding() || tasks.contains(tup)))
return tup;
}
return null;
Expand Down
37 changes: 36 additions & 1 deletion core/src/main/java/hudson/model/ManageJenkinsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,26 @@
package hudson.model;

import hudson.Extension;
import hudson.Util;
import java.io.IOException;
import jenkins.model.Jenkins;
import jenkins.model.ModelObjectWithContextMenu;
import org.apache.commons.jelly.JellyException;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerFallback;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

/**
* Adds the "Manage Jenkins" link to the top page.
*
* @author Kohsuke Kawaguchi
*/
@Extension(ordinal = 100) @Symbol("manageJenkins")
public class ManageJenkinsAction implements RootAction {
public class ManageJenkinsAction implements RootAction, StaplerFallback, ModelObjectWithContextMenu {
@Override
public String getIconFileName() {
if (Jenkins.get().hasAnyPermission(Jenkins.MANAGE, Jenkins.SYSTEM_READ))
Expand All @@ -52,4 +62,29 @@ public String getDisplayName() {
public String getUrlName() {
return "/manage";
}

@Override
public Object getStaplerFallback() {
return Jenkins.get();
}

@Override
public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws JellyException, IOException {
return new ContextMenu().from(this, request, response, "index");
}

/**
* Workaround to ensuring that links in context menus resolve correctly in the submenu of the top-level 'Dashboard'
* menu.
*/
@Restricted(NoExternalUse.class)
public void addContextMenuItem(ContextMenu menu, String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation) {
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);
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);
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/ParametersAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public String getDisplayName() {

@Override
public String getIconFileName() {
return "document-properties.png";
return "symbol-parameters";
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/model/UpdateCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,12 @@ public List<Plugin> getUpdates() {
return new ArrayList<>(pluginMap.values());
}

// for Jelly
@Restricted(NoExternalUse.class)
public boolean hasIncompatibleUpdates(PluginManager.MetadataCache cache) {
return getUpdates().stream().anyMatch(plugin -> !plugin.isCompatible(cache));
}

@Restricted(NoExternalUse.class)
public List<Plugin> getPluginsWithUnavailableUpdates() {
Map<String, Plugin> pluginMap = new LinkedHashMap<>();
Expand Down
Loading

0 comments on commit cb34850

Please sign in to comment.