From c4bde274b06817ac8f1344d163d11e8a92193eb2 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 17 Jul 2019 12:38:56 -0400 Subject: [PATCH 1/8] 2.176.2 --- Jenkinsfile | 2 ++ sample-plugin/pom.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd37c0c3a..1da1180b3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,3 +50,5 @@ plugins.each { plugin -> } } parallel branches + +// TODO incrementalify and publish diff --git a/sample-plugin/pom.xml b/sample-plugin/pom.xml index dad582855..054ce57a9 100644 --- a/sample-plugin/pom.xml +++ b/sample-plugin/pom.xml @@ -12,7 +12,7 @@ 2.176.1-SNAPSHOT hpi - 2.176.1 + 2.176.2 8 From 1ce06769cb0b1bb46e5444bf449e60e531c3ed74 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 15:41:41 -0400 Subject: [PATCH 2/8] Trying to deal with detached plugins and jquery-detached. --- Jenkinsfile | 9 ++++----- README.md | 6 +++++- bom/pom.xml | 10 ++++++++++ ci-2.sh | 31 ------------------------------- local-test.sh | 19 +++++++++++++++++++ pct.sh | 39 +++++++++++++++++++++++++++++++++++++++ pom.xml | 2 -- ci-1.sh => prep.sh | 6 ++++-- sample-plugin/pom.xml | 5 +++++ 9 files changed, 86 insertions(+), 41 deletions(-) delete mode 100644 ci-2.sh create mode 100644 local-test.sh create mode 100644 pct.sh rename ci-1.sh => prep.sh (84%) diff --git a/Jenkinsfile b/Jenkinsfile index 1da1180b3..ff754e8bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,13 +23,12 @@ def plugins stage('prep') { mavenEnv { checkout scm - // TODO rename to prep.sh & pct.sh, respectively, for clarity - sh 'bash ci-1.sh' + sh 'bash prep.sh' dir('sample-plugin/target') { plugins = readFile('plugins.txt').split(' ') stash name: 'pct', includes: 'megawar.war,pct.jar' } - stash name: 'ci', includes: 'ci-2.sh' + stash name: 'ci', includes: 'pct.sh' } } @@ -40,8 +39,8 @@ plugins.each { plugin -> deleteDir() unstash 'ci' unstash 'pct' - withEnv(["PLUGIN=$plugin"]) { - sh 'bash ci-2.sh' + withEnv(["PLUGINS=$plugin"]) { + sh 'bash pct.sh' } warnError('some plugins could not be run in PCT') { sh 'if fgrep -q "INTERNAL_ERROR" pct-report.xml; then echo PCT failed; exit 1; fi' diff --git a/README.md b/README.md index b80757d82..5a607d92a 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,11 @@ and the specified Jenkins LTS version. If there is a PCT failure, fix it in the plugin with the failing test, and when that fix is released, try updating the BOM again. -TODO could use a script to run the full build locally with just a single plugin and a single test. +To reproduce a PCT failure locally, use something like + +```sh +PLUGINS=structs,mailer TEST=InjectedTest bash local-test.sh +``` ## LTS lines diff --git a/bom/pom.xml b/bom/pom.xml index 7704e5193..3cb6c75c9 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -76,11 +76,21 @@ durable-task 1.30 + + org.jenkins-ci.plugins + junit + 1.28 + org.jenkins-ci.plugins mailer 1.23 + + org.jenkins-ci.plugins + matrix-project + 1.14 + org.jenkins-ci.plugins scm-api diff --git a/ci-2.sh b/ci-2.sh deleted file mode 100644 index 5a55e11e5..000000000 --- a/ci-2.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -euxo pipefail -cd $(dirname $0) - -# expects: megawar.war, pct.war, $PLUGIN - -rm -rf pct-work pct-report.xml - -if [ -v MAVEN_SETTINGS ] -then - PCT_S_ARG="-m2SettingsFile $MAVEN_SETTINGS" -else - PCT_S_ARG= -fi - -java -jar pct.jar \ - -war $(pwd)/megawar.war \ - -includePlugins $PLUGIN \ - -workDirectory $(pwd)/pct-work \ - -reportFile $(pwd)/pct-report.xml \ - -mvn $(which mvn) \ - $PCT_S_ARG \ - -mavenProperties org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - -skipTestCache true - -# TODO currently failing tests: https://github.com/jenkinsci/workflow-cps-plugin/pull/302 https://github.com/jenkinsci/structs-plugin/pull/50 -rm -fv \ - pct-work/workflow-cps/target/surefire-reports/TEST-org.jenkinsci.plugins.workflow.cps.SnippetizerTest.xml \ - pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci.plugins.structs.describable.DescribableModelTest.xml - -# produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml diff --git a/local-test.sh b/local-test.sh new file mode 100644 index 000000000..800171a28 --- /dev/null +++ b/local-test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -euxo pipefail +cd $(dirname $0) + +# expects: $PLUGINS, optionally $TEST + +export SAMPLE_PLUGIN_OPTS=-Dtest=InjectedTest +bash prep.sh + +rm -rf target/local-test +mkdir target/local-test +cp -v sample-plugin/target/{megawar.war,pct.jar} pct.sh target/local-test + +cd target/local-test +if [ -v TEST ] +then + export EXTRA_MAVEN_PROPERTIES="test=$TEST" +fi +bash pct.sh diff --git a/pct.sh b/pct.sh new file mode 100644 index 000000000..c286ca0fa --- /dev/null +++ b/pct.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -euxo pipefail +cd $(dirname $0) + +# expects: megawar.war, pct.war, $PLUGINS + +rm -rf pct-work pct-report.xml + +if [ -v MAVEN_SETTINGS ] +then + PCT_S_ARG="-m2SettingsFile $MAVEN_SETTINGS" +else + PCT_S_ARG= +fi + +MAVEN_PROPERTIES=org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn:jth.jenkins-war.path=$(pwd)/megawar.war +if [ -v EXTRA_MAVEN_PROPERTIES ] +then + MAVEN_PROPERTIES="$MAVEN_PROPERTIES:$EXTRA_MAVEN_PROPERTIES" +fi + +java -jar pct.jar \ + -war $(pwd)/megawar.war \ + -includePlugins $PLUGINS \ + -workDirectory $(pwd)/pct-work \ + -reportFile $(pwd)/pct-report.xml \ + -mvn $(which mvn) \ + $PCT_S_ARG \ + -mavenProperties "$MAVEN_PROPERTIES" \ + -skipTestCache true + +# TODO https://github.com/jenkinsci/workflow-cps-plugin/pull/302 +rm -fv pct-work/workflow-cps/target/surefire-reports/TEST-org.jenkinsci.plugins.workflow.cps.SnippetizerTest.xml +# TODO https://github.com/jenkinsci/structs-plugin/pull/50 +rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci.plugins.structs.describable.DescribableModelTest.xml +# TODO https://github.com/jenkinsci/jenkins/pull/4120 problems with workflow-cps → jquery-detached: +rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest.xml + +# produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml diff --git a/pom.xml b/pom.xml index 566e666e3..f25fe42bc 100644 --- a/pom.xml +++ b/pom.xml @@ -20,14 +20,12 @@ https://opensource.org/licenses/MIT - bom sample-plugin diff --git a/ci-1.sh b/prep.sh similarity index 84% rename from ci-1.sh rename to prep.sh index d88b4c4f3..6fb866523 100644 --- a/ci-1.sh +++ b/prep.sh @@ -11,11 +11,13 @@ then MVN="$MVN -s $MAVEN_SETTINGS" fi -$MVN -Dmaven.test.failure.ignore install +$MVN -Dmaven.test.failure.ignore install ${SAMPLE_PLUGIN_OPTS:-} cd sample-plugin/target cp -r jenkins-for-test megawar -# TODO check if removing detached-plugins is still necessary, given use of explicit -includePlugins +mkdir jenkins +echo '# nothing' > jenkins/split-plugins.txt +jar uvf megawar/WEB-INF/lib/jenkins-core-*.jar jenkins/split-plugins.txt rm -rfv megawar/WEB-INF/detached-plugins megawar/META-INF/*.{RSA,SF} mkdir megawar/WEB-INF/plugins cp -rv test-classes/test-dependencies/*.hpi megawar/WEB-INF/plugins diff --git a/sample-plugin/pom.xml b/sample-plugin/pom.xml index 054ce57a9..c1a585e78 100644 --- a/sample-plugin/pom.xml +++ b/sample-plugin/pom.xml @@ -57,6 +57,11 @@ tests test + + org.jenkins-ci.plugins + matrix-project + test + From 37397a0b13047d1557e860584189c91ccb03d87e Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 17:33:42 -0400 Subject: [PATCH 3/8] Oddly, apache-httpcomponents-client-4-api seems to be the only plugin other than structs affected by the jquery-detached issue. --- pct.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pct.sh b/pct.sh index c286ca0fa..9b382fe26 100644 --- a/pct.sh +++ b/pct.sh @@ -35,5 +35,6 @@ rm -fv pct-work/workflow-cps/target/surefire-reports/TEST-org.jenkinsci.plugins. rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci.plugins.structs.describable.DescribableModelTest.xml # TODO https://github.com/jenkinsci/jenkins/pull/4120 problems with workflow-cps → jquery-detached: rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest.xml +rm -fv pct-work/apache-httpcomponents-client-4-api/target/surefire-reports/TEST-InjectedTest.xml # produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml From 84d1f349dd5b63ebcd5bdbfbad6f12f5b58ea3d4 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 17:38:41 -0400 Subject: [PATCH 4/8] Adding command-launcher to the managed list, though it does not solve a PCT error in matrix-project. --- bom/pom.xml | 5 +++++ sample-plugin/check.groovy | 9 +++++++-- sample-plugin/pom.xml | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bom/pom.xml b/bom/pom.xml index 3cb6c75c9..0d816d655 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -66,6 +66,11 @@ apache-httpcomponents-client-4-api 4.5.5-3.0 + + org.jenkins-ci.plugins + command-launcher + 1.3 + org.jenkins-ci.plugins display-url-api diff --git a/sample-plugin/check.groovy b/sample-plugin/check.groovy index a450c5200..fa4523e0c 100644 --- a/sample-plugin/check.groovy +++ b/sample-plugin/check.groovy @@ -7,13 +7,18 @@ assert artifactMap['junit:junit'] == project.artifactMap['junit:junit'] def managedPluginDeps = managedDeps.collect {stripAllButGA(it)}.grep { ga -> def art = artifactMap[ga] if (art == null) { - println "Do not see managed dependency $ga" - return false + if (ga.contains('.plugins:')) { // TODO without an Artifact, we have no reliable way of checking whether it is actually a plugin + throw new org.apache.maven.plugin.MojoFailureException("Managed plugin dependency $ga not listed in test classpath of sample plugin") + } else { + println "Do not see managed dependency $ga" + return false + } } pluginName(art) != null } if (managedPluginDeps != managedPluginDeps.toSorted()) { throw new org.apache.maven.plugin.MojoFailureException("Managed plugin dependencies should be sorted: $managedPluginDeps") + // TODO also check sorting of sample plugin dependencies } project.artifacts.each { art -> diff --git a/sample-plugin/pom.xml b/sample-plugin/pom.xml index c1a585e78..0ffcb5945 100644 --- a/sample-plugin/pom.xml +++ b/sample-plugin/pom.xml @@ -62,6 +62,11 @@ matrix-project test + + org.jenkins-ci.plugins + command-launcher + test + From f1d508ce296e94d7442b711a6b9f8712dfab01b3 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 17:50:48 -0400 Subject: [PATCH 5/8] Ignoring a PCT error in matrix-project for now: its very old JenkinsRule still needed CommandLauncher. --- pct.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pct.sh b/pct.sh index 9b382fe26..fda30acbc 100644 --- a/pct.sh +++ b/pct.sh @@ -36,5 +36,7 @@ rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci # TODO https://github.com/jenkinsci/jenkins/pull/4120 problems with workflow-cps → jquery-detached: rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest.xml rm -fv pct-work/apache-httpcomponents-client-4-api/target/surefire-reports/TEST-InjectedTest.xml +# TODO https://github.com/jenkinsci/matrix-project-plugin/pull/59 +rm -fv pct-work/matrix-project/target/surefire-reports/TEST-InjectedTest.xml # produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml From 86a2c682440099044412361e955f159234ee2bb1 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 18:01:03 -0400 Subject: [PATCH 6/8] And a known failure in CommandLauncher2Test.requireApproval. --- pct.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pct.sh b/pct.sh index fda30acbc..9af52349b 100644 --- a/pct.sh +++ b/pct.sh @@ -38,5 +38,7 @@ rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest. rm -fv pct-work/apache-httpcomponents-client-4-api/target/surefire-reports/TEST-InjectedTest.xml # TODO https://github.com/jenkinsci/matrix-project-plugin/pull/59 rm -fv pct-work/matrix-project/target/surefire-reports/TEST-InjectedTest.xml +# TODO https://github.com/jenkinsci/jenkins/pull/4099 pending backport to 2.176.3 +rm -fv pct-work/command-launcher/target/surefire-reports/TEST-hudson.slaves.CommandLauncher2Test.xml # produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml From 89c5090ed62ef92dff7a411988122abf7798303d Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 19:28:25 -0400 Subject: [PATCH 7/8] Go big or go home! --- bom/pom.xml | 20 ++++++++++++++++++++ sample-plugin/pom.xml | 10 ++++++++++ 2 files changed, 30 insertions(+) diff --git a/bom/pom.xml b/bom/pom.xml index 0d816d655..2729ec54c 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -71,6 +71,11 @@ command-launcher 1.3 + + org.jenkins-ci.plugins + credentials + 2.2.0 + org.jenkins-ci.plugins display-url-api @@ -81,6 +86,11 @@ durable-task 1.30 + + org.jenkins-ci.plugins + jdk-tool + 1.2 + org.jenkins-ci.plugins junit @@ -106,6 +116,16 @@ script-security 1.61 + + org.jenkins-ci.plugins + ssh-credentials + 1.17.1 + + + org.jenkins-ci.plugins + ssh-slaves + 1.29.4 + org.jenkins-ci.plugins structs diff --git a/sample-plugin/pom.xml b/sample-plugin/pom.xml index 0ffcb5945..84d15967b 100644 --- a/sample-plugin/pom.xml +++ b/sample-plugin/pom.xml @@ -67,6 +67,16 @@ command-launcher test + + org.jenkins-ci.plugins + ssh-slaves + test + + + org.jenkins-ci.plugins + jdk-tool + test + From d71f3ae76d8dbcc2387f2c8c92ae2ca7ce7ec8bd Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 18 Jul 2019 20:09:06 -0400 Subject: [PATCH 8/8] We need https://github.com/jenkinsci/ssh-slaves-plugin/pull/114 to solve some linkage errors, but pending https://github.com/jenkinsci/durable-task-plugin/pull/100 it introduces other linkage errors, so for now just ignore all these. --- bom/pom.xml | 2 +- pct.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bom/pom.xml b/bom/pom.xml index 2729ec54c..4e31ec5f5 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -124,7 +124,7 @@ org.jenkins-ci.plugins ssh-slaves - 1.29.4 + 1.29.4 org.jenkins-ci.plugins diff --git a/pct.sh b/pct.sh index 9af52349b..bece262f2 100644 --- a/pct.sh +++ b/pct.sh @@ -36,9 +36,13 @@ rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-org.jenkinsci # TODO https://github.com/jenkinsci/jenkins/pull/4120 problems with workflow-cps → jquery-detached: rm -fv pct-work/structs-plugin/plugin/target/surefire-reports/TEST-InjectedTest.xml rm -fv pct-work/apache-httpcomponents-client-4-api/target/surefire-reports/TEST-InjectedTest.xml +rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-InjectedTest.xml # TODO https://github.com/jenkinsci/matrix-project-plugin/pull/59 rm -fv pct-work/matrix-project/target/surefire-reports/TEST-InjectedTest.xml # TODO https://github.com/jenkinsci/jenkins/pull/4099 pending backport to 2.176.3 rm -fv pct-work/command-launcher/target/surefire-reports/TEST-hudson.slaves.CommandLauncher2Test.xml +# TODO pending ssh-slaves 1.30.0 with https://github.com/jenkinsci/ssh-slaves-plugin/pull/114 (plus https://github.com/jenkinsci/durable-task-plugin/pull/100): +rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-hudson.plugins.sshslaves.verifiers.VerificationStrategyConfigurationTest.xml +rm -fv pct-work/ssh-slaves/target/surefire-reports/TEST-hudson.plugins.sshslaves.SSHLauncherTest.xml # produces: pct-report.xml, **/target/surefire-reports/TEST-*.xml