@@ -14,9 +14,14 @@ echo $aws_tfstate
1414
1515# get AMI id(s)
1616cd $CALCLOUD_BUILD_DIR /ami_rotation
17- ami_json=$( echo $( awsudo $ADMIN_ARN aws ec2 describe-images --region us-east-1 --executable-users self) )
17+ # Limit responses to the most recent 24 images to prevent "Argument list too long"
18+ query=' {Images: reverse(sort_by(Images, &CreationDate))[:24]}'
19+ ami_json=" $(
20+ awsudo " $ADMIN_ARN " \
21+ " aws ec2 describe-images --region us-east-1 --executable-users self --query '$query ' --output json"
22+ ) "
1823ci_ami=` python3 parse_image_json.py " ${ami_json} " STSCI-AMAZON-LINUX2023`
19- ecs_ami=` python3 parse_image_json.py " ${ami_json} " STSCI-ECS-AL2023`
24+ ecs_ami=` python3 parse_image_json.py " ${ami_json} " STSCI-EPH- ECS-AL2023`
2025
2126if [[ " $ci_ami " =~ ^ami-[a-z0-9]+$ ]]; then
2227 echo $ci_ami
@@ -83,8 +88,8 @@ awsudo $ADMIN_ARN aws s3api put-object --bucket $bucket_url --key crds_env_vars/
8388awsudo $ADMIN_ARN aws s3api put-object --bucket $bucket_url --key crds_env_vars/${crds_context}
8489
8590# tag images as in-use by this environment
86- cd $CALCLOUD_BUILD_DIR /terraform
87- # this script doesn't replace "old-tag", it just takes that image, and adds this tag to it.
91+ cd $CALCLOUD_BUILD_DIR /terraform
92+ # this script doesn't replace "old-tag", it just takes that image, and adds this tag to it.
8893# And in fact, if another image exists with this tag, it's removed from that one; so this is image promotion all-in-one
8994echo ${aws_env}
9095./deploy_image_promote.sh --old-tag $CALDP_ECR_TAG batch-${aws_env}
0 commit comments