Skip to content

Commit

Permalink
Remove check_version in common_functions.sh
Browse files Browse the repository at this point in the history
- remove check_version function
- remove set_version function

Signed-off-by: Anna Babu Palathingal <[email protected]>
  • Loading branch information
annaibm committed Jan 30, 2024
1 parent 9abb319 commit 250c729
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 86 deletions.
29 changes: 13 additions & 16 deletions external/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,24 @@ cleanup_images
# Loop through all possible images
for test in ${supported_tests}
do
for version in ${supported_versions}
for vm in ${supported_jvms}
do
for vm in ${supported_jvms}
for os in ${supported_os}
do
for os in ${supported_os}
for package in ${supported_packages}
do
for package in ${supported_packages}
for build in ${supported_builds}
do
for build in ${supported_builds}
do
echo "==============================================================================="
echo " "
echo " Building Docker Images for ${test} ${version} ${vm} ${os} ${package} ${build} "
echo " "
echo "==============================================================================="
$(dirname "$0")/build_image.sh ${test} ${version} ${vm} ${os} ${package} ${build}
echo
echo
done
echo "==============================================================================="
echo " "
echo " Building Docker Images for ${test} ${vm} ${os} ${package} ${build} "
echo " "
echo "==============================================================================="
$(dirname "$0")/build_image.sh ${test} ${vm} ${os} ${package} ${build}
echo
echo
done
done
done
done
done
done
47 changes: 23 additions & 24 deletions external/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ source $(dirname "$0")/dockerfile_functions.sh
buildArg=""
container_build="docker build"

