mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 22:12:10 +01:00
ci-automation: Use vendor_test.sh in equinix_metal and gce tests
This commit is contained in:
parent
1d6f38a72e
commit
d26f2b3b39
@ -6,38 +6,24 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Test execution script for the Equinix Metal vendor image.
|
# 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.
|
# This script requires "pxe" Jenkins job.
|
||||||
|
|
||||||
work_dir="$1"; shift
|
source ci-automation/vendor_test.sh
|
||||||
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}"
|
|
||||||
|
|
||||||
# Equinix Metal ARM server are not yet hourly available in the default `SV` metro
|
# 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_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}"
|
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} )
|
MORE_INSTANCE_TYPES=( ${!MORE_INSTANCE_TYPES_VAR} )
|
||||||
|
|
||||||
# The maximum is 6h coming from the ore GC duration parameter
|
# The maximum is 6h coming from the ore GC duration parameter
|
||||||
timeout=6h
|
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() {
|
run_equinix_metal_kola_test() {
|
||||||
local instance_type="${1}"
|
local instance_type="${1}"
|
||||||
@ -45,12 +31,12 @@ run_equinix_metal_kola_test() {
|
|||||||
|
|
||||||
timeout --signal=SIGQUIT "${timeout}" \
|
timeout --signal=SIGQUIT "${timeout}" \
|
||||||
kola run \
|
kola run \
|
||||||
--board="${arch}-usr" \
|
--board="${CIA_ARCH}-usr" \
|
||||||
--basename="ci-${vernum/+/-}" \
|
--basename="ci-${CIA_VERNUM/+/-}" \
|
||||||
--platform=equinixmetal \
|
--platform=equinixmetal \
|
||||||
--tapfile="${instance_tapfile}" \
|
--tapfile="${instance_tapfile}" \
|
||||||
--parallel="${EQUINIXMETAL_PARALLEL}" \
|
--parallel="${EQUINIXMETAL_PARALLEL}" \
|
||||||
--torcx-manifest=../torcx_manifest.json \
|
--torcx-manifest="${CIA_TORCX_MANIFEST}" \
|
||||||
--equinixmetal-image-url="${BASE_URL}/${EQUINIXMETAL_IMAGE_NAME}" \
|
--equinixmetal-image-url="${BASE_URL}/${EQUINIXMETAL_IMAGE_NAME}" \
|
||||||
--equinixmetal-installer-image-kernel-url="${BASE_URL}/${PXE_KERNEL_NAME}" \
|
--equinixmetal-installer-image-kernel-url="${BASE_URL}/${PXE_KERNEL_NAME}" \
|
||||||
--equinixmetal-installer-image-cpio-url="${BASE_URL}/${PXE_IMAGE_NAME}" \
|
--equinixmetal-installer-image-cpio-url="${BASE_URL}/${PXE_IMAGE_NAME}" \
|
||||||
@ -109,11 +95,11 @@ fi
|
|||||||
ARGS="$*"
|
ARGS="$*"
|
||||||
if [[ -n "${ARGS// }" ]]; then
|
if [[ -n "${ARGS// }" ]]; then
|
||||||
set -x
|
set -x
|
||||||
run_equinix_metal_kola_test "${EQUINIXMETAL_INSTANCE_TYPE}" "${tapfile}" "${@}"
|
run_equinix_metal_kola_test "${EQUINIXMETAL_INSTANCE_TYPE}" "${CIA_TAPFILE}" "${@}"
|
||||||
set +x
|
set +x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${run_more_tests}" -eq 1 ]]; then
|
if [[ "${run_more_tests}" -eq 1 ]]; then
|
||||||
wait
|
wait
|
||||||
cat validate_*.tap >>"${tapfile}"
|
cat validate_*.tap >>"${CIA_TAPFILE}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -8,60 +8,43 @@ set -euo pipefail
|
|||||||
# Test execution script for the GCE vendor image.
|
# Test execution script for the GCE vendor image.
|
||||||
# This script is supposed to run in the mantle container.
|
# This script is supposed to run in the mantle container.
|
||||||
|
|
||||||
work_dir="$1"; shift
|
source ci-automation/vendor_test.sh
|
||||||
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}"
|
|
||||||
|
|
||||||
# We never run GCE on arm64, so for now fail it as an
|
# We never run GCE on arm64, so for now fail it as an
|
||||||
# unsupported option.
|
# unsupported option.
|
||||||
if [[ "${arch}" == "arm64" ]]; then
|
if [[ "${CIA_ARCH}" == "arm64" ]]; then
|
||||||
echo "1..1" > "${tapfile}"
|
echo "1..1" > "${CIA_TAPFILE}"
|
||||||
echo "not ok - all GCE tests" >> "${tapfile}"
|
echo "not ok - all GCE tests" >> "${CIA_TAPFILE}"
|
||||||
echo " ---" >> "${tapfile}"
|
echo " ---" >> "${CIA_TAPFILE}"
|
||||||
echo " ERROR: ARM64 tests not supported on GCE." | tee -a "${tapfile}"
|
echo " ERROR: ARM64 tests not supported on GCE." | tee -a "${CIA_TAPFILE}"
|
||||||
echo " ..." >> "${tapfile}"
|
echo " ..." >> "${CIA_TAPFILE}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
channel="$(get_git_channel)"
|
|
||||||
if [[ "${channel}" = 'developer' ]]; then
|
|
||||||
channel='alpha'
|
|
||||||
fi
|
|
||||||
testscript="$(basename "$0")"
|
|
||||||
|
|
||||||
# Create temp file and delete it immediately
|
# Create temp file and delete it immediately
|
||||||
echo "${GCP_JSON_KEY}" | base64 --decode > /tmp/gcp_auth
|
echo "${GCP_JSON_KEY}" | base64 --decode > /tmp/gcp_auth
|
||||||
exec {gcp_auth}</tmp/gcp_auth
|
exec {gcp_auth}</tmp/gcp_auth
|
||||||
rm /tmp/gcp_auth
|
rm /tmp/gcp_auth
|
||||||
GCP_JSON_KEY_PATH="/proc/$$/fd/${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}"
|
gcloud auth activate-service-account --key-file "${GCP_JSON_KEY_PATH}"
|
||||||
gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${arch}-usr/${vernum}" || true
|
gsutil rm -r "${GCE_GCS_IMAGE_UPLOAD}/${CIA_ARCH}-usr/${CIA_VERNUM}" || true
|
||||||
gsutil cp "${GCE_IMAGE_NAME}" "${GCE_GCS_IMAGE_UPLOAD}/${arch}-usr/${vernum}/${GCE_IMAGE_NAME}"
|
gsutil cp "${GCE_IMAGE_NAME}" "${GCE_GCS_IMAGE_UPLOAD}/${CIA_ARCH}-usr/${CIA_VERNUM}/${GCE_IMAGE_NAME}"
|
||||||
family="ci"
|
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 delete-images --json-key="${GCP_JSON_KEY_PATH}" "${image_name}" || true
|
||||||
ore gcloud create-image \
|
ore gcloud create-image \
|
||||||
--board="${arch}-usr" \
|
--board="${CIA_ARCH}-usr" \
|
||||||
--family="${family}" \
|
--family="${family}" \
|
||||||
--json-key="${GCP_JSON_KEY_PATH}" \
|
--json-key="${GCP_JSON_KEY_PATH}" \
|
||||||
--source-root="${GCE_GCS_IMAGE_UPLOAD}" \
|
--source-root="${GCE_GCS_IMAGE_UPLOAD}" \
|
||||||
--source-name="${GCE_IMAGE_NAME}" \
|
--source-name="${GCE_IMAGE_NAME}" \
|
||||||
--version="${vernum}"
|
--version="${CIA_VERNUM}"
|
||||||
|
|
||||||
trap 'ore gcloud delete-images \
|
trap 'ore gcloud delete-images \
|
||||||
--json-key="${GCP_JSON_KEY_PATH}" \
|
--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
|
set -x
|
||||||
|
|
||||||
@ -73,9 +56,9 @@ timeout --signal=SIGQUIT 6h \
|
|||||||
--gce-machinetype="${GCE_MACHINE_TYPE}" \
|
--gce-machinetype="${GCE_MACHINE_TYPE}" \
|
||||||
--parallel="${GCE_PARALLEL}" \
|
--parallel="${GCE_PARALLEL}" \
|
||||||
--platform=gce \
|
--platform=gce \
|
||||||
--channel="${channel}" \
|
--channel="${CIA_CHANNEL}" \
|
||||||
--tapfile="${tapfile}" \
|
--tapfile="${CIA_TAPFILE}" \
|
||||||
--torcx-manifest='../torcx_manifest.json' \
|
--torcx-manifest="${CIA_TORCX_MANIFEST}" \
|
||||||
"${@}"
|
"${@}"
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user