Skip to content

Commit

Permalink
Fetch latest E2E test AMI ID dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay-krishna committed Jun 11, 2024
1 parent 8ba7c20 commit e664f73
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
10 changes: 9 additions & 1 deletion cmd/integration_test/build/script/create_infra_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ set -e
set -x
set -o pipefail

INTEGRATION_TEST_AMI_ID=$(aws ec2 describe-images \
--profile ${AWS_PROFILE} \
--owners 857151390494 \
--filters "Name=name,Values=eksa-integration-test-AL2-*" "Name=description,Values=*Kernel version 5.X*" \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output text
)

cat << EOF > ${INTEGRATION_TEST_INFRA_CONFIG}
---
ec2:
amiId: ${INTEGRATION_TEST_AL2_AMI_ID}
amiId: ${INTEGRATION_TEST_AMI_ID}
subnetId: ${INTEGRATION_TEST_SUBNET_ID}
vSphere:
Expand Down
24 changes: 16 additions & 8 deletions scripts/e2e_test_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,44 @@ BIN_FOLDER=$REPO_ROOT/bin
TEST_REGEX="${1:-TestDockerKubernetes130SimpleFlow}"
BRANCH_NAME="${2:-main}"

export AWS_SDK_LOAD_CONFIG=true
export AWS_CONFIG_FILE=$(pwd)/config_file
export AWS_PROFILE=e2e-docker-test

cat << EOF > config_file
cat << EOF > ${AWS_CONFIG_FILE}
[default]
output=json
region=${AWS_REGION:-${AWS_DEFAULT_REGION:-us-west-2}}
role_arn=$AWS_ROLE_ARN
web_identity_token_file=/var/run/secrets/eks.amazonaws.com/serviceaccount/token
[profile e2e-docker-test]
[profile ${AWS_PROFILE}]
role_arn=$TEST_ROLE_ARN
region=${AWS_REGION:-${AWS_DEFAULT_REGION:-us-west-2}}
source_profile=default
EOF

unset AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE

INTEGRATION_TEST_INFRA_CONFIG="/tmp/test-infra.yml"
export T_TINKERBELL_S3_INVENTORY_CSV_KEY="inventory/den80/den80-hardware.csv"

INTEGRATION_TEST_AMI_ID=$(aws ec2 describe-images \
--profile ${AWS_PROFILE} \
--owners 857151390494 \
--filters "Name=name,Values=eksa-integration-test-AL2-*" "Name=description,Values=*Kernel version 5.X*" \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output text
)

cat << EOF > ${INTEGRATION_TEST_INFRA_CONFIG}
---
ec2:
amiId: ${INTEGRATION_TEST_AL2_AMI_ID}
amiId: ${INTEGRATION_TEST_AMI_ID}
subnetId:
EOF

export AWS_SDK_LOAD_CONFIG=true
export AWS_CONFIG_FILE=$(pwd)/config_file
export AWS_PROFILE=e2e-docker-test
unset AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE

BUNDLES_OVERRIDE=false
if [ -f "$BIN_FOLDER/local-bundle-release.yaml" ]; then
BUNDLES_OVERRIDE=true
Expand Down

0 comments on commit e664f73

Please sign in to comment.