Last active
December 9, 2023 20:30
-
-
Save dims/59330c38174c3c4320ae2f041a5fb444 to your computer and use it in GitHub Desktop.
build al2023
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################## | |
set -x | |
aws s3 ls || exit 1 | |
#export S3_BUCKET=provider-aws-test-infra-dims-west-2 | |
export S3_BUCKET=provider-aws-test-infra-dims-east-1 | |
#export AWS_REGION=us-west-2 | |
export AWS_REGION=us-east-1 | |
#export BUILD_EKS_AMI_ARCH=x86_64 | |
export BUILD_EKS_AMI_ARCH=arm64 | |
export USE_DOCKERIZED_BUILD="true" | |
export AWS_DEFAULT_REGION=$AWS_REGION | |
export BUILD_EKS_AMI_OS=al2023 | |
build_eks_arch="" | |
target_build_arch="linux/amd64" | |
if [[ ${BUILD_EKS_AMI_ARCH:-""} == "arm64" ]]; then | |
build_eks_arch="arm64-" | |
target_build_arch="linux/arm64" | |
fi | |
TODAYS_DATE=$(date -u +'%Y%m%d') | |
AMI_VERSION="v$TODAYS_DATE" | |
NODE_OS_ARCH=$(echo "$target_build_arch" | awk -F'/' '{print $2}') | |
############################################################## | |
# shellcheck disable=SC2164 | |
pushd "$(go env GOPATH)/src/k8s.io/kubernetes" >/dev/null | |
KUBE_MINOR_VERSION=$(hack/print-workspace-status.sh | grep gitVersion | awk '{print $2}' | sed -E 's/v([0-9]+)\.([0-9]+).*/v\1.\2/') | |
# shellcheck disable=SC2164 | |
popd | |
AMI_NAME="amazon-eks-al2023-${build_eks_arch}node-${KUBE_MINOR_VERSION}-v${TODAYS_DATE}" | |
AMI_ID=$(aws ec2 describe-images --region=${AWS_REGION:-"us-east-1"} --filters "Name=name,Values=$AMI_NAME" --query 'Images[*].[ImageId]' --output text --max-items 1) | |
############################################################## | |
# shellcheck disable=SC2164 | |
pushd "$(go env GOPATH)/src/sigs.k8s.io/provider-aws-test-infra" >/dev/null | |
if [ -z "$AMI_ID" ] ; then | |
export AMI_NAME | |
export AMI_VERSION | |
"$(go env GOPATH)/src/sigs.k8s.io/provider-aws-test-infra/hack/build-ami.sh" | |
AMI_ID=$(aws ec2 describe-images --region=${AWS_REGION:-"us-east-1"} --filters "Name=name,Values=$AMI_NAME" --query 'Images[*].[ImageId]' --output text --max-items 1) | |
else | |
echo "found existing ami : $AMI_ID skipping building a new AMI..." | |
fi | |
# shellcheck disable=SC2164 | |
popd | |
############################################################## | |
# shellcheck disable=SC2164 | |
pushd "$(go env GOPATH)/src/sigs.k8s.io/provider-aws-test-infra/kubetest2-ec2" >/dev/null | |
go install . && kubetest2 ec2 \ | |
--build \ | |
--target-build-arch $target_build_arch \ | |
--stage $S3_BUCKET \ | |
--worker-image $AMI_ID \ | |
--region $AWS_REGION \ | |
--num-nodes 1 \ | |
--external-cloud-provider true \ | |
--external-load-balancer true \ | |
--worker-user-data-file config/al2023.sh \ | |
--up \ | |
--test=ginkgo \ | |
-- \ | |
--use-built-binaries true \ | |
--test-args="--node-os-arch=$NODE_OS_ARCH" \ | |
--focus-regex='create a PV and a pre-bound PVC: test write access' | |
# shellcheck disable=SC2164 | |
popd | |
# 'create a PV and a pre-bound PVC: test write access' | |
# 'should provide DNS for services' | |
############################################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment