Skip to content

Commit cacd234

Browse files
authored
Merge pull request AdoptOpenJDK#574 from dinogun/openj9_aarch64_fix
Only build images and create manifests for the right arches
2 parents 0003a02 + 9c8482e commit cacd234

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

build_latest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ do
405405
# Check if the VM is supported for the current arch
406406
shasums="${package}"_"${vm}"_"${version}"_"${build}"_sums
407407
build_time="${package}"_"${vm}"_"${version}"_"${build}"_build_time
408-
sup=$(vm_supported_onarch "${vm}" "${shasums}")
408+
sup=$(vm_supported_onarch_config "${vm}" "${shasums}" "${version}" "${package}" "${os}")
409409
if [ -z "${sup}" ]; then
410410
continue;
411411
fi

common_functions.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,30 @@ function get_arches() {
205205

206206
# Check if the given VM is supported on the current architecture.
207207
# This is based on the hotspot_shasums_latest.sh/openj9_shasums_latest.sh
208-
function vm_supported_onarch() {
208+
# along with arches present in config/${vm}.config
209+
function vm_supported_onarch_config() {
209210
local vm=$1
210211
local sums=$2
212+
local version=$3
213+
local pkg=$4
214+
local os=$5
215+
local test_arch
211216

212-
if [ -n "$3" ]; then
213-
test_arch=$3;
217+
if [ -n "$6" ]; then
218+
test_arch=$6;
214219
else
215220
test_arch=$(uname -m)
216221
fi
217222

218-
local suparches=$(get_arches "${sums}")
219-
local sup=$(echo "${suparches}" | grep "${test_arch}")
223+
# First get the arches for which the builds are available as per shasums file
224+
local sup_arches_for_build=$(get_arches "${sums}" | sort | uniq)
225+
# Next, check the arches that are supported for the underlying OS as per config file
226+
local sup_arches_for_os=$(parse_vm_entry "${vm}" "${version}" "${pkg}" "${os}" "Architectures:")
227+
# Now the actual arches are the intersection of the above two
228+
local merge_arches="${sup_arches_for_build} ${sup_arches_for_os}"
229+
local supported_arches=$(echo ${merge_arches} | tr ' ' '\n' | sort | uniq -d)
230+
231+
local sup=$(echo "${supported_arches}" | grep "${test_arch}")
220232
echo "${sup}"
221233
}
222234

@@ -356,7 +368,7 @@ function build_tags() {
356368
fi
357369
# Check if all the supported arches are available for this build.
358370
# shellcheck disable=SC2154 #declared externally
359-
supported=$(vm_supported_onarch "${vm}" "${shasums}" "${arch}")
371+
supported=$(vm_supported_onarch_config "${vm}" "${shasums}" "${ver}" "${pkg}" "${os}" "${arch}")
360372
if [ -z "${supported}" ]; then
361373
continue;
362374
fi

generate_manifest_script.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ function print_manifest_cmd() {
8484
function print_tags() {
8585
local repo="$1"
8686
local img_list=""
87+
88+
# Nothing to do if arch tags is empty
89+
if [ -z "${arch_tags}" ]; then
90+
return;
91+
fi
92+
8793
# Check if all the individual docker images exist for each expected arch
8894
for arch_tag in ${arch_tags}
8995
do

update_multiarch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ do
5757
fi
5858
# Check if the VM is supported for the current arch
5959
shasums="${package}"_"${vm}"_"${version}"_"${build}"_sums
60-
sup=$(vm_supported_onarch "${vm}" "${shasums}")
60+
sup=$(vm_supported_onarch_config "${vm}" "${shasums}" "${version}" "${package}" "${os}")
6161
if [ -z "${sup}" ]; then
6262
continue;
6363
fi

0 commit comments

Comments
 (0)