Skip to content

Commit

Permalink
Native support for multi-module Maven projects (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Apr 18, 2023
1 parent 4677a6e commit 91eed1b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
10 changes: 5 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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
Expand All @@ -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'
]) {
Expand Down
2 changes: 1 addition & 1 deletion bom-weekly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<artifactId>bom-weekly</artifactId>
<packaging>pom</packaging>
<properties>
<aws-java-sdk-plugin.version>1.12.406-378.v938a_d577f750</aws-java-sdk-plugin.version>
<aws-java-sdk-plugin.version>1.12.447-382.vda_68e2007233</aws-java-sdk-plugin.version>
<checks-api.version>2.0.0</checks-api.version>
<configuration-as-code-plugin.version>1625.v27444588cc3d</configuration-as-code-plugin.version>
<data-tables-api.version>1.13.3-3</data-tables-api.version>
Expand Down
2 changes: 0 additions & 2 deletions local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
1 change: 1 addition & 0 deletions pct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion prep-pct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91eed1b

Please sign in to comment.