Skip to content

Commit

Permalink
Merge branch 'update-forms' into update-forms-2
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Dec 25, 2021
2 parents 464e07b + cc50203 commit 08e3e1d
Show file tree
Hide file tree
Showing 279 changed files with 4,351 additions and 5,281 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ updates:
# see https://github.com/jenkinsci/jenkins/pull/5112#issuecomment-744429487 and https://github.com/jenkinsci/jenkins/pull/5116#issuecomment-744526638
# it would be good to update it at some point, but requires significant testing
- dependency-name: "org.codehaus.groovy:groovy-all"
versions: [">=2.5.0"]
# see https://github.com/jenkinsci/jenkins/pull/5184 should be updated with groovy-all
- dependency-name: "org.fusesource.jansi:jansi"
# see https://github.com/jenkinsci/jenkins/pull/5144#pullrequestreview-559661934
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
env:
GITHUB_AUTH: github-actions:${{ secrets.GITHUB_TOKEN }}
- name: Upload Changelog YAML
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: changelog.yaml
path: changelog.yaml
Expand Down
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ This page provides information about contributing code to the Jenkins core codeb
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) 8 or 11.
In the Jenkins project we usually use [OpenJDK](http://openjdk.java.net/) or [AdoptOpenJDK](https://adoptopenjdk.net/), but you can use other JDKs as well.
* For JDK 11 there might be some compatibility issues in developer tools,
please see [this page](https://wiki.jenkins.io/display/JENKINS/Java+11+Developer+Guidelines#Java11DeveloperGuidelines-Knowndevelopertoolsissues) for more info.
If you find a new issue, please report it with a `java11-devtools-compatibility` label in our issue tracker.
* Maven 3.5.4 or above. You can [download Maven here].
* 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.
Expand Down Expand Up @@ -92,7 +90,7 @@ 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 the _GitHub Pull Request_ process.
All proposed changes are submitted, and code reviewed, using a [GitHub pull request] process.

To submit a pull request:

Expand Down Expand Up @@ -123,6 +121,7 @@ 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.

## Copyright

The Jenkins core is licensed under [MIT license], with a few exceptions in bundled classes.
Expand Down Expand Up @@ -150,15 +149,15 @@ just submit a pull request.
# Links

* [Jenkins Contribution Landing Page](https://www.jenkins.io/participate/)
* [Jenkins IRC Channel](https://www.jenkins.io/chat/)
* [Beginners Guide To Contributing](https://wiki.jenkins.io/display/JENKINS/Beginners+Guide+to+Contributing)
* [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://wiki.jenkins.io/display/JENKINS/Starting+and+Accessing+Jenkins
[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/
Expand All @@ -170,3 +169,4 @@ just submit a pull request.
[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
25 changes: 13 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

def buildNumber = BUILD_NUMBER as int; if (buildNumber > 1) milestone(buildNumber - 1); milestone(buildNumber) // JENKINS-43353 / JENKINS-58625

// TEST FLAG - to make it easier to turn on/off unit tests for speeding up access to later stuff.
def runTests = true
def failFast = false
// Same memory sizing for both builds and ATH
def javaOpts = ["JAVA_OPTS=-Xmx1536m -Xms512m","MAVEN_OPTS=-Xmx1536m -Xms512m"]
Expand All @@ -18,18 +16,24 @@ properties([
disableConcurrentBuilds(abortPrevious: true)
])

// TODO: Restore 'Windows' once https://groups.google.com/forum/#!topic/jenkinsci-dev/v9d-XosOp2s is resolved
def buildTypes = ['Linux']
def buildTypes = ['Linux', 'Windows']
def jdks = [8, 11]

def builds = [:]
for(i = 0; i < buildTypes.size(); i++) {
for(j = 0; j < jdks.size(); j++) {
def buildType = buildTypes[i]
def jdk = jdks[j]
if (buildType == 'Windows' && jdk == 8) {
continue // unnecessary use of hardware
}
builds["${buildType}-jdk${jdk}"] = {
// see https://github.com/jenkins-infra/documentation/blob/master/ci.adoc#node-labels for information on what node types are available
node(buildType == 'Linux' ? (jdk == 8 ? 'maven' : 'maven-11') : buildType.toLowerCase()) {
String agentContainerLabel = jdk == 8 ? 'maven' : 'maven-11'
if (buildType == 'Windows') {
agentContainerLabel += '-windows'
}
node(agentContainerLabel) {
// First stage is actually checking out the source. Since we're using Multibranch
// currently, we can use "checkout scm".
stage('Checkout') {
Expand All @@ -42,21 +46,21 @@ for(j = 0; j < jdks.size(); j++) {
// Now run the actual build.
stage("${buildType} Build / Test") {
timeout(time: 300, unit: 'MINUTES') {
realtimeJUnit(healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml,war/junit.xml') {
// -Dmaven.repo.local=… tells Maven to create a subdir in the temporary directory for the local Maven repository
// -ntp requires Maven >= 3.6.1
def mvnCmd = "mvn -Pdebug -Pjapicmp -U -Dset.changelist help:evaluate -Dexpression=changelist -Doutput=$changelistF clean install ${runTests ? '-Dmaven.test.failure.ignore' : '-DskipTests'} -V -B -ntp -Dmaven.repo.local=$m2repo -Dspotbugs.failOnError=false -Dcheckstyle.failOnViolation=false -e"
def mvnCmd = "mvn -Pdebug -Pjapicmp -U -Dset.changelist help:evaluate -Dexpression=changelist -Doutput=$changelistF clean install -Dmaven.test.failure.ignore -V -B -ntp -Dmaven.repo.local=$m2repo -Dspotbugs.failOnError=false -Dcheckstyle.failOnViolation=false -e"
infra.runWithMaven(mvnCmd, jdk.toString(), javaOpts, true)

if(isUnix()) {
sh 'git add . && git diff --exit-code HEAD'
}
}
}
}

// Once we've built, archive the artifacts and the test results.
stage("${buildType} Publishing") {
if (runTests) {
junit healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml,war/junit.xml'
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/surefire-reports/*.dumpstream'
if (! fileExists('core/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml') ) {
error 'junit 4 tests are no longer being run for the core package'
Expand All @@ -67,7 +71,6 @@ for(j = 0; j < jdks.size(); j++) {
if (failFast && currentBuild.result == 'UNSTABLE') {
error 'There were test failures; halting early'
}
}
if (buildType == 'Linux' && jdk == jdks[0]) {
def folders = env.JOB_NAME.split('/')
if (folders.length > 1) {
Expand Down Expand Up @@ -109,8 +112,6 @@ for(j = 0; j < jdks.size(); j++) {
}
}}

// TODO: Restore ATH once https://groups.google.com/forum/#!topic/jenkinsci-dev/v9d-XosOp2s is resolved
// TODO: ATH flow now supports Java 8 only, it needs to be reworked (INFRA-1690)
builds.ath = {
node("docker-highmem") {
// Just to be safe
Expand All @@ -120,7 +121,7 @@ builds.ath = {
dir("sources") {
checkout scm
def mvnCmd = 'mvn --batch-mode --show-version -ntp -Pquick-build -am -pl war package -Dmaven.repo.local=$WORKSPACE_TMP/m2repo'
infra.runWithMaven(mvnCmd, "8", javaOpts, true)
infra.runWithMaven(mvnCmd, "11", javaOpts, true)
dir("war/target") {
fileUri = "file://" + pwd() + "/jenkins.war"
}
Expand Down
16 changes: 8 additions & 8 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ THE SOFTWARE.
<properties>
<asm.version>9.2</asm.version>
<slf4jVersion>1.7.32</slf4jVersion>
<stapler.version>1593.v0e838714faae</stapler.version>
<groovy.version>2.4.12</groovy.version>
<stapler.version>1612.v2a13b906bf3a</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency> <!-- https://docs.spring.io/spring-security/site/docs/5.4.0-M1/reference/html5/#getting-maven-no-boot -->
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-bom</artifactId>
<version>5.6.0</version>
<version>5.6.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -173,18 +173,18 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
<version>1.15</version>
<version>1.16</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>version-number</artifactId>
<version>1.8</version>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>crypto-util</artifactId>
<version>1.6</version>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.connectbot.jbcrypt</groupId>
Expand Down Expand Up @@ -234,7 +234,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>task-reactor</artifactId>
<version>1.6</version>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.jvnet.localizer</groupId>
Expand Down Expand Up @@ -284,7 +284,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>memory-monitor</artifactId>
<version>1.10</version>
<version>1.11</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down
7 changes: 7 additions & 0 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Expand Down
3 changes: 2 additions & 1 deletion cli/src/main/java/hudson/cli/CLIConnectionFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package hudson.cli;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

/**
Expand Down Expand Up @@ -33,7 +34,7 @@ public CLIConnectionFactory basicAuth(String username, String password) {
* Cf. {@code BasicHeaderApiTokenAuthenticator}.
*/
public CLIConnectionFactory basicAuth(String userInfo) {
return authorization("Basic " + Base64.getEncoder().encodeToString(userInfo.getBytes()));
return authorization("Basic " + Base64.getEncoder().encodeToString(userInfo.getBytes(StandardCharsets.UTF_8)));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions cli/src/main/java/hudson/cli/PrivateKeyProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package hudson.cli;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.logging.Level.FINE;

import java.io.ByteArrayInputStream;
Expand All @@ -32,6 +31,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Paths;
Expand Down Expand Up @@ -134,7 +134,7 @@ private static String readPemFile(File f) throws IOException{
DataInputStream dis = new DataInputStream(is)) {
byte[] bytes = new byte[(int) f.length()];
dis.readFully(bytes);
return new String(bytes);
return new String(bytes, StandardCharsets.UTF_8);
} catch (InvalidPathException e) {
throw new IOException(e);
}
Expand All @@ -143,7 +143,7 @@ private static String readPemFile(File f) throws IOException{
public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException {
Iterable<KeyPair> itr = SecurityUtils.loadKeyPairIdentities(null,
new PathResource(Paths.get("key")),
new ByteArrayInputStream(pemString.getBytes(UTF_8)),
new ByteArrayInputStream(pemString.getBytes(StandardCharsets.UTF_8)),
FilePasswordProvider.of(passwd));
long numLoaded = itr == null ? 0 : StreamSupport.stream(itr.spliterator(), false).count();
if (numLoaded <= 0) {
Expand Down
16 changes: 7 additions & 9 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<hamcrest.version>2.2</hamcrest.version>
<xmlunit.version>2.8.3</xmlunit.version>
<xmlunit.version>2.8.4</xmlunit.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -127,12 +127,6 @@ THE SOFTWARE.
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler</artifactId>
<exclusions>
<exclusion> <!-- pick up from SpotBugs Annotations -->
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
Expand Down Expand Up @@ -517,12 +511,16 @@ THE SOFTWARE.
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<optional>true</optional>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ClassicPluginStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ private static void parseClassPath(Manifest manifest, File archive, List<File> p
* Explodes the plugin into a directory, if necessary.
*/
private static void explode(File archive, File destDir) throws IOException {
Files.createDirectories(Util.fileToPath(destDir));
Util.createDirectories(Util.fileToPath(destDir));

// timestamp check
File explodeTime = new File(destDir,".timestamp2");
Expand Down Expand Up @@ -549,7 +549,7 @@ protected void zipDir(Resource dir, ZipOutputStream zOut, String vPath,
};
z.setProject(prj);
z.setTaskType("zip");
Files.createDirectories(Util.fileToPath(classesJar.getParentFile()));
Util.createDirectories(Util.fileToPath(classesJar.getParentFile()));
z.setDestFile(classesJar);
z.add(mapper);
z.execute();
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/hudson/ExtensionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
Expand Down Expand Up @@ -327,7 +328,7 @@ private List<ExtensionComponent<T>> ensureLoaded() {
* Chooses the object that locks the loading of the extension instances.
*/
protected Object getLoadLock() {
return jenkins.lookup.setIfNull(Lock.class,new Lock());
return Objects.requireNonNull(jenkins).lookup.setIfNull(Lock.class,new Lock());
}

/**
Expand Down Expand Up @@ -379,7 +380,7 @@ protected List<ExtensionComponent<T>> load() {
LOGGER.log(Level.FINER, String.format("Loading ExtensionList '%s' from", extensionType.getName()), new Throwable("Only present for stacktrace information"));
}

return jenkins.getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
return Objects.requireNonNull(jenkins).getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
}

/**
Expand Down
Loading

0 comments on commit 08e3e1d

Please sign in to comment.