mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 06:01:41 +02:00
ci-automation: Add WIP AWS test script for CI automation
This commit is contained in:
parent
2937db11e5
commit
76abe0d9cb
@ -102,3 +102,11 @@ DIGITALOCEAN_PARALLEL="${PARALLEL_TESTS:-8}"
|
||||
VMWARE_ESX_PARALLEL="${PARALLEL_TESTS:-4}"
|
||||
# VMWARE_ESX_CREDS should come from sdk_container/.env and must be
|
||||
# base64-encoded.
|
||||
|
||||
# -- AWS --
|
||||
|
||||
AWS_INSTANCE_TYPE="${AWS_INSTANCE_TYPE:-t3.small}"
|
||||
AWS_OFFER="${AWS_OFFER:-basic}"
|
||||
AWS_OEM_SUFFIX="_${AWS_OFFER}"
|
||||
AWS_IAM_PROFILE="${AWS_IAM_PROFILE:-ciauto-test}"
|
||||
AWS_REGION="${AWS_REGION:-us-east-1}"
|
||||
|
72
ci-automation/vendor-testing/aws.sh
Normal file
72
ci-automation/vendor-testing/aws.sh
Normal file
@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2022 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 qemu vendor image.
|
||||
# This script is supposed to run in the SDK container.
|
||||
|
||||
work_dir="$1"; shift
|
||||
arch="$1"; shift
|
||||
vernum="$1"; shift
|
||||
tapfile="$1"; shift
|
||||
|
||||
AWS_BOARD="${arch}-usr"
|
||||
AWS_CHANNEL="$(get_git_channel)"
|
||||
AWS_IMAGE_NAME="ci-${vernum}"
|
||||
|
||||
if [[ "${arch}" == "arm64-usr" ]]; then
|
||||
AWS_INSTANCE_TYPE="a1.large"
|
||||
fi
|
||||
|
||||
# $@ now contains tests / test patterns to run
|
||||
|
||||
source ci-automation/ci_automation_common.sh
|
||||
|
||||
mkdir -p "${work_dir}"
|
||||
cd "${work_dir}"
|
||||
|
||||
testscript="$(basename "$0")"
|
||||
|
||||
if [[ "${AWS_AMI_ID}" == "" ]]; then
|
||||
[ -s verify.asc ] && verify_key=--verify-key=verify.asc || verify_key=
|
||||
|
||||
echo "++++ ${testscript}: downloading flatcar_production_ami_vmdk${AWS_OEM_SUFFIX}_image.vmdk.bz2 for ${vernum} (${arch}) ++++"
|
||||
copy_from_buildcache "images/${arch}/${vernum}/flatcar_production_ami_vmdk${AWS_OEM_SUFFIX}_image.vmdk.bz2" .
|
||||
|
||||
bunzip2 "${work_dir}/flatcar_production_ami_vmdk${AWS_OEM_SUFFIX}_image.vmdk.bz2"
|
||||
|
||||
# FIXME: need to check if it is ok to run ore
|
||||
AWS_BUCKET="flatcar-kola-ami-import-${AWS_REGION}"
|
||||
trap 'bin/ore -d aws delete --region="${AWS_REGION}" --name="${AWS_IMAGE_NAME}" --ami-name="${AWS_IMAGE_NAME}" --file="${work_dir}/flatcar_production_ami_vmdk${AWS_OEM_SUFFIX}_image.vmdk" --bucket "s3://${AWS_BUCKET}/${AWS_BOARD}/"; rm -r ${work_dir}/' EXIT
|
||||
bin/ore aws initialize --region="${AWS_REGION}" --bucket "${AWS_BUCKET}"
|
||||
AWS_AMI_ID=$(bin/ore aws upload --force --region="${AWS_REGION}" --name=${AWS_IMAGE_NAME} --ami-name="${AWS_IMAGE_NAME}" --ami- description="Flatcar Test ${AWS_IMAGE_NAME}" --file="${work_dir}/flatcar_production_ami_vmdk${AWS_OEM_SUFFIX}_image.vmdk" --bucket "s3://${AWS_BUCKET}/${AWS_BOARD}/" | jq -r .HVM)
|
||||
echo "Created new AMI ${AWS_AMI_ID} (will be removed after testing)"
|
||||
fi
|
||||
|
||||
|
||||
# AWS timeout
|
||||
timeout=6h
|
||||
|
||||
set -x
|
||||
set -o noglob
|
||||
|
||||
sudo timeout --signal=SIGQUIT ${timeout} bin/kola run \
|
||||
--board="${AWS_BOARD}" \
|
||||
--basename="${AWS_IMAGE_NAME}" \
|
||||
--channel="${AWS_CHANNEL}" \
|
||||
--offering="${AWS_OFFER}" \
|
||||
--parallel=${PARALLEL_TESTS} \
|
||||
--platform=aws \
|
||||
--aws-ami="${AWS_AMI_ID}" \
|
||||
--aws-region="${AWS_REGION}" \
|
||||
--aws-type="${AWS_INSTANCE_TYPE}" \
|
||||
--aws-iam-profile="${AWS_IAM_PROFILE}" \
|
||||
--tapfile="${tapfile}" \
|
||||
--torcx-manifest=torcx_manifest.json \
|
||||
$@
|
||||
|
||||
set +o noglob
|
||||
set +x
|
Loading…
x
Reference in New Issue
Block a user