9494
9595 steps :
9696
97+ - name : Configure AWS credentials
98+ uses :
aws-actions/[email protected] 99+ with :
100+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
101+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
102+ aws-region : ${{ secrets.AWS_REGION }}
103+
104+ - name : Get AlmaLinux ${{ inputs.version_major }} aarch64 AMI most recent ID
105+ run : |
106+ os_version="${{ inputs.version_major }}"
107+ if [[ "${os_version}" == "10-kitten" ]]; then
108+ os_version="Kitten 10"
109+ fi
110+ AMI_ID=$(aws ec2 describe-images --owners 764336703387 --query "Images | max_by(@, &CreationDate) | ImageId" --filters "Name=name,Values=AlmaLinux OS ${os_version}*aarch64" --region ${{ secrets.AWS_REGION }} --output text)
111+ if [[ "${AMI_ID}" == "" || "${AMI_ID}" == "None" ]]; then
112+ echo "[Error] Failed to get AMI ID for AlmaLinux ${os_version} aarch64."
113+ exit 1
114+ else
115+ echo "[Debug] AMI ID: '${AMI_ID}'"
116+ fi
117+ echo "AMI_ID=${AMI_ID}" >> $GITHUB_ENV
118+
97119 - name : Setup and start the runner
98120 id : start-ec2-runner
99121 uses :
NextChapterSoftware/[email protected] @@ -103,7 +125,7 @@ jobs:
103125 aws_secret_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
104126 aws_region : ${{ secrets.AWS_REGION }}
105127 # TODO: EC2_AMI_ID_AL9 (9-th AMI) should be used for Kitten 10 until appliance-tools isn't available
106- ec2_ami_id : ${{ secrets[format('EC2_AMI_ID_AL{0}', ( ( inputs.version_major == '10-kitten' || inputs.version_major == '10' ) && '9' || inputs.version_major ))] }}
128+ ec2_ami_id : ${{ env.AMI_ID }}
107129 ec2_subnet_id : ${{ secrets.EC2_SUBNET_ID}}
108130 ec2_security_group_id : ${{ secrets.EC2_SECURITY_GROUP_ID }}
109131
0 commit comments