Skip to content

Commit

Permalink
Fix test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bidoubiwa committed Apr 27, 2023
1 parent e523092 commit dbdd90f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/check_instance.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

PUBLIC_IP=$1
start_time=$(date +%s)

while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 5 http://11.1.1)" != "200" ]]; do
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 5 http://$PUBLIC_IP)" != "200" ]]; do
sleep 5

elapsed_time=$(($(date +%s) - $start_time))
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
- name: Build image
run: |
image_id=$(packer build -var 'image_name=temporary-iam-used-in-packer-testing' -machine-readable -only "amazon-ebs.*" meilisearch.pkr.hcl | awk -F, '$0 ~/artifact,0,id/ {print $6}' | cut -d ":" -f 2)
packer init .
image_id="$(packer build -var 'image_name=${{ github.run_id }}' -machine-readable -only "amazon-ebs.*" meilisearch.pkr.hcl | awk -F, '$0 ~/artifact,0,id/ {print $6}' | cut -d ":" -f 2)"
echo "hello"
echo "$image_id"
echo $image_id
echo "IMAGE_ID=$image_id" >> $GITHUB_ENV
Expand All @@ -46,11 +49,11 @@ jobs:
run: |
terraform init
terraform apply -auto-approve -var ami_id=$IMAGE_ID
public_ip=$(terraform output public_ip)
public_ip="$(terraform output public_ip_address | cut -d "\"" -f 2)"
echo "PUBLIC_IP=$public_ip" >> $GITHUB_ENV
- name: Test that the instance is running
run: |
sh .github/scripts/check-instance.sh ${{ env.PUBLIC_IP }}
sh .github/scripts/check_instance.sh ${{ env.PUBLIC_IP }}
- name: Test that Meilisearch is running correctly
run: |
sh .github/scripts/check_meilisearch_availability.sh ${{ env.PUBLIC_IP }}
Expand Down

0 comments on commit dbdd90f

Please sign in to comment.