Skip to content

Commit e870ba4

Browse files
committed
test: instead of patch, add prior to start of machine in testinfra
1 parent 17d35dd commit e870ba4

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

.github/workflows/testinfra-ami-build.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,32 +94,6 @@ jobs:
9494
sudo rm -rf /tmp/* # Clean temporary files
9595
df -h / # Display available space
9696
97-
- name: Patch stage2-nix-psql.pkr.hcl to create pg_extensions.json
98-
run: |
99-
# Get the line number of the last closing brace
100-
LAST_BRACE_LINE=$(grep -n '}' stage2-nix-psql.pkr.hcl | tail -n 1 | cut -d: -f1)
101-
102-
# Create a temporary file with the new content
103-
head -n $((LAST_BRACE_LINE-1)) stage2-nix-psql.pkr.hcl > temp.pkr.hcl
104-
cat >> temp.pkr.hcl << 'EOF'
105-
# Add provisioner to create pg_extensions.json
106-
provisioner "shell" {
107-
inline = [
108-
"echo '{\"pg_cron\":\"1.3.1\"}' | sudo tee /root/pg_extensions.json",
109-
"sudo chmod 644 /root/pg_extensions.json",
110-
"echo 'Created pg_extensions.json with content:' && sudo cat /root/pg_extensions.json"
111-
]
112-
}
113-
}
114-
EOF
115-
116-
# Replace the original file
117-
mv temp.pkr.hcl stage2-nix-psql.pkr.hcl
118-
119-
# Display the modified file to verify
120-
echo "Modified stage2-nix-psql.pkr.hcl:"
121-
tail -n 10 stage2-nix-psql.pkr.hcl
122-
12397
- name: Build AMI stage 2
12498
run: |
12599
packer init stage2-nix-psql.pkr.hcl

testinfra/test_ami_nix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def gzip_then_base64_encode(s: str) -> str:
272272
- {{path: /etc/gotrue.env, content: {gzip_then_base64_encode(gotrue_env_content)}, permissions: '0664', encoding: gz+b64}}
273273
- {{path: /etc/wal-g/config.json, content: {gzip_then_base64_encode(walg_config_json_content)}, permissions: '0664', owner: 'wal-g:wal-g', encoding: gz+b64}}
274274
- {{path: /tmp/init.json, content: {gzip_then_base64_encode(init_json_content)}, permissions: '0600', encoding: gz+b64}}
275+
- {{path: /root/pg_extensions.json, content: {gzip_then_base64_encode('{"pg_cron":"1.3.1"}')}, permissions: '0644', encoding: gz+b64}}
275276
runcmd:
276277
- 'sudo echo \"pgbouncer\" \"postgres\" >> /etc/pgbouncer/userlist.txt'
277278
- 'cd /tmp && aws s3 cp --region ap-southeast-1 s3://init-scripts-staging/project/init.sh .'

0 commit comments

Comments
 (0)