if [ $# -ne 9 ] && [ $# -ne 10 ]; then
if [ $# -ne 8 ] && [ $# -ne 9 ]; then
echo "The supported tests are ${supported_tests}"
echo
echo "usage: $0 test version vm os package build platform check_external_custom"
echo "test = ${supported_tests}"
echo "version = ${supported_versions}"
# echo "version = ${supported_versions}"
echo "vm = ${supported_jvms}"
echo "os = ${supported_os}"
echo "package = ${supported_packages}"
Expand All @@ -35,36 +35,35 @@ if [ $# -ne 9 ] && [ $# -ne 10 ]; then
echo "buildArg" = "Optional: customized image"
exit -1
fi
if [ $# -eq 10 ]; then
buildArg="--build-arg IMAGE=$10"
if [ $# -eq 9 ]; then
buildArg="--build-arg IMAGE=$9"
fi
check_external_custom=$9
check_external_custom=$8
if [[ "${check_external_custom}" == "0" ]]; then
set_test $1
fi
set_version $2
set_vm $3
set_os $4
set_package $5
set_build $6
set_platform $7
set_base_docker_registry_dir "$8"
set_vm $2
set_os $3
set_package $4
set_build $5
set_platform $6
set_base_docker_registry_dir "$7"

# Build the Docker image with the given repo, build, build type and tags.
function build_image() {
local file=$1
local test=$2
local version=$3
local vm=$4
local os=$5
local package=$6
local build=$7
local platform=$8
local buildArg=$9
# local version=$3
local vm=$3
local os=$4
local package=$5
local build=$6
local platform=$7
local buildArg=$8

echo "The test in the build_image() function is ${test}"
# Used for tagging the image
tags="adoptopenjdk-${test}-test:${version}-${package}-${os}-${vm}-${build}"
tags="adoptopenjdk-${test}-test:${package}-${os}-${vm}-${build}"
if [[ "$test" == *"criu"* ]]; then
container_build="sudo podman build"
fi
Expand All @@ -81,17 +80,17 @@ function build_image() {

# Handle making the directory for organizing the Dockerfiles
if [[ "${check_external_custom}" == "1" ]]; then
dir="$(realpath $(dirname "$0"))/external_custom/dockerfile/${version}/${package}/${os}"
dir="$(realpath $(dirname "$0"))/external_custom/dockerfile/${package}/${os}"
else
dir="$(realpath $(dirname "$0"))/${test}/dockerfile/${version}/${package}/${os}"
dir="$(realpath $(dirname "$0"))/${test}/dockerfile/${package}/${os}"
fi
mkdir -p ${dir}

# File Path to Dockerfile
file="${dir}/Dockerfile.${vm}.${build}"

# Generate Dockerfile
generate_dockerfile ${file} ${test} ${version} ${vm} ${os} ${package} ${build} ${platform} "${base_docker_registry_dir}" ${check_external_custom}
generate_dockerfile ${file} ${test} ${vm} ${os} ${package} ${build} ${platform} "${base_docker_registry_dir}" ${check_external_custom}

# Check if Dockerfile exists
if [ ! -f ${file} ]; then
Expand All @@ -100,4 +99,4 @@ if [ ! -f ${file} ]; then
fi

# Build Dockerfile that was generated
build_image ${file} ${test} ${version} ${vm} ${os} ${package} ${build} ${platform} "${buildArg}"
build_image ${file} ${test} ${vm} ${os} ${package} ${build} ${platform} "${buildArg}"
30 changes: 1 addition & 29 deletions external/common_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Supported versions
supported_versions="8 11 17 21 22"

# Supported JVMs
supported_jvms="hotspot openj9"

Expand All @@ -32,30 +28,6 @@ supported_builds="full"
# Supported tests
supported_tests="external_custom 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 tomcat tomee wildfly wycheproof netty spring zookeeper"

function check_version() {
version=$1

for current_version in ${supported_versions}
do
if [[ "${version}" == "${current_version}" ]]; then
return 1
fi
done

return 0
}

# Set a valid version
function set_version() {
version=$1

if (check_version ${version}); then
echo "ERROR: Invalid Version: ${version}"
echo "Usage: $0 [${supported_versions}]"
exit 1
fi
}

function check_os() {
os=$1

Expand Down Expand Up @@ -213,7 +185,7 @@ function set_test_info() {
check_external_custom_test=$2
cd ../
path_to_file=$(pwd)
echo ${path_to_file}
echo ${path_to_file}
PROPERTY_FILE=${path_to_file}/${test}/test.properties
github_url=$(getProperty "github_url")
test_options=$(getProperty "test_options")
Expand Down
34 changes: 17 additions & 17 deletions external/dockerfile_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ sanitize_test_names() {
print_image_args() {
local file=$1
local os=$2
local version=$3
local vm=$4
local package=$5
local build=$6
local base_docker_registry_dir="$7"
# local version=$3
local vm=$3
local package=$4
local build=$5
local base_docker_registry_dir="$6"

image_name="eclipse-temurin"
tag=""
if [[ "${package}" == "jre" ]]; then
tag="${version}-jre"
tag="jre"
else
tag="${version}-jdk"
tag="jdk"
fi
if [[ "${vm}" == "openj9" ]]; then
if [[ "${os}" == "ubuntu" ]]; then
Expand Down Expand Up @@ -459,7 +459,7 @@ print_test_files() {
local test=$2
local localPropertyFile=$3

if [[ "$check_external_custom_test" == "1" ]]; then
if [[ "$check_external_custom_test" == "1" ]]; then
echo -e "# This is the main script to run ${test} tests" \
"\nCOPY external_custom/test.sh /test.sh" \
"\nCOPY test_base_functions.sh test_base_functions.sh\n" >> ${file}
Expand Down Expand Up @@ -559,14 +559,14 @@ remove_trailing_spaces() {
generate_dockerfile() {
file=$1
test=$2
version=$3
vm=$4
os=$5
package=$6
build=$7
platform=$8
base_docker_registry_dir="$9"
check_external_custom_test=$10
# version=$3
vm=$3
os=$4
package=$5
build=$6
platform=$7
base_docker_registry_dir="$8"
check_external_custom_test=$9


if [[ "$check_external_custom_test" == "1" ]]; then
Expand All @@ -586,7 +586,7 @@ generate_dockerfile() {
echo -n "Writing ${file} ... "
print_legal ${file};
print_adopt_test ${file} ${test};
print_image_args ${file} ${os} ${version} ${vm} ${package} ${build} "${base_docker_registry_dir}";
print_image_args ${file} ${os} ${vm} ${package} ${build} "${base_docker_registry_dir}";
print_result_comment_arg ${file};
print_test_tag_arg ${file} ${test} ${tag_version};
print_${os}_pkg ${file} "${!packages}";
Expand Down

0 comments on commit 250c729

Please sign in to comment.