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 28, 2021
2 parents a191369 + ecd17cd commit 5802f11
Show file tree
Hide file tree
Showing 81 changed files with 268 additions and 705 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
22 changes: 1 addition & 21 deletions core/src/main/java/hudson/WebAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
Expand Down Expand Up @@ -337,24 +334,7 @@ public FileAndDescription(File file,String description) {
* @return the File alongside with some description to help the user troubleshoot issues
*/
public FileAndDescription getHomeDir(ServletContextEvent event) {
// check JNDI for the home directory first
for (String name : HOME_NAMES) {
try {
InitialContext iniCtxt = new InitialContext();
Context env = (Context) iniCtxt.lookup("java:comp/env");
String value = (String) env.lookup(name);
if(value!=null && value.trim().length()>0)
return new FileAndDescription(new File(value.trim()),"JNDI/java:comp/env/"+name);
// look at one more place. See issue JENKINS-1314
value = (String) iniCtxt.lookup(name);
if(value!=null && value.trim().length()>0)
return new FileAndDescription(new File(value.trim()),"JNDI/"+name);
} catch (NamingException e) {
// ignore
}
}

// next the system property
// check the system property for the home directory first
for (String name : HOME_NAMES) {
String sysProp = SystemProperties.getString(name);
if(sysProp!=null)
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/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.Functions;
import hudson.Util;
import hudson.search.SearchableModelObject;
Expand All @@ -39,7 +40,6 @@
import jenkins.model.Jenkins;
import jenkins.util.SystemProperties;
import jenkins.util.io.OnMaster;
import jline.internal.Nullable;
import org.kohsuke.stapler.StaplerRequest;

/**
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
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,7 @@ public Collection<Fingerprint> getBuildFingerprints() {
*
* @since 1.349
*/
@SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED", justification = "method signature does not permit plumbing through the return value")
public void writeLogTo(long offset, @NonNull XMLOutput out) throws IOException {
long start = offset;
if (offset > 0) {
Expand Down Expand Up @@ -1782,7 +1783,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
Loading

0 comments on commit 5802f11

Please sign in to comment.