Skip to content

Commit 48ecb12

Browse files
authored
fix: locale gen and ami deregister on any testinfra run (#1055)
* fix: locale gen and ami deregister on any testinfra run * fix: use more manual approach --------- Co-authored-by: Sam Rose <[email protected]>
1 parent 7eabe03 commit 48ecb12

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/testinfra-nix.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,24 @@ jobs:
6565
if: ${{ always() }}
6666
run: |
6767
aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:testinfra-run-id,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --region ap-southeast-1 --instance-ids {} || true
68+
69+
- name: Cleanup AMIs
70+
if: always()
71+
run: |
72+
# Define AMI name patterns
73+
STAGE1_AMI_NAME="supabase-postgres-ci-ami-test-stage-1"
74+
STAGE2_AMI_NAME="supabase-postgres-ci-ami-test-nix"
75+
76+
# Function to deregister AMIs by name pattern
77+
deregister_ami_by_name() {
78+
local ami_name_pattern=$1
79+
local ami_ids=$(aws ec2 describe-images --region ap-southeast-1 --owners self --filters "Name=name,Values=${ami_name_pattern}" --query 'Images[*].ImageId' --output text)
80+
for ami_id in $ami_ids; do
81+
echo "Deregistering AMI: $ami_id"
82+
aws ec2 deregister-image --region ap-southeast-1 --image-id $ami_id
83+
done
84+
}
85+
86+
# Deregister AMIs
87+
deregister_ami_by_name "$STAGE1_AMI_NAME"
88+
deregister_ami_by_name "$STAGE2_AMI_NAME"

ansible/tasks/setup-postgres.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,20 @@
3939
state: absent
4040
when: debpkg_mode
4141

42+
- name: install locales
43+
apt:
44+
name: locales
45+
state: present
46+
become: yes
47+
when: stage2_nix
48+
49+
- name: configure locales
50+
command: echo "C.UTF-8 UTF-8" > /etc/locale.gen && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
51+
become: yes
52+
when: stage2_nix
53+
4254
- name: locale-gen
43-
command: sudo locale-gen en_US.UTF-8
55+
command: sudo locale-gen
4456
when: stage2_nix
4557

4658
- name: update-locale

0 commit comments

Comments
 (0)