ci-automation: Use vendor_test.sh in equinix_metal and gce tests

This commit is contained in:
Krzesimir Nowak 2022-05-05 13:07:52 +02:00
parent 1d6f38a72e
commit d26f2b3b39
2 changed files with 28 additions and 59 deletions

View File

@ -6,38 +6,24 @@
set -euo pipefail
# Test execution script for the Equinix Metal vendor image.
# This script is supposed to run in the SDK container.
# This script is supposed to run in the mantle container.
# This script requires "pxe" Jenkins job.
work_dir="$1"; shift
arch="$1"; shift
vernum="$1"; shift
tapfile="$1"; shift
# $@ now contains tests / test patterns to run
source ci-automation/ci_automation_common.sh
# required for get_git_channel
source sdk_lib/sdk_container_common.sh
channel="$(get_git_channel)"
mkdir -p "${work_dir}"
cd "${work_dir}"
source ci-automation/vendor_test.sh
# Equinix Metal ARM server are not yet hourly available in the default `SV` metro
equinixmetal_metro_var="EQUINIXMETAL_${arch}_METRO"
equinixmetal_metro_var="EQUINIXMETAL_${CIA_ARCH}_METRO"
equinixmetal_metro="${!equinixmetal_metro_var}"
EQUINIXMETAL_INSTANCE_TYPE_VAR="EQUINIXMETAL_${arch}_INSTANCE_TYPE"
EQUINIXMETAL_INSTANCE_TYPE_VAR="EQUINIXMETAL_${CIA_ARCH}_INSTANCE_TYPE"
EQUINIXMETAL_INSTANCE_TYPE="${!EQUINIXMETAL_INSTANCE_TYPE_VAR}"
MORE_INSTANCE_TYPES_VAR="EQUINIXMETAL_${arch}_MORE_INSTANCE_TYPES"
MORE_INSTANCE_TYPES_VAR="EQUINIXMETAL_${CIA_ARCH}_MORE_INSTANCE_TYPES"
MORE_INSTANCE_TYPES=( ${!MORE_INSTANCE_TYPES_VAR} )
# The maximum is 6h coming from the ore GC duration parameter
timeout=6h
BASE_URL="http://${BUILDCACHE_SERVER}/images/${arch}/${vernum}"
BASE_URL="http://${BUILDCACHE_SERVER}/images/${CIA_ARCH}/${CIA_VERNUM}"
run_equinix_metal_kola_test() {
local instance_type="${1}"
@ -45,12 +31,12 @@ run_equinix_metal_kola_test() {
timeout --signal=SIGQUIT "${timeout}" \
kola run \
--board="${arch}-usr" \
--basename="ci-${vernum/+/-}" \
--board="${CIA_ARCH}-usr" \
--basename="ci-${CIA_VERNUM/+/-}" \
--platform=equinixmetal \
--tapfile="${instance_tapfile}" \
--parallel="${EQUINIXMETAL_PARALLEL}" \
--torcx-manifest=../torcx_manifest.json \
--torcx-manifest="${CIA_TORCX_MANIFEST}" \
--equinixmetal-image-url="${BASE_URL}/${EQUINIXMETAL_IMAGE_NAME}" \
--equinixmetal-installer-image-kernel-url="${BASE_URL}/${PXE_KERNEL_NAME}" \
--equinixmetal-installer-image-cpio-url="${BASE_URL}/${PXE_IMAGE_NAME}" \
@ -109,11 +95,11 @@ fi
ARGS="$*"
if [[ -n "${ARGS// }" ]]; then
set -x
run_equinix_metal_kola_test "${EQUINIXMETAL_INSTANCE_TYPE}" "${tapfile}" "${@}"
run_equinix_metal_kola_test "${EQUINIXMETAL_INSTANCE_TYPE}" "${CIA_TAPFILE}" "${@}"
set +x
fi
if [[ "${run_more_tests}" -eq 1 ]]; then
wait
cat validate_*.tap >>"${tapfile}"
cat validate_*.tap >>"${CIA_TAPFILE}"
fi

View File

@ -8,60 +8,43 @@ set -euo pipefail
# Test execution script for the GCE vendor image.
# This script is supposed to run in the mantle container.
work_dir="$1"; shift
arch="$1"; shift
vernum="$1"; shift
tapfile="$1"; shift
# $@ now contains tests / test patterns to run
source ci-automation/ci_automation_common.sh
source sdk_lib/sdk_container_common.sh
mkdir -p "${work_dir}"
cd "${work_dir}"
source ci-automation/vendor_test.sh
# We never run GCE on arm64, so for now fail it as an
# unsupported option.
if [[ "${arch}" == "arm64" ]]; then
echo "1..1" > "${tapfile}"
echo "not ok - all GCE tests" >> "${tapfile}"
echo " ---" >> "${tapfile}"
echo " ERROR: ARM64 tests not supported on GCE." | tee -a "${tapfile}"
echo " ..." >> "${tapfile}"
if [[ "${CIA_ARCH}" == "arm64" ]]; then
echo "1..1" > "${CIA_TAPFILE}"
echo "not ok - all GCE tests" >> "${CIA_TAPFILE}"
echo " ---" >> "${CIA_TAPFILE}"
echo " ERROR: ARM64 tests not supported on GCE." | tee -a "${CIA_TAPFILE}"
echo " ..." >> "${CIA_TAPFILE}"
exit 1
fi
channel="$(get_git_channel)"
if [[ "${channel}" = 'developer' ]]; then
channel='alpha'
fi
testscript="$(basename "$0")"
# Create temp file and delete it immediately
echo "${GCP_JSON_KEY}" | base64 --decode > /tmp/gcp_auth
exec {gcp_auth}</tmp/gcp_auth
rm /tmp/gcp_auth
GCP_JSON_KEY_PATH="/proc/$$/fd/${gcp_auth}"
copy_from_buildcache "images/${arch}/${vernum}/${GCE_IMAGE_NAME}" .
copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/${GCE_IMAGE_NAME}" .
gcloud auth activate-service-account --key-file "${GCP_JSON_KEY_PATH}"
gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${arch}-usr/${vernum}" || true
gsutil cp "${GCE_IMAGE_NAME}" "${GCE_GCS_IMAGE_UPLOAD}/${arch}-usr/${vernum}/${GCE_IMAGE_NAME}"
gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${CIA_ARCH}-usr/${CIA_VERNUM}" || true
gsutil cp "${GCE_IMAGE_NAME}" "${GCE_GCS_IMAGE_UPLOAD}/${CIA_ARCH}-usr/${CIA_VERNUM}/${GCE_IMAGE_NAME}"
family="ci"
image_name="${family}-${vernum//[+.]/-}"
image_name="${family}-${CIA_VERNUM//[+.]/-}"
ore gcloud delete-images --json-key="${GCP_JSON_KEY_PATH}" "${image_name}" || true
ore gcloud create-image \
--board="${arch}-usr" \
--board="${CIA_ARCH}-usr" \
--family="${family}" \
--json-key="${GCP_JSON_KEY_PATH}" \
--source-root="${GCE_GCS_IMAGE_UPLOAD}" \
--source-name="${GCE_IMAGE_NAME}" \
--version="${vernum}"
--version="${CIA_VERNUM}"
trap 'ore gcloud delete-images \
--json-key="${GCP_JSON_KEY_PATH}" \
"${image_name}" ; gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${arch}-usr/${vernum}" || true' EXIT
"${image_name}" ; gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${CIA_ARCH}-usr/${CIA_VERNUM}" || true' EXIT
set -x
@ -73,9 +56,9 @@ timeout --signal=SIGQUIT 6h \
--gce-machinetype="${GCE_MACHINE_TYPE}" \
--parallel="${GCE_PARALLEL}" \
--platform=gce \
--channel="${channel}" \
--tapfile="${tapfile}" \
--torcx-manifest='../torcx_manifest.json' \
--channel="${CIA_CHANNEL}" \
--tapfile="${CIA_TAPFILE}" \
--torcx-manifest="${CIA_TORCX_MANIFEST}" \
"${@}"
set +x