From 91eed1b222202dd7caa2029bd8b66310084ddb1a Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 17 Apr 2023 18:39:54 -0700 Subject: [PATCH] Native support for multi-module Maven projects (#1970) --- Jenkinsfile | 10 +++++----- bom-weekly/pom.xml | 2 +- local-test.sh | 2 -- pct.sh | 1 + prep-pct.sh | 2 +- prep.sh | 12 ++++++++---- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 20c484afa..37ea94f6a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ def mavenEnv(Map params = [:], Closure body) { } } -def plugins +def pluginsByRepository def lines def fullTest = env.CHANGE_ID && pullRequest.labels.contains('full-test') @@ -42,7 +42,7 @@ stage('prep') { } } dir('target') { - plugins = readFile('plugins.txt').split('\n') + pluginsByRepository = readFile('plugins.txt').split('\n') lines = readFile('lines.txt').split('\n') if (!fullTest) { // run PCT only on newest and oldest lines, to save resources @@ -64,14 +64,14 @@ stage('prep') { branches = [failFast: !fullTest] lines.each {line -> - plugins.each { plugin -> - branches["pct-$plugin-$line"] = { + pluginsByRepository.each { plugins -> + branches["pct-$plugins-$line"] = { def jdk = line == 'weekly' ? 17 : 11 mavenEnv(jdk: jdk) { deleteDir() checkout scm withEnv([ - "PLUGINS=$plugin", + "PLUGINS=$plugins", "LINE=$line", 'EXTRA_MAVEN_PROPERTIES=maven.test.failure.ignore=true:surefire.rerunFailingTestsCount=1' ]) { diff --git a/bom-weekly/pom.xml b/bom-weekly/pom.xml index da8b91220..5c0cd4201 100644 --- a/bom-weekly/pom.xml +++ b/bom-weekly/pom.xml @@ -9,7 +9,7 @@ bom-weekly pom - 1.12.406-378.v938a_d577f750 + 1.12.447-382.vda_68e2007233 2.0.0 1625.v27444588cc3d 1.13.3-3 diff --git a/local-test.sh b/local-test.sh index 419a43324..a1f4b2edf 100755 --- a/local-test.sh +++ b/local-test.sh @@ -13,8 +13,6 @@ if [[ $LINE != "${LATEST_LINE}" ]]; then fi export SAMPLE_PLUGIN_OPTS LINEZ=$LINE bash prep.sh -LINE=$LINE bash prep-megawar.sh -bash prep-pct.sh if [[ -n ${TEST-} ]]; then EXTRA_MAVEN_PROPERTIES="test=${TEST}" diff --git a/pct.sh b/pct.sh index db7442c08..32e2acdc0 100755 --- a/pct.sh +++ b/pct.sh @@ -15,6 +15,7 @@ fi exec java \ -jar target/pct.jar \ + test-plugins \ --war "$(pwd)/target/megawar-$LINE.war" \ --include-plugins "${PLUGINS}" \ --working-dir "$(pwd)/pct-work" \ diff --git a/prep-pct.sh b/prep-pct.sh index 0af47b255..7ba04139e 100644 --- a/prep-pct.sh +++ b/prep-pct.sh @@ -3,7 +3,7 @@ set -euxo pipefail cd "$(dirname "${0}")" # Tracked by ./updatecli/updatecli.d/plugin-compat-tester.yml -pct_version=1307.veb_32a_fef160e +pct_version=1313.v036de64e1863 pct="$(mvn -Dexpression=settings.localRepository -q -DforceStdout help:evaluate)/org/jenkins-ci/tests/plugins-compat-tester-cli/${pct_version}/plugins-compat-tester-cli-${pct_version}.jar" [ -f "${pct}" ] || mvn dependency:get -Dartifact=org.jenkins-ci.tests:plugins-compat-tester-cli:${pct_version}:jar -DremoteRepositories=repo.jenkins-ci.org::default::https://repo.jenkins-ci.org/public/,incrementals::default::https://repo.jenkins-ci.org/incrementals/ -Dtransitive=false cp "${pct}" target/pct.jar diff --git a/prep.sh b/prep.sh index ca1a29fc5..5cd91ec32 100644 --- a/prep.sh +++ b/prep.sh @@ -17,13 +17,17 @@ for LINE in $LINEZ; do mvn -f sample-plugin clean package ${SAMPLE_PLUGIN_OPTS:-} "-P${LINE}" else rebuild=true - pushd sample-plugin/target/test-classes/test-dependencies - ls -1 *.hpi | sed s/.hpi//g >../../../../target/plugins.txt - popd + bash prep-pct.sh + LINE=$LINE bash prep-megawar.sh + java \ + -jar target/pct.jar \ + list-plugins \ + --war "target/megawar-${LINE}.war" \ + --output "target/plugins.txt" fi if [[ -n ${CI-} ]]; then - LINE=$LINE bash prep-megawar.sh if [[ ${LINE} != weekly ]]; then + LINE=$LINE bash prep-megawar.sh PROFILE="-P${LINE}" fi # TODO https://github.com/jenkinsci/maven-hpi-plugin/pull/464