From cfb048c5e6557cf7da9c94a5e7fd3bca78eb4bd3 Mon Sep 17 00:00:00 2001 From: Jiri Date: Mon, 29 Jul 2024 18:28:59 +0200 Subject: [PATCH 01/22] Added inital hook to allow both docker/podman and sudo/runas/"" --- external/README.md | 15 +++++++++++++++ external/build_image.sh | 4 +++- external/provider.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 external/provider.sh diff --git a/external/README.md b/external/README.md index fcdddd6e01..ae831e2ded 100644 --- a/external/README.md +++ b/external/README.md @@ -2,6 +2,21 @@ Third Party container tests help verify that the adoptium binaries are *good* by running a variety of Java applications inside of Docker containers. adoptium/aqa-tests/[Issue #172](https://github.com/adoptium/aqa-tests/issues/172) lists the applications that we have initially targeted to best exercise the adoptium binaries. For each application, we choose to run a selection of their functional tests. +## Podman, docker and others. Sudo, runas and others + +The toolchain understands two environment variables: +``` +EXTERNAL_AQA_RUNNER=docker/podman/... +``` +defaults to podman if podman is installed otherwise to docker + +and +``` +EXTERNAL_AQA_SUDO=sudo//runas +``` +which defaults to nothing + + ## Running External tests locally To run any AQA tests locally, you follow the same pattern: diff --git a/external/build_image.sh b/external/build_image.sh index 99758c770a..377cb8302c 100755 --- a/external/build_image.sh +++ b/external/build_image.sh @@ -16,8 +16,10 @@ set -o pipefail source $(dirname "$0")/common_functions.sh source $(dirname "$0")/dockerfile_functions.sh +source $(dirname "$0")/provider.sh + buildArg="" -container_build="docker build" +container_build=`getExternalImageBuildCommand` if [ $# -ne 9 ] && [ $# -ne 10 ]; then echo "The supported tests are ${supported_tests}" diff --git a/external/provider.sh b/external/provider.sh new file mode 100755 index 0000000000..eb6fa7d7a6 --- /dev/null +++ b/external/provider.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +################################################################### +## This script is walking through all external tests ## +## and is determining what virtualisation to use ## +## It recognize two environemnt variables: ## +## EXTERNAL_AQA_RUNNER=docker/podman/... ## +## EXTERNAL_AQA_SUDO=sudo//runas ## +## ## +## EXTERNAL_AQA_RUNNER defaults to podman if podman is installed ## +## otherwise to docker ## +## EXTERNAL_AQA_SUDO defaults to nothing ## +################################################################### + +if [ -z "${EXTERNAL_AQA_RUNNER}" ]; then + if which podman > /dev/null; then + EXTERNAL_AQA_RUNNER=podman + else + EXTERNAL_AQA_RUNNER=docker + fi +fi + +function getExternalImageBuildCommand() { + #"sudo docker build" + echo "${EXTERNAL_AQA_SUDO} ${EXTERNAL_AQA_RUNNER} build" +} From 55bed93cfbd0633346e5b3a2b5e98bda45507b50 Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 12:39:31 +0200 Subject: [PATCH 02/22] Better subshell quoting --- external/build_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/build_image.sh b/external/build_image.sh index 377cb8302c..8e277b392d 100755 --- a/external/build_image.sh +++ b/external/build_image.sh @@ -19,7 +19,7 @@ source $(dirname "$0")/dockerfile_functions.sh source $(dirname "$0")/provider.sh buildArg="" -container_build=`getExternalImageBuildCommand` +container_build="$(getExternalImageBuildCommand)" if [ $# -ne 9 ] && [ $# -ne 10 ]; then echo "The supported tests are ${supported_tests}" From b800b8cbcb7637ce143f4b89025d713dea8dd2cc Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 12:54:40 +0200 Subject: [PATCH 03/22] Added correct title to dockerfile --- external/dockerfile_functions.sh | 3 ++- external/provider.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/external/dockerfile_functions.sh b/external/dockerfile_functions.sh index ea9b9f81dd..79279acd46 100755 --- a/external/dockerfile_functions.sh +++ b/external/dockerfile_functions.sh @@ -14,6 +14,7 @@ # source $(dirname "$0")/common_functions.sh +source $(dirname "$0")/provider.sh # Generate the common license and copyright header print_legal() { @@ -126,7 +127,7 @@ print_test_tag_arg() { print_result_comment_arg() { local file=$1 - echo -e "ENV RESULT_COMMENT=\"IN DOCKER\"\n" >> ${file} + echo -e "ENV RESULT_COMMENT=\"IN CONTAINER($(getProviderTile))\"\n" >> ${file} } # Select the ubuntu OS packages diff --git a/external/provider.sh b/external/provider.sh index eb6fa7d7a6..9ef9e682e9 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -38,3 +38,20 @@ function getExternalImageBuildCommand() { #"sudo docker build" echo "${EXTERNAL_AQA_SUDO} ${EXTERNAL_AQA_RUNNER} build" } + +function getProviderNice() { + echo "${EXTERNAL_AQA_RUNNER}" +} + +function getSudoNice() { + if [ -z "${EXTERNAL_AQA_SUDO}" ]; then + echo "not-as-root" + else + echo "${EXTERNAL_AQA_SUDO}" + fi +} + +function getProviderTile() { + echo "$(getSudoNice)/$(getProviderNice)" +} + From 2e5fd089ebd747933a5e01c18c4cbf06a7122344 Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 13:12:03 +0200 Subject: [PATCH 04/22] being explicit on default temurin image origin [exec] INFO: podman build --no-cache -t adoptopenjdk-lucene-solr-test:11-jdk-ubuntu-hotspot-full -f /home/jvanek/git/jvmtest/external/lucene-solr/dockerfile/11/jdk/ubuntu/Dockerfile.hotspot.full /home/jvanek/git/jvmtest/external/ [exec] ##################################################### [exec] STEP 1/21: FROM eclipse-temurin:11-jdk [exec] Error: creating build container: short-name resolution enforced but cannot prompt without a TTY Which needs to resolve. The docker.io/library is already ised in external/external.sh: docker_image_name="docker.io/library/eclipse-temurin:${JDK_VERSION}-jdk" --- external/dockerfile_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/dockerfile_functions.sh b/external/dockerfile_functions.sh index 79279acd46..dd5108325e 100755 --- a/external/dockerfile_functions.sh +++ b/external/dockerfile_functions.sh @@ -84,7 +84,7 @@ print_image_args() { local build=$7 local base_docker_registry_dir="$8" - image_name="eclipse-temurin" + image_name="docker.io/library/eclipse-temurin" tag="" if [[ "${package}" == "jre" ]]; then tag="${version}-jre" From 0e3c9ab1b5521b4af4eca1c58a4a317d79bc3eb5 Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 16:05:17 +0200 Subject: [PATCH 05/22] Fixed target name in README --- external/lucene-solr/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/lucene-solr/README.md b/external/lucene-solr/README.md index 1e182cfae6..2adda16635 100644 --- a/external/lucene-solr/README.md +++ b/external/lucene-solr/README.md @@ -15,7 +15,7 @@ To run any AQA tests locally, you follow the same pattern: 6. `cd TKG` 7. export required environment variables, BUILD_LIST and EXTRA_DOCKER_ARGS (`export BUILD_LIST=external/lucene-solr` and `export EXTRA_DOCKER_ARGS="-v $TEST_JDK_HOME:/opt/java/openjdk"` 8. `make compile` (This fetches test material and compiles it, based on build.xml files in the test directories) -9. `make lucene-solr_test` (When you defined BUILD_LIST to point to a directory in aqa-tests/external, then this is a testCaseName from the playlist.xml file within the directory you chose) +9. `make _lucene_solr_nightly_smoketest` (When you defined BUILD_LIST to point to a directory in aqa-tests/external, then this is a testCaseName from the playlist.xml file within the directory you chose with underscore) When [running these from the command-line](https://github.com/adoptium/aqa-tests/blob/master/doc/userGuide.md#local-testing-via-make-targets-on-the-commandline), these tests are grouped under a make target called 'external', so 'make external' would run the entire set of tests found in the aqa-tests/external directory. This is unadvisable! Limit what you compile and run, BUILD_LIST=external/``, and TARGET=`` From 8affe4f52005531e204183e41abd8bd49adf0bfb Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 16:54:36 +0200 Subject: [PATCH 06/22] Runtime can now use podman too --- external/external.sh | 25 ++++++++++++++----------- external/provider.sh | 7 ++++++- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/external/external.sh b/external/external.sh index 8bb77a9ad1..be4fdc1076 100755 --- a/external/external.sh +++ b/external/external.sh @@ -16,6 +16,9 @@ # script runs in 5 modes - prepare / build / run / load / clean set -e + +source $(dirname "$0")/provider.sh + tag=nightly docker_os=ubuntu build_type=full @@ -33,17 +36,17 @@ node_name="" node_labels="" node_label_micro_architecture="" node_label_current_os="" -container_run="docker run" -container_login="docker login" -container_inspect="docker inspect" -container_cp="docker cp" -container_commit="docker commit" -container_tag="docker tag" -container_logout="docker logout" -container_push="docker push" -container_pull="docker pull" -container_rm="docker rm" -container_rmi="docker rmi" +container_run="$(getExternalImageCommand) run" +container_login="$(getExternalImageCommand) login" +container_inspect="$(getExternalImageCommand) inspect" +container_cp="$(getExternalImageCommand) cp" +container_commit="$(getExternalImageCommand) commit" +container_tag="$(getExternalImageCommand) tag" +container_logout="$(getExternalImageCommand) logout" +container_push="$(getExternalImageCommand) push" +container_pull="$(getExternalImageCommand) pull" +container_rm="$(getExternalImageCommand) rm" +container_rmi="$(getExternalImageCommand) rmi" docker_registry_required="false" docker_registry_url="" docker_registry_dir="" diff --git a/external/provider.sh b/external/provider.sh index 9ef9e682e9..458ed1d36f 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -36,7 +36,12 @@ fi function getExternalImageBuildCommand() { #"sudo docker build" - echo "${EXTERNAL_AQA_SUDO} ${EXTERNAL_AQA_RUNNER} build" + echo "$(getExternalImageCommand) build" +} + +function getExternalImageCommand() { + #"sudo docker" + echo "${EXTERNAL_AQA_SUDO} ${EXTERNAL_AQA_RUNNER}" } function getProviderNice() { From dc254dc75c891771323832e83c38e5fcb715ad0e Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 17:45:17 +0200 Subject: [PATCH 07/22] Added ability to not clean after run --- external/README.md | 4 ++++ external/external.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/external/README.md b/external/README.md index ae831e2ded..3216d21c55 100644 --- a/external/README.md +++ b/external/README.md @@ -15,6 +15,10 @@ and EXTERNAL_AQA_SUDO=sudo//runas ``` which defaults to nothing +``` +EXTERNAL_AQA_CLEAN=true/false +``` +If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. If used, you are on your own. ## Running External tests locally diff --git a/external/external.sh b/external/external.sh index be4fdc1076..fcc005a35d 100755 --- a/external/external.sh +++ b/external/external.sh @@ -439,10 +439,14 @@ if [ $command_type == "load" ]; then fi fi -if [ $command_type == "clean" ]; then +if [ "${command_type}" == "clean" ] ; then if [[ ${test} == 'external_custom' ]]; then test="$(echo ${EXTERNAL_CUSTOM_REPO} | awk -F'/' '{print $NF}' | sed 's/.git//g')" fi + if [ "${EXTERNAL_AQA_CLEAN}" == "false" ] ; then + container_rm="echo to clean, run manually: $container_rm" + container_rmi="echo to clean, run manually: $container_rmi" + fi $container_rm -f $test-test; $container_rmi -f adoptopenjdk-$test-test:${JDK_VERSION}-$package-$docker_os-${JDK_IMPL}-$build_type $container_rm -f restore-test $container_rmi -f ${docker_registry_url}/${docker_image_source_job_name}/${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${node_label_current_os}-${node_label_micro_architecture}:${build_number} From ad185b526d3a3baa209d44a8b374e3eeccd79d57 Mon Sep 17 00:00:00 2001 From: Jiri Date: Tue, 30 Jul 2024 18:04:27 +0200 Subject: [PATCH 08/22] Honour JAVA_TOOLS_OPTIONS in external tests --- external/dockerfile_functions.sh | 6 +++--- external/jenkins/test.sh | 4 ++-- external/scala/test.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/external/dockerfile_functions.sh b/external/dockerfile_functions.sh index dd5108325e..8c4e2290db 100755 --- a/external/dockerfile_functions.sh +++ b/external/dockerfile_functions.sh @@ -198,11 +198,11 @@ print_jdk_install() { "\n\t PATH=\"/opt/java/openjdk/bin:\$PATH\" " \ "\n" >> ${file} - echo -e "\nENV JAVA_TOOL_OPTIONS=\"-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle\" " \ + echo -e "\nENV JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS -XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle\" " \ "\n" >> ${file} echo -e "\nENV RANDFILE=/tmp/.rnd \\" \ - "\n\t OPENJ9_JAVA_OPTIONS=\"-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Dosgi.checkConfiguration=false\" " \ + "\n\t OPENJ9_JAVA_OPTIONS=\"$OPENJ9_JAVA_OPTIONS -XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Dosgi.checkConfiguration=false\" " \ "\n" >> ${file} } @@ -446,7 +446,7 @@ print_maven_install() { print_java_tool_options() { local file=$1 - echo -e "ENV JAVA_TOOL_OPTIONS=\"-Dfile.encoding=UTF8 -Djava.security.egd=file:/dev/./urandom\"\n" >> ${file} + echo -e "ENV JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 -Djava.security.egd=file:/dev/./urandom\"\n" >> ${file} } print_environment_variable() { diff --git a/external/jenkins/test.sh b/external/jenkins/test.sh index a78b9054df..c7dc1a0754 100644 --- a/external/jenkins/test.sh +++ b/external/jenkins/test.sh @@ -16,7 +16,7 @@ source $(dirname "$0")/test_base_functions.sh # Set up Java to be used by the jenkins test echo_setup -export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" +export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8" #begin jenkins test set -e @@ -29,4 +29,4 @@ echo "Run jenkins test phase alone with cmd: \"mvn surefire:test\"" && \ mvn --batch-mode surefire:test -Denforcer.fail=false test_exit_code=$? find ./ -type d -name 'surefire-reports' -exec cp -r "{}" /testResults \; -exit $test_exit_code \ No newline at end of file +exit $test_exit_code diff --git a/external/scala/test.sh b/external/scala/test.sh index fb2d2b40a1..322405c426 100644 --- a/external/scala/test.sh +++ b/external/scala/test.sh @@ -17,7 +17,7 @@ source $(dirname "$0")/test_base_functions.sh echo_setup TEST_SUITE=$1 -export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" +export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8" #begin scala test set -e @@ -27,4 +27,4 @@ sbt -Dsbt.log.noformat=true "scala -version" echo "Begin to execute Scala test with cmd: sbt \"partest $TEST_SUITE\"" && \ sbt -Dsbt.log.noformat=true "partest --terse $TEST_SUITE" -set +e \ No newline at end of file +set +e From 0e7384ebc0a4131e9cd8a12bf75000cff9240ad1 Mon Sep 17 00:00:00 2001 From: judovana Date: Wed, 31 Jul 2024 09:29:25 +0200 Subject: [PATCH 09/22] recognizes->recognizes Co-authored-by: Martijn Verburg --- external/provider.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/provider.sh b/external/provider.sh index 458ed1d36f..2ff0000042 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -17,7 +17,7 @@ ################################################################### ## This script is walking through all external tests ## ## and is determining what virtualisation to use ## -## It recognize two environemnt variables: ## +## It recognizes two environment variables: ## ## EXTERNAL_AQA_RUNNER=docker/podman/... ## ## EXTERNAL_AQA_SUDO=sudo//runas ## ## ## From b185c9ae08ff25dbdc0fcd9b142a33c73250b87a Mon Sep 17 00:00:00 2001 From: judovana Date: Wed, 31 Jul 2024 09:29:52 +0200 Subject: [PATCH 10/22] determining/determines Co-authored-by: Martijn Verburg --- external/provider.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/provider.sh b/external/provider.sh index 2ff0000042..97c8b519f3 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -16,7 +16,7 @@ ################################################################### ## This script is walking through all external tests ## -## and is determining what virtualisation to use ## +## and determines which virtualisation to use ## ## It recognizes two environment variables: ## ## EXTERNAL_AQA_RUNNER=docker/podman/... ## ## EXTERNAL_AQA_SUDO=sudo//runas ## From aa38d1c770910712db2c2361fecc3fc270e69273 Mon Sep 17 00:00:00 2001 From: judovana Date: Wed, 31 Jul 2024 09:30:09 +0200 Subject: [PATCH 11/22] walking/walks Co-authored-by: Martijn Verburg --- external/provider.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/provider.sh b/external/provider.sh index 97c8b519f3..477613786f 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -15,7 +15,7 @@ ################################################################### -## This script is walking through all external tests ## +## This script walks through all external tests ## ## and determines which virtualisation to use ## ## It recognizes two environment variables: ## ## EXTERNAL_AQA_RUNNER=docker/podman/... ## From db8f89142db3d84636058f751062b1413fe73a43 Mon Sep 17 00:00:00 2001 From: judovana Date: Wed, 31 Jul 2024 09:31:02 +0200 Subject: [PATCH 12/22] Dropped `If used, you are on your own.` But afaict it should be there... Co-authored-by: Martijn Verburg --- external/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/README.md b/external/README.md index 3216d21c55..4a060efdf0 100644 --- a/external/README.md +++ b/external/README.md @@ -18,7 +18,7 @@ which defaults to nothing ``` EXTERNAL_AQA_CLEAN=true/false ``` -If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. If used, you are on your own. +If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. ## Running External tests locally From 0fe0ffa491b8cf64199e57b5d1670fedd24793f4 Mon Sep 17 00:00:00 2001 From: judovana Date: Wed, 31 Jul 2024 09:31:13 +0200 Subject: [PATCH 13/22] Update external/README.md Co-authored-by: Martijn Verburg --- external/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/README.md b/external/README.md index 4a060efdf0..51900496dc 100644 --- a/external/README.md +++ b/external/README.md @@ -8,7 +8,7 @@ The toolchain understands two environment variables: ``` EXTERNAL_AQA_RUNNER=docker/podman/... ``` -defaults to podman if podman is installed otherwise to docker +defaults to podman if podman is installed, otherwise to docker and ``` From 28f5347f66dc40084ce4496059578a9a50ea5e3d Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 31 Jul 2024 09:49:33 +0200 Subject: [PATCH 14/22] nothing->empty string --- external/README.md | 2 +- external/provider.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/README.md b/external/README.md index 51900496dc..e839c5e44b 100644 --- a/external/README.md +++ b/external/README.md @@ -14,7 +14,7 @@ and ``` EXTERNAL_AQA_SUDO=sudo//runas ``` -which defaults to nothing +which defaults to empty string ``` EXTERNAL_AQA_CLEAN=true/false ``` diff --git a/external/provider.sh b/external/provider.sh index 477613786f..44543fcd09 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -23,7 +23,7 @@ ## ## ## EXTERNAL_AQA_RUNNER defaults to podman if podman is installed ## ## otherwise to docker ## -## EXTERNAL_AQA_SUDO defaults to nothing ## +## EXTERNAL_AQA_SUDO defaults to empty string ## ################################################################### if [ -z "${EXTERNAL_AQA_RUNNER}" ]; then From 3980cc327f993284ed369f441406d59842b54972 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 31 Jul 2024 09:51:37 +0200 Subject: [PATCH 15/22] Used | isntead of / for exemplar values --- external/README.md | 6 +++--- external/provider.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external/README.md b/external/README.md index e839c5e44b..bea2519f7a 100644 --- a/external/README.md +++ b/external/README.md @@ -6,17 +6,17 @@ Third Party container tests help verify that the adoptium binaries are *good* by The toolchain understands two environment variables: ``` -EXTERNAL_AQA_RUNNER=docker/podman/... +EXTERNAL_AQA_RUNNER=docker|podman|... ``` defaults to podman if podman is installed, otherwise to docker and ``` -EXTERNAL_AQA_SUDO=sudo//runas +EXTERNAL_AQA_SUDO=sudo||runas ``` which defaults to empty string ``` -EXTERNAL_AQA_CLEAN=true/false +EXTERNAL_AQA_CLEAN=true|false ``` If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. diff --git a/external/provider.sh b/external/provider.sh index 44543fcd09..cde8984f75 100755 --- a/external/provider.sh +++ b/external/provider.sh @@ -18,8 +18,8 @@ ## This script walks through all external tests ## ## and determines which virtualisation to use ## ## It recognizes two environment variables: ## -## EXTERNAL_AQA_RUNNER=docker/podman/... ## -## EXTERNAL_AQA_SUDO=sudo//runas ## +## EXTERNAL_AQA_RUNNER=docker|podman|... ## +## EXTERNAL_AQA_SUDO=sudo||runas ## ## ## ## EXTERNAL_AQA_RUNNER defaults to podman if podman is installed ## ## otherwise to docker ## From b17176054d50d4aa8d0645686dcdf96d17a70572 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 31 Jul 2024 11:19:16 +0200 Subject: [PATCH 16/22] Small debugging nit --- external/external.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/external/external.sh b/external/external.sh index fcc005a35d..14c9db2d80 100755 --- a/external/external.sh +++ b/external/external.sh @@ -444,6 +444,7 @@ if [ "${command_type}" == "clean" ] ; then test="$(echo ${EXTERNAL_CUSTOM_REPO} | awk -F'/' '{print $NF}' | sed 's/.git//g')" fi if [ "${EXTERNAL_AQA_CLEAN}" == "false" ] ; then + echo "to debug, put '-i --entrypoint /bin/bash' before container name" container_rm="echo to clean, run manually: $container_rm" container_rmi="echo to clean, run manually: $container_rmi" fi From 373dfb8f650163677b9d68178a16269894cbebd0 Mon Sep 17 00:00:00 2001 From: Jiri Date: Fri, 9 Aug 2024 21:28:34 +0200 Subject: [PATCH 17/22] Improved readme in docker x podman context --- external/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/external/README.md b/external/README.md index bea2519f7a..6ea11446d1 100644 --- a/external/README.md +++ b/external/README.md @@ -1,6 +1,6 @@ # External (Third Party Container) Tests -Third Party container tests help verify that the adoptium binaries are *good* by running a variety of Java applications inside of Docker containers. adoptium/aqa-tests/[Issue #172](https://github.com/adoptium/aqa-tests/issues/172) lists the applications that we have initially targeted to best exercise the adoptium binaries. For each application, we choose to run a selection of their functional tests. +Third Party container tests help verify that the adoptium binaries are *good* by running a variety of Java applications inside of containers. adoptium/aqa-tests/[Issue #172](https://github.com/adoptium/aqa-tests/issues/172) lists the applications that we have initially targeted to best exercise the adoptium binaries. For each application, we choose to run a selection of their functional tests. ## Podman, docker and others. Sudo, runas and others @@ -24,7 +24,7 @@ If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _t ## Running External tests locally To run any AQA tests locally, you follow the same pattern: -0. Ensure your test machine is set up with [test prereqs](https://github.com/adoptium/aqa-tests/blob/master/doc/Prerequisites.md). For external tests, you do need Docker installed. +0. Ensure your test machine is set up with [test prereqs](https://github.com/adoptium/aqa-tests/blob/master/doc/Prerequisites.md). For external tests, you do need Docker or Podman installed. 1. Download/unpack the SDK that you want to test to your test machine 1. `export TEST_JDK_HOME=` @@ -46,8 +46,8 @@ See the [roadmap](https://github.com/adoptium/aqa-tests/tree/master/external#roa ### Roadmap Our next steps to improve and expand this set of external tests is divided into 2 categories: #### Technical Goals -- Verify the docker images that the project produces -- Copy results from Docker container for easier viewing and triage in Jenkins +- Verify the container images that the project produces +- Copy results from container for easier viewing and triage in Jenkins - Quick compare view, easy comparison of how different implementations stack up - Parallel testing (to improve execution time) - Startup-only testing (application startup, but not full runs of app functional testing) @@ -80,7 +80,7 @@ There are 4 common triage scenarios, with associated appropriate actions to take - Replace the example command line at the bottom of this script with the initial command lines that trigger execution of your test. **build.xml** -- Update the distribution folder paths, docker image name etc according to the name of your application. +- Update the distribution folder paths, container image name etc according to the name of your application. **playlist.xml** - Update the name of the example test case to the actual test case of the third party application that you intend to run. From 9490c8e9212cbfc626ee11d48cd30c961fd8dcb5 Mon Sep 17 00:00:00 2001 From: Jiri Date: Mon, 12 Aug 2024 15:17:17 +0200 Subject: [PATCH 18/22] Removed smuggled in java_tool_options --- external/dockerfile_functions.sh | 6 +++--- external/jenkins/test.sh | 2 +- external/scala/test.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/external/dockerfile_functions.sh b/external/dockerfile_functions.sh index 8c4e2290db..dd5108325e 100755 --- a/external/dockerfile_functions.sh +++ b/external/dockerfile_functions.sh @@ -198,11 +198,11 @@ print_jdk_install() { "\n\t PATH=\"/opt/java/openjdk/bin:\$PATH\" " \ "\n" >> ${file} - echo -e "\nENV JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS -XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle\" " \ + echo -e "\nENV JAVA_TOOL_OPTIONS=\"-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle\" " \ "\n" >> ${file} echo -e "\nENV RANDFILE=/tmp/.rnd \\" \ - "\n\t OPENJ9_JAVA_OPTIONS=\"$OPENJ9_JAVA_OPTIONS -XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Dosgi.checkConfiguration=false\" " \ + "\n\t OPENJ9_JAVA_OPTIONS=\"-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Dosgi.checkConfiguration=false\" " \ "\n" >> ${file} } @@ -446,7 +446,7 @@ print_maven_install() { print_java_tool_options() { local file=$1 - echo -e "ENV JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8 -Djava.security.egd=file:/dev/./urandom\"\n" >> ${file} + echo -e "ENV JAVA_TOOL_OPTIONS=\"-Dfile.encoding=UTF8 -Djava.security.egd=file:/dev/./urandom\"\n" >> ${file} } print_environment_variable() { diff --git a/external/jenkins/test.sh b/external/jenkins/test.sh index c7dc1a0754..5e326a2c82 100644 --- a/external/jenkins/test.sh +++ b/external/jenkins/test.sh @@ -16,7 +16,7 @@ source $(dirname "$0")/test_base_functions.sh # Set up Java to be used by the jenkins test echo_setup -export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8" +export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" #begin jenkins test set -e diff --git a/external/scala/test.sh b/external/scala/test.sh index 322405c426..82d76690bb 100644 --- a/external/scala/test.sh +++ b/external/scala/test.sh @@ -17,7 +17,7 @@ source $(dirname "$0")/test_base_functions.sh echo_setup TEST_SUITE=$1 -export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -Dfile.encoding=UTF8" +export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" #begin scala test set -e From 726ac879fa62777b44ecc908a6ad4ab7c36c59c0 Mon Sep 17 00:00:00 2001 From: Jiri Date: Mon, 12 Aug 2024 15:19:54 +0200 Subject: [PATCH 19/22] Reset end of file --- external/jenkins/test.sh | 2 +- external/scala/test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/jenkins/test.sh b/external/jenkins/test.sh index 5e326a2c82..a78b9054df 100644 --- a/external/jenkins/test.sh +++ b/external/jenkins/test.sh @@ -29,4 +29,4 @@ echo "Run jenkins test phase alone with cmd: \"mvn surefire:test\"" && \ mvn --batch-mode surefire:test -Denforcer.fail=false test_exit_code=$? find ./ -type d -name 'surefire-reports' -exec cp -r "{}" /testResults \; -exit $test_exit_code +exit $test_exit_code \ No newline at end of file diff --git a/external/scala/test.sh b/external/scala/test.sh index 82d76690bb..fb2d2b40a1 100644 --- a/external/scala/test.sh +++ b/external/scala/test.sh @@ -27,4 +27,4 @@ sbt -Dsbt.log.noformat=true "scala -version" echo "Begin to execute Scala test with cmd: sbt \"partest $TEST_SUITE\"" && \ sbt -Dsbt.log.noformat=true "partest --terse $TEST_SUITE" -set +e +set +e \ No newline at end of file From d9746b3955f90cf108e7535fe75fd53027029570 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 14 Aug 2024 19:28:16 +0200 Subject: [PATCH 20/22] Renamed EXTERNAL_AQACLEAN -> EXTERNAL_AQA_CONTAIER_CLEAN --- external/README.md | 4 ++-- external/external.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/external/README.md b/external/README.md index 6ea11446d1..4b728ac2a5 100644 --- a/external/README.md +++ b/external/README.md @@ -16,9 +16,9 @@ EXTERNAL_AQA_SUDO=sudo||runas ``` which defaults to empty string ``` -EXTERNAL_AQA_CLEAN=true|false +EXTERNAL_AQA_CONTAIER_CLEAN=true|false ``` -If EXTERNAL_AQA_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. +If EXTERNAL_AQA_CONTAIER_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. ## Running External tests locally diff --git a/external/external.sh b/external/external.sh index 14c9db2d80..f030a5aa76 100755 --- a/external/external.sh +++ b/external/external.sh @@ -443,7 +443,7 @@ if [ "${command_type}" == "clean" ] ; then if [[ ${test} == 'external_custom' ]]; then test="$(echo ${EXTERNAL_CUSTOM_REPO} | awk -F'/' '{print $NF}' | sed 's/.git//g')" fi - if [ "${EXTERNAL_AQA_CLEAN}" == "false" ] ; then + if [ "${EXTERNAL_AQA_CONTAIER_CLEAN}" == "false" ] ; then echo "to debug, put '-i --entrypoint /bin/bash' before container name" container_rm="echo to clean, run manually: $container_rm" container_rmi="echo to clean, run manually: $container_rmi" From 4efc2ea80ae71a8e8980b609507ddc7e244272d9 Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 14 Aug 2024 20:22:41 +0200 Subject: [PATCH 21/22] Rneamned EXTERNAL_AQA_CONTAIER_CLEAN->EXTERNAL_AQA_CONTAINER_CLEAN --- external/README.md | 4 ++-- external/external.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/external/README.md b/external/README.md index 4b728ac2a5..b7f97caae4 100644 --- a/external/README.md +++ b/external/README.md @@ -16,9 +16,9 @@ EXTERNAL_AQA_SUDO=sudo||runas ``` which defaults to empty string ``` -EXTERNAL_AQA_CONTAIER_CLEAN=true|false +EXTERNAL_AQA_CONTAINER_CLEAN=true|false ``` -If EXTERNAL_AQA_CONTAIER_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. +If EXTERNAL_AQA_CONTAINER_CLEAN is false, then the image is not cleaned after the `make _tests...` targets are finished. ## Running External tests locally diff --git a/external/external.sh b/external/external.sh index f030a5aa76..1d8f14cac0 100755 --- a/external/external.sh +++ b/external/external.sh @@ -443,7 +443,7 @@ if [ "${command_type}" == "clean" ] ; then if [[ ${test} == 'external_custom' ]]; then test="$(echo ${EXTERNAL_CUSTOM_REPO} | awk -F'/' '{print $NF}' | sed 's/.git//g')" fi - if [ "${EXTERNAL_AQA_CONTAIER_CLEAN}" == "false" ] ; then + if [ "${EXTERNAL_AQA_CONTAINER_CLEAN}" == "false" ] ; then echo "to debug, put '-i --entrypoint /bin/bash' before container name" container_rm="echo to clean, run manually: $container_rm" container_rmi="echo to clean, run manually: $container_rmi" From e986e072cc40580735c0a938bbf673e89e8a201f Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 15 Aug 2024 13:48:25 +0200 Subject: [PATCH 22/22] Removed in-buil.xml docekr command --- external/build.xml | 5 +++-- external/external.sh | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/external/build.xml b/external/build.xml index 17f79635c6..e7066291b1 100644 --- a/external/build.xml +++ b/external/build.xml @@ -62,8 +62,9 @@ - - + + + diff --git a/external/external.sh b/external/external.sh index 1d8f14cac0..80fbe2c220 100755 --- a/external/external.sh +++ b/external/external.sh @@ -61,7 +61,7 @@ imageArg="" usage () { - echo 'Usage : external.sh --dir TESTDIR --tag DOCKERIMAGE_TAG --version JDK_VERSION --impl JDK_IMPL [--docker_os docker_os][--platform PLATFORM] [--portable portable] [--node_name node_name] [--node_labels node_labels] [--docker_registry_required docker_registry_required] [--docker_registry_url DOCKER_REGISTRY_URL] [--docker_registry_dir DOCKER_REGISTRY_DIR] [--base_docker_registry_url baseDockerRegistryUrl] [--base_docker_registry_dir baseDockerRegistryDir] [--mount_jdk mount_jdk] [--test_root TEST_ROOT] [--reportsrc appReportDir] [--reportdst REPORTDIR] [--testtarget target] [--docker_args EXTRA_DOCKER_ARGS] [--build|--run|--load|--clean]' + echo 'Usage : external.sh --dir TESTDIR --tag DOCKERIMAGE_TAG --version JDK_VERSION --impl JDK_IMPL [--docker_os docker_os][--platform PLATFORM] [--portable portable] [--node_name node_name] [--node_labels node_labels] [--docker_registry_required docker_registry_required] [--docker_registry_url DOCKER_REGISTRY_URL] [--docker_registry_dir DOCKER_REGISTRY_DIR] [--base_docker_registry_url baseDockerRegistryUrl] [--base_docker_registry_dir baseDockerRegistryDir] [--mount_jdk mount_jdk] [--test_root TEST_ROOT] [--reportsrc appReportDir] [--reportdst REPORTDIR] [--testtarget target] [--docker_args EXTRA_DOCKER_ARGS] [--build|--run|--load|--clean|--prune]' } supported_tests="external_custom aot camel criu-functional criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tck-ubi-test tomcat tomee wildfly wycheproof netty spring" @@ -228,6 +228,9 @@ parseCommandLineArgs() { "--clean" | "-c" ) command_type=clean;; + "--prune" | "-p" ) + command_type=prune;; + "--help" | "-h" ) usage; exit 0;; @@ -453,3 +456,7 @@ if [ "${command_type}" == "clean" ] ; then $container_rmi -f ${docker_registry_url}/${docker_image_source_job_name}/${JDK_VERSION}-${JDK_IMPL}-${docker_os}-${platform}-${node_label_current_os}-${node_label_micro_architecture}:${build_number} $container_rmi -f ${docker_registry_url}/${docker_image_source_job_name}:${build_number} fi + +if [ "${command_type}" == "prune" ] ; then + $(getExternalImageCommand) system prune --all --force +fi