The Gatekeeper, or a project gating system
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.
 
 
 

47 lines
1.1 KiB

  1. #!/bin/bash
  2. set -eu
  3. cd $(dirname $0)
  4. # Select docker or podman
  5. if command -v docker > /dev/null; then
  6. DOCKER=docker
  7. elif command -v podman > /dev/null; then
  8. DOCKER=podman
  9. else
  10. echo "Please install docker or podman."
  11. exit 1
  12. fi
  13. # Select docker-compose or podman-compose
  14. if command -v docker-compose > /dev/null; then
  15. COMPOSE=docker-compose
  16. elif command -v podman-compose > /dev/null; then
  17. COMPOSE=podman-compose
  18. else
  19. echo "Please install docker-compose or podman-compose."
  20. exit 1
  21. fi
  22. MYSQL="${DOCKER} exec zuul-test-mysql mysql -u root -pinsecure_slave"
  23. if [ "${COMPOSE}" == "docker-compose" ]; then
  24. docker-compose rm -sf
  25. else
  26. podman-compose down
  27. fi
  28. ${COMPOSE} up -d
  29. echo "Waiting for mysql"
  30. timeout 30 bash -c "until ${MYSQL} -e 'show databases'; do sleep 0.5; done"
  31. echo
  32. echo "Setting up permissions for zuul tests"
  33. ${MYSQL} -e "GRANT ALL PRIVILEGES ON *.* TO 'openstack_citest'@'%' identified by 'openstack_citest' WITH GRANT OPTION;"
  34. ${MYSQL} -u openstack_citest -popenstack_citest -e "SET default_storage_engine=MYISAM; DROP DATABASE IF EXISTS openstack_citest; CREATE DATABASE openstack_citest CHARACTER SET utf8;"
  35. echo "Finished"