-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #899 from MarkEWaite/reduce-deprecation-warnings
Resolve deprecations in main
- Loading branch information
Showing
47 changed files
with
310 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,116 @@ | ||
#!groovy | ||
#!/usr/bin/env groovy | ||
|
||
Random random = new Random() // Randomize which Jenkins version is selected for more testing | ||
def use_newer_jenkins = random.nextBoolean() // Use newer Jenkins on one build but slightly older on other | ||
import java.util.Collections | ||
|
||
// Test plugin compatibility to recommended configurations | ||
subsetConfiguration = [ [ jdk: '8', platform: 'windows', jenkins: null ], | ||
// Compile with Java 8, test 2.204.6 or 2.222.1 depending on random use_newer_jenkins | ||
[ jdk: '8', platform: 'linux', jenkins: !use_newer_jenkins ? '2.204.6' : '2.222.1', javaLevel: '8' ], | ||
// Compile with Java 11, test the Jenkins version that Java 8 did *not* test | ||
[ jdk: '11', platform: 'linux', jenkins: use_newer_jenkins ? '2.204.6' : '2.222.1', javaLevel: '8' ] | ||
] | ||
// Clean the agents used for the build | ||
// Remove when https://github.com/jenkins-infra/pipeline-library/pull/141 is merged | ||
def temporary_clean(Map params = [:]) { | ||
def failFast = params.containsKey('failFast') ? params.failFast : true | ||
def timeoutValue = params.containsKey('timeout') ? params.timeout : 60 | ||
def forceAci = params.containsKey('forceAci') ? params.forceAci : false | ||
def useAci = params.containsKey('useAci') ? params.useAci : forceAci | ||
if(timeoutValue > 180) { | ||
echo "Timeout value requested was $timeoutValue, lowering to 180 to avoid Jenkins project's resource abusive consumption" | ||
timeoutValue = 180 | ||
} | ||
|
||
buildPlugin(configurations: subsetConfiguration, failFast: false) | ||
Map tasks = [failFast: failFast] | ||
getConfigurations(params).each { config -> | ||
String label = config.platform | ||
String jdk = config.jdk | ||
String jenkinsVersion = config.jenkins | ||
String javaLevel = config.javaLevel | ||
|
||
def branches = [:] | ||
|
||
branches["ATH"] = { | ||
node("docker && highmem") { | ||
def checkoutGit | ||
stage("ATH: Checkout") { | ||
checkoutGit = pwd(tmp:true) + "/athgit" | ||
dir(checkoutGit) { | ||
checkout scm | ||
infra.runMaven(["clean", "package", "-DskipTests"]) | ||
// Include experimental git-client in target dir for ATH | ||
// This Git plugin requires experimental git-client | ||
infra.runMaven(["dependency:copy", "-Dartifact=org.jenkins-ci.plugins:git-client:3.0.0-beta3:hpi", "-DoutputDirectory=target", "-Dmdep.stripVersion=true"]) | ||
dir("target") { | ||
stash name: "localPlugins", includes: "*.hpi" | ||
} | ||
String stageIdentifier = "${label}-${jdk}${jenkinsVersion ? '-' + jenkinsVersion : ''}" | ||
boolean first = tasks.size() == 1 | ||
boolean runFindbugs = first && params?.findbugs?.run | ||
boolean runCheckstyle = first && params?.checkstyle?.run | ||
boolean archiveFindbugs = first && params?.findbugs?.archive | ||
boolean archiveCheckstyle = first && params?.checkstyle?.archive | ||
boolean skipTests = params?.tests?.skip | ||
boolean addToolEnv = !useAci | ||
|
||
if(useAci && (label == 'linux' || label == 'windows')) { | ||
String aciLabel = jdk == '8' ? 'maven' : 'maven-11' | ||
if(label == 'windows') { | ||
aciLabel += "-windows" | ||
} | ||
label = aciLabel | ||
} | ||
def metadataPath = checkoutGit + "/essentials.yml" | ||
stage("Run ATH") { | ||
def athFolder=pwd(tmp:true) + "/ath" | ||
dir(athFolder) { | ||
runATH metadataFile: metadataPath | ||
|
||
tasks[stageIdentifier] = { | ||
node(label) { | ||
timeout(timeoutValue) { | ||
stage("TmpClean (${stageIdentifier})") { | ||
if (isUnix()) { | ||
sh(script: 'git clean -xffd > /dev/null 2>&1', | ||
label:'Clean for incrementals', | ||
returnStatus: true) // Ignore failure if CLI git is not available or this is not a git repository | ||
} else { | ||
bat(script: 'git clean -xffd 1> nul 2>&1', | ||
label:'Clean for incrementals', | ||
returnStatus: true) // Ignore failure if CLI git is not available or this is not a git repository | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
parallel(tasks) | ||
} | ||
branches["PCT"] = { | ||
node("docker && highmem") { | ||
def metadataPath | ||
env.RUN_PCT_LOCAL_PLUGIN_SOURCES_STASH_NAME = "localPluginsPCT" | ||
stage("PCT: Checkout") { | ||
def checkoutGit = pwd(tmp:true) + "/pctgit" | ||
dir(checkoutGit) { | ||
dir("git") { | ||
checkout scm | ||
} | ||
stash name: "localPluginsPCT", useDefaultExcludes: false | ||
} | ||
metadataPath = checkoutGit + "/git/essentials.yml" | ||
|
||
List<Map<String, String>> getConfigurations(Map params) { | ||
boolean explicit = params.containsKey("configurations") | ||
boolean implicit = params.containsKey('platforms') || params.containsKey('jdkVersions') || params.containsKey('jenkinsVersions') | ||
|
||
if (explicit && implicit) { | ||
error '"configurations" option can not be used with either "platforms", "jdkVersions" or "jenkinsVersions"' | ||
} | ||
|
||
def configs = params.configurations | ||
configs.each { c -> | ||
if (!c.platform) { | ||
error("Configuration field \"platform\" must be specified: $c") | ||
} | ||
if (!c.jdk) { | ||
error("Configuration field \"jdk\" must be specified: $c") | ||
} | ||
stage("Run PCT") { | ||
def pctFolder = pwd(tmp:true) + "/pct" | ||
dir(pctFolder) { | ||
runPCT metadataFile: metadataPath | ||
} | ||
|
||
if (explicit) return params.configurations | ||
|
||
def platforms = params.containsKey('platforms') ? params.platforms : ['linux', 'windows'] | ||
def jdkVersions = params.containsKey('jdkVersions') ? params.jdkVersions : [8] | ||
def jenkinsVersions = params.containsKey('jenkinsVersions') ? params.jenkinsVersions : [null] | ||
|
||
def ret = [] | ||
for (p in platforms) { | ||
for (jdk in jdkVersions) { | ||
for (jenkins in jenkinsVersions) { | ||
ret << [ | ||
"platform": p, | ||
"jdk": jdk, | ||
"jenkins": jenkins, | ||
"javaLevel": null // not supported in the old format | ||
] | ||
} | ||
} | ||
} | ||
return ret | ||
} | ||
|
||
// Intentionally disabled until tests are more reliable | ||
// parallel branches | ||
// Valid Jenkins versions for test | ||
def testJenkinsVersions = [ '2.204.1', '2.204.6', '2.222.1', '2.222.4', '2.235', '2.238' ] | ||
Collections.shuffle(testJenkinsVersions) | ||
|
||
// Test plugin compatibility to subset of Jenkins versions | ||
subsetConfiguration = [ [ jdk: '8', platform: 'windows', jenkins: testJenkinsVersions[0], javaLevel: '8' ], | ||
[ jdk: '8', platform: 'linux', jenkins: testJenkinsVersions[1], javaLevel: '8' ], | ||
[ jdk: '11', platform: 'linux', jenkins: testJenkinsVersions[2], javaLevel: '8' ] | ||
] | ||
|
||
// Clean before build so that `git status -s` will have empty output for incrementals | ||
// Remove when https://github.com/jenkins-infra/pipeline-library/pull/141 is merged | ||
temporary_clean(configurations: subsetConfiguration, failFast: false) | ||
|
||
buildPlugin(configurations: subsetConfiguration, failFast: false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.