Skip to content

Commit

Permalink
ci-automation: add hetzner testing
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
  • Loading branch information
tormath1 committed Jul 22, 2024
1 parent dab06c5 commit f165746
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ci-automation/ci-config.env
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,10 @@ OPENSTACK_PARALLEL="${PARALLEL_TESTS:-3}"
: ${BRIGHTBOX_IMAGE_NAME:='flatcar_production_openstack_image.img'}
BRIGHTBOX_PARALLEL="${PARALLEL_TESTS:-1}"
: ${BRIGHTBOX_SERVER_TYPE:="2gb.ssd"}

# -- Hetzner --
: ${HETZNER_IMAGE_NAME:='flatcar_production_hetzner_image.bin.bz2'}
: ${HETZNER_amd64_INSTANCE_TYPE:="cx22"}
: ${HETZNER_arm64_INSTANCE_TYPE:="cax11"}
HETZNER_PARALLEL="${PARALLEL_TESTS:-1}"
HETZNER_LOCATION="${HETZNER_LOCATION:-fsn1}"
1 change: 1 addition & 0 deletions ci-automation/garbage_collect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function _garbage_collect_impl() {
--env VMWARE_ESX_CREDS \
--env OPENSTACK_CREDS \
--env BRIGHTBOX_CLIENT_ID --env BRIGHTBOX_CLIENT_SECRET \
--env HETZNER_TOKEN \
-w /work -v "$PWD":/work "${mantle_ref}" /work/ci-automation/garbage_collect_cloud.sh

echo
Expand Down
2 changes: 2 additions & 0 deletions ci-automation/garbage_collect_cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ timeout --signal=SIGQUIT 60m ore openstack gc --duration 6h \
--config-file=<(echo "${OPENSTACK_CREDS}" | base64 --decode)
timeout --signal=SIGQUIT 60m ore brightbox gc --duration 6h \
--brightbox-client-id="${BRIGHTBOX_CLIENT_ID}" --brightbox-client-secret="${BRIGHTBOX_CLIENT_SECRET}"
timeout --signal=SIGQUIT 60m ore hetzner gc --duration 6h \
--hetzner-token="${HETZNER_TOKEN}"
secret_to_file aws_credentials_config_file "${AWS_CREDENTIALS}"
for channel in alpha beta stable lts; do
for arch in amd64 arm64; do
Expand Down
46 changes: 46 additions & 0 deletions ci-automation/vendor-testing/hetzner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Copyright (c) 2023 The Flatcar Maintainers.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

set -euo pipefail

# Test execution script for the Hetzner vendor.
# This script is supposed to run in the mantle container.

source ci-automation/vendor_test.sh

hetzner_instance_type_var="HETZNER_${CIA_ARCH}_INSTANCE_TYPE"
hetzner_instance_type="${!hetzner_instance_type_var}"

# HETZNER_TOKEN should be provided by sdk_container/.env

# Upload the image on Hetzner.
IMAGE_ID=$(ore hetzner \
--hetzner-token="${HETZNER_TOKEN}" \
--hetzner-location="${HETZNER_LOCATION}" \
create-image \
--board="${CIA_ARCH}-usr" \
--name flatcar-"${CIA_VERNUM}" \
--file="https://${BUILDCACHE_SERVER}/images/${CIA_ARCH}/${CIA_VERNUM}/${HETZNER_IMAGE_NAME}"
)

kola_test_basename="ci-${CIA_VERNUM//+/-}"
kola_test_basename="${kola_test_basename//[+.]/-}"

set -x

timeout --signal=SIGQUIT 2h kola run \
--board="${CIA_ARCH}-usr" \
--parallel="${BRIGHTBOX_PARALLEL}" \
--tapfile="${CIA_TAPFILE}" \
--channel="${CIA_CHANNEL}" \
--basename="${kola_test_basename}" \
--platform=hetzner \
--hetzner-token="${HETZNER_TOKEN}" \
--hetzner-server-type="${hetzner_instance_type}" \
--hetzner-location="${HETZNER_LOCATION}" \
--hetzner-image=${IMAGE_ID}
"${@}"

set +x

0 comments on commit f165746

Please sign in to comment.