From a26449a3461543666b02586637594726feff87b3 Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Tue, 13 Jun 2023 17:33:38 +0200 Subject: [PATCH] fix Required plugins are not installed during destroy of ami --- .github/scripts/check_meilisearch_availability.sh | 2 -- .github/workflows/test.yml | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/scripts/check_meilisearch_availability.sh b/.github/scripts/check_meilisearch_availability.sh index 02fbd30..bfaeecd 100644 --- a/.github/scripts/check_meilisearch_availability.sh +++ b/.github/scripts/check_meilisearch_availability.sh @@ -5,12 +5,10 @@ status="$(curl http://$PUBLIC_IP/health)" # Check if the variable content is equal to '{"status":"available"}' if [ "$status" != '{"status":"available"}' ]; then - # If not, echo the variable value and an error message, and exit with code 1 echo "Error: Meilisearch is not running correctly." echo "Server response: $status" exit 1 else - # If it is equal, echo a success message and exit with code 0 echo "Meilisearch is available." exit 0 fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 210c885..ce0569f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,9 +31,9 @@ jobs: 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 "IMAGE_ID=$image_id" >> $GITHUB_ENV - - name: check env - run: echo ${{ env.IMAGE_ID }} - - name: check env + - name: check env.IMAGE_ID + run: echo "${{ env.IMAGE_ID }}" + - name: check IMAGE_ID run: echo $IMAGE_ID - name: Install Terraform @@ -59,6 +59,7 @@ jobs: - name: Destroy instance and AMI if: always() run: | + terraform init terraform destroy -var ami_id=$IMAGE_ID -auto-approve \ No newline at end of file