Skip to content

Commit

Permalink
Merge branch 'master' into update-forms
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Dec 27, 2021
2 parents 2c0eacc + 0e66614 commit 47d6611
Show file tree
Hide file tree
Showing 66 changed files with 228 additions and 229 deletions.
236 changes: 138 additions & 98 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,128 +9,168 @@ def buildNumber = BUILD_NUMBER as int; if (buildNumber > 1) milestone(buildNumbe

def failFast = false
// Same memory sizing for both builds and ATH
def javaOpts = ["JAVA_OPTS=-Xmx1536m -Xms512m","MAVEN_OPTS=-Xmx1536m -Xms512m"]
def javaOpts = [
'JAVA_OPTS=-Xmx1536m -Xms512m',
'MAVEN_OPTS=-Xmx1536m -Xms512m',
]

properties([
buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '3')),
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '3')),
disableConcurrentBuilds(abortPrevious: true)
])

def buildTypes = ['Linux', 'Windows']
def jdks = [8, 11]

def builds = [:]
for(i = 0; i < buildTypes.size(); i++) {
for(j = 0; j < jdks.size(); j++) {
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
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
String agentContainerLabel = jdk == 8 ? 'maven' : 'maven-11'
if (buildType == 'Windows') {
agentContainerLabel += '-windows'
// see https://github.com/jenkins-infra/documentation/blob/master/ci.adoc#node-labels for information on what node types are available
def agentContainerLabel = jdk == 8 ? 'maven' : 'maven-' + jdk
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') {
checkout scm
}
node(agentContainerLabel) {
// First stage is actually checking out the source. Since we're using Multibranch
// currently, we can use "checkout scm".
stage('Checkout') {
checkout scm
}

def changelistF = "${pwd tmp: true}/changelist"
def m2repo = "${pwd tmp: true}/m2repo"
def changelistF = "${pwd tmp: true}/changelist"
def m2repo = "${pwd tmp: true}/m2repo"

// 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 -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'
}
}
}
}
// Now run the actual build.
stage("${buildType} Build / Test") {
timeout(time: 5, unit: 'HOURS') {
realtimeJUnit(healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml,war/junit.xml') {
def mavenOptions = [
'-Pdebug',
'-Pjapicmp',
'--update-snapshots',
"-Dmaven.repo.local=$m2repo",
'-Dmaven.test.failure.ignore',
'-Dspotbugs.failOnError=false',
'-Dcheckstyle.failOnViolation=false',
'-Dset.changelist',
'help:evaluate',
'-Dexpression=changelist',
"-Doutput=$changelistF",
'clean',
'install',
]
infra.runMaven(mavenOptions, jdk.toString(), javaOpts, null, 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") {
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'
}
if (! fileExists('test/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml') ) {
error 'junit 4 tests are no longer being run for the test package'
} // cli has been migrated to junit 5
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) {
discoverGitReferenceBuild(scm: folders[1])
}
// Once we've built, archive the artifacts and the test results.
stage("${buildType} Publishing") {
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'
}
if (!fileExists('test/target/surefire-reports/TEST-jenkins.Junit4TestsRanTest.xml')) {
error 'JUnit 4 tests are no longer being run for the test package'
}
// cli has been migrated to JUnit 5
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) {
discoverGitReferenceBuild(scm: folders[1])
}

echo "Recording static analysis results for '${buildType}'"
recordIssues enabledForFailure: true,
tools: [java(), javaDoc()],
filters: [excludeFile('.*Assert.java')],
sourceCodeEncoding: 'UTF-8',
skipBlames: true,
trendChartType: 'TOOLS_ONLY'
recordIssues([tool: spotBugs(pattern: '**/target/spotbugsXml.xml'),
sourceCodeEncoding: 'UTF-8',
skipBlames: true,
trendChartType: 'TOOLS_ONLY',
qualityGates: [[threshold: 1, type: 'NEW', unstable: true]]])
recordIssues([tool: checkStyle(pattern: '**/target/checkstyle-result.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'
}
echo "Recording static analysis results for '${buildType}'"
recordIssues(
enabledForFailure: true,
tools: [java(), javaDoc()],
filters: [excludeFile('.*Assert.java')],
sourceCodeEncoding: 'UTF-8',
skipBlames: true,
trendChartType: 'TOOLS_ONLY'
)
recordIssues([tool: spotBugs(pattern: '**/target/spotbugsXml.xml'),
sourceCodeEncoding: 'UTF-8',
skipBlames: true,
trendChartType: 'TOOLS_ONLY',
qualityGates: [
[threshold: 1, type: 'NEW', unstable: true],
]])
recordIssues([tool: checkStyle(pattern: '**/target/checkstyle-result.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'
}

def changelist = readFile(changelistF)
dir(m2repo) {
archiveArtifacts artifacts: "**/*$changelist/*$changelist*",
excludes: '**/*.lastUpdated,**/jenkins-test*/',
allowEmptyArchive: true, // in case we forgot to reincrementalify
fingerprint: true
}
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, includes: 'japicmp.html', keepAll: false, reportDir: 'core/target/japicmp', reportFiles: 'japicmp.html', reportName: 'API compatibility', reportTitles: 'japicmp report'])
}
}
def changelist = readFile(changelistF)
dir(m2repo) {
archiveArtifacts(
artifacts: "**/*$changelist/*$changelist*",
excludes: '**/*.lastUpdated,**/jenkins-test*/',
allowEmptyArchive: true, // in case we forgot to reincrementalify
fingerprint: true
)
}
publishHTML([
allowMissing: true,
alwaysLinkToLastBuild: false,
includes: 'japicmp.html',
keepAll: false,
reportDir: 'core/target/japicmp',
reportFiles: 'japicmp.html',
reportName: 'API compatibility',
reportTitles: 'japicmp report',
])
}
}
}
}
}}
}
}

builds.ath = {
node("docker-highmem") {
// Just to be safe
deleteDir()
def fileUri
def metadataPath
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, "11", javaOpts, true)
dir("war/target") {
fileUri = "file://" + pwd() + "/jenkins.war"
}
metadataPath = pwd() + "/essentials.yml"
}
dir("ath") {
runATH jenkins: fileUri, metadataFile: metadataPath
}
node('docker-highmem') {
// Just to be safe
deleteDir()
def fileUri
def metadataPath
dir('sources') {
checkout scm
def mavenOptions = [
'-Pquick-build',
'-Dmaven.repo.local=$WORKSPACE_TMP/m2repo',
'-am',
'-pl',
'war',
'package',
]
infra.runMaven(mavenOptions, '11', javaOpts, null, true)
dir('war/target') {
fileUri = 'file://' + pwd() + '/jenkins.war'
}
metadataPath = pwd() + '/essentials.yml'
}
dir('ath') {
runATH jenkins: fileUri, metadataFile: metadataPath
}
}
}

builds.failFast = failFast
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ THE SOFTWARE.
<properties>
<asm.version>9.2</asm.version>
<slf4jVersion>1.7.32</slf4jVersion>
<stapler.version>1612.v2a13b906bf3a</stapler.version>
<stapler.version>1627.v5c244c19f85f</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/AbstractBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ public void defaultCheckout() throws IOException, InterruptedException {
* itself run successfully)
* Return a non-null value to abort the build right there with the specified result code.
*/
protected abstract Result doRun(BuildListener listener) throws Exception, RunnerAbortedException;
protected abstract Result doRun(BuildListener listener) throws Exception;

/**
* @see #post(BuildListener)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/ManagementLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public enum Category {
*/
UNCATEGORIZED(Messages._ManagementLink_Category_UNCATEGORIZED());

private Localizable label;
private final Localizable label;

Category(Localizable label) {
this.label = label;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ private synchronized void allDone() {
* @throws Exception
* exception will be recorded and the build will be considered a failure.
*/
public abstract @NonNull Result run(@NonNull BuildListener listener ) throws Exception, RunnerAbortedException;
public abstract @NonNull Result run(@NonNull BuildListener listener ) throws Exception;

/**
* Performs the post-build action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ private User createAccount(StaplerRequest req, StaplerResponse rsp, boolean vali
* @return a {@link SignupInfo#SignupInfo(StaplerRequest) SignupInfo from given request}, with {@link
* SignupInfo#errors} containing errors (keyed by field name), if any of the supported fields are invalid
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "written to by Stapler")
private SignupInfo validateAccountCreationForm(StaplerRequest req, boolean validateCaptcha) {
// form field validation
// this pattern needs to be generalized and moved to stapler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public NoClientBindProtocolSocketFactory() {
public Socket createSocket(String host,
int port,
InetAddress localAddress,
int localPort) throws IOException, UnknownHostException {
int localPort) throws IOException {
// ignore the local address/port for binding
return createSocket(host, port);
}
Expand Down Expand Up @@ -100,8 +100,7 @@ public Socket createSocket(String host, int port, InetAddress localAddress,
* @see ProtocolSocketFactory#createSocket(java.lang.String,int)
*/
@Override
public Socket createSocket(String host, int port) throws IOException,
UnknownHostException,IOException {
public Socket createSocket(String host, int port) throws IOException {
return new Socket(host, port);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Socket createSocket(
int port,
InetAddress clientHost,
int clientPort)
throws IOException, UnknownHostException {
throws IOException {
return createSocket(host,port);
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public Socket createSocket(
*/
@Override
public Socket createSocket(String host, int port)
throws IOException, UnknownHostException {
throws IOException {
return SSLSocketFactory.getDefault().createSocket(
host,
port
Expand All @@ -146,7 +146,7 @@ public Socket createSocket(
String host,
int port,
boolean autoClose)
throws IOException, UnknownHostException {
throws IOException {
return ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket(
socket,
host,
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/ProcessTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public interface ProcessCallable<T> extends Serializable {
}


/* package */ static Boolean vetoersExist;
/* package */ static volatile Boolean vetoersExist;

/**
* Gets the {@link ProcessTree} of the current system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void checkRoles(RoleChecker checker) throws SecurityException {
public Channel getChannelOrFail() throws ChannelClosedException {
final Channel ch = Channel.current();
if (ch == null) {
throw new ChannelClosedException(ch, new IllegalStateException("No channel associated with the thread"));
throw new ChannelClosedException((Channel) null, new IllegalStateException("No channel associated with the thread"));
}
return ch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.model.AdministrativeMonitor;
import hudson.model.User;
Expand Down Expand Up @@ -160,6 +161,7 @@ public boolean hasMoreRecentlyUsedToken(@NonNull User user, ApiTokenProperty.Tok
}

@RequirePOST
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "written to by Stapler")
public HttpResponse doRevokeAllSelected(@JsonBody RevokeAllSelectedModel content) throws IOException {
for (RevokeAllSelectedUserAndUuid value : content.values) {
if (value.userId == null) {
Expand Down
Loading

0 comments on commit 47d6611

Please sign in to comment.