The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list_test_instances.sh 1.4 KiB

4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
4 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. #
  6. # List test Amazon EC2 instances
  7. #
  8. # Environment variables
  9. #
  10. # BUBBLE_ENV : env file to load. Default is ~/.bubble-test.env or /home/bubble/current/bubble-test.env (whichever is found first)
  11. # AWS_ACCESS_KEY_ID : AWS access key ID
  12. # AWS_SECRET_KEY : AWS secret access key
  13. SCRIPT="${0}"
  14. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  15. if [[ -z "${BUBBLE_ENV}" ]] ; then
  16. if [[ -f "${HOME}/.bubble-test.env" ]] ; then
  17. BUBBLE_ENV="${HOME}/.bubble-test.env"
  18. elif [[ -f "/home/bubble/current/.bubble-test.env" ]] ; then
  19. BUBBLE_ENV="/home/bubble/current/.bubble-test.env"
  20. else
  21. die "bubble environment file not found"
  22. fi
  23. fi
  24. if [[ -z "${TEST_TAG}" ]] ; then
  25. TEST_TAG="$(cat ${BUBBLE_ENV} | egrep -v '\s*#' | grep TEST_TAG_CLOUD | awk -F '=' '{print $NF}' | tr -d "'" | tr -d '"')"
  26. if [[ -z "${TEST_TAG}" ]] ; then
  27. die "Error reading TEST_TAG_CLOUD from ${BUBBLE_ENV}"
  28. fi
  29. fi
  30. INSTANCES=$(aws ec2 describe-instances --filters "Name=tag:test_instance,Values=${TEST_TAG}" --query "Reservations[].Instances[].InstanceId")
  31. ((INSTANCES_COUNT=$(echo "${INSTANCES}" | wc -l) - 2))
  32. if [[ ${INSTANCES_COUNT} -gt 0 ]] ; then
  33. echo "Found ${INSTANCES_COUNT} test instances contain tag ${TEST_TAG}"
  34. echo "$INSTANCES"
  35. else
  36. echo "No instances contain tag \"${TEST_TAG}\" found"
  37. fi