Skip to content

Commit

Permalink
Hack to test JENKINS-45047
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed May 23, 2022
1 parent ea1c2d0 commit 831920c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
6 changes: 6 additions & 0 deletions excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ hudson.matrix.AxisTest
# TODO https://github.com/jenkinsci/ansicolor-plugin/pull/236
hudson.plugins.ansicolor.action.ShortlogActionCreatorIntegrationTest

# TODO https://github.com/jenkinsci/ansicolor-plugin/pull/241
hudson.plugins.ansicolor.AnsiColorStepTest

# TODO https://github.com/jenkinsci/command-launcher-plugin/pull/47
hudson.slaves.CommandLauncher2Test

# TODO flakes on CI for inscrutable reasons
org.jenkinsci.plugins.durabletask.BourneShellScriptTest

Expand Down
28 changes: 21 additions & 7 deletions pct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,37 @@ cd "$(dirname "$0")"
# expects: megawar.war, pct.war, excludes.txt, $PLUGINS, $LINE

rm -rf pct-work pct-report.xml
mkdir pct-work

if [[ -n ${MAVEN_SETTINGS-} ]]; then
PCT_S_ARG="-m2SettingsFile ${MAVEN_SETTINGS}"
else
PCT_S_ARG=
fi

MAVEN_PROPERTIES=jth.jenkins-war.path=$(pwd)/megawar.war:forkCount=.75C:surefire.excludesFile=$(pwd)/excludes.txt
pushd pct-work
jar xf ../megawar.war META-INF/MANIFEST.MF
JENKINS_VERSION=$(grep Jenkins-Version META-INF/MANIFEST.MF | awk '{print $2}')
popd
rm -rf pct-work

MAVEN_PROPERTIES=jth.jenkins-war.path=$(pwd)/megawar.war:forkCount=.75C:surefire.excludesFile=$(pwd)/excludes.txt:jenkins.version=${JENKINS_VERSION}:overrideWar=$(pwd)/megawar.war:useUpperBounds=true:hpi-plugin.version=3.28-rc1280.6fdeffb_1df8f

if [[ -n ${EXTRA_MAVEN_PROPERTIES-} ]]; then
MAVEN_PROPERTIES="${MAVEN_PROPERTIES}:${EXTRA_MAVEN_PROPERTIES}"
fi

#
# AnsiColor and OkHttp use an old plugin parent POM that results in Enforcer errors when used
# against recent cores and an older test harness that is incompatible with the removal of JNR in
# recent cores. As a temporary workaround, we skip Enforcer and manually override the test harness
# to a recent version. When jenkinsci/ansicolor-plugin#241 and jenkinsci/okhttp-api-plugin#91 are
# released, and when this repository has upgraded to those releases, this workaround can be deleted.
#
if [[ $PLUGINS =~ ansicolor ]] || [[ $PLUGINS =~ okhttp-api ]]; then
MAVEN_PROPERTIES+=":enforcer.skip=true:jenkins-test-harness.version=1752.v86627a_c48d91"
fi

#
# Plugin Compatibility Tester (PCT) requires custom --add-opens directives when running on Java 17.
# As a temporary workaround, we pass in these directives when invoking PCT. When
Expand All @@ -35,6 +54,7 @@ java \
-reportFile "$(pwd)/pct-report.xml" \
$PCT_S_ARG \
-mavenProperties "${MAVEN_PROPERTIES}" \
-excludeHooks org.jenkins.tools.test.hook.TransformPom \
-skipTestCache true

if grep -q -F -e '<status>INTERNAL_ERROR</status>' pct-report.xml; then
Expand Down Expand Up @@ -70,10 +90,4 @@ elif grep -q -F -e '<status>TEST_FAILURES</status>' pct-report.xml; then
done
fi

# TODO various problems with PCT itself (e.g. https://github.com/jenkinsci/bom/pull/338#issuecomment-715256727)
# and anyway the tests in PluginAutomaticTestBuilder are generally uninteresting in a PCT context
# We always try to run this test rather than adding it to excludes.txt in order
# to be able to detect if PCT failed to run tests at all a few lines above.
rm -fv pct-work/*/{,*/}target/surefire-reports/TEST-InjectedTest.xml

# produces: **/target/surefire-reports/TEST-*.xml
2 changes: 1 addition & 1 deletion prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for LINE in $LINEZ; do
done

# TODO find a way to encode this in some POM so that it can be managed by Dependabot
version=1152.vafc19b26d5aa # TODO https://github.com/jenkinsci/plugin-compat-tester/pull/345
version=1167.vc04b718e32d4 # TODO https://github.com/jenkinsci/plugin-compat-tester/pull/360
pct=$HOME/.m2/repository/org/jenkins-ci/tests/plugins-compat-tester-cli/${version}/plugins-compat-tester-cli-${version}.jar
[ -f "${pct}" ] || $MVN dependency:get -Dartifact=org.jenkins-ci.tests:plugins-compat-tester-cli:${version}:jar -DremoteRepositories=https://repo.jenkins-ci.org/public/,https://repo.jenkins-ci.org/incrementals/ -Dtransitive=false
cp "${pct}" target/pct.jar
Expand Down

0 comments on commit 831920c

Please sign in to comment.