tfb-startup.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. set -e
  3. echo "running tfb-shutdown script"
  4. ./tfb-shutdown.sh
  5. echo "removing old tfb directory if necessary"
  6. if [ -d "$TFB_REPOPARENT/$TFB_REPONAME" ]; then
  7. sudo rm -rf $TFB_REPOPARENT/$TFB_REPONAME
  8. fi
  9. echo "cloning tfb repository"
  10. git clone \
  11. -b $TFB_REPOBRANCH \
  12. $TFB_REPOURI \
  13. $TFB_REPOPARENT/$TFB_REPONAME \
  14. --depth 1
  15. echo "moving to tfb directory"
  16. cd $TFB_REPOPARENT/$TFB_REPONAME
  17. if [ -e "${TFB_REPOPARENT}/tfb-reverse-order" ]; then
  18. export TFB_RUN_ORDER="reverse"
  19. sudo rm -rf "${TFB_REPOPARENT}/tfb-reverse-order"
  20. else
  21. unset TFB_RUN_ORDER
  22. touch "${TFB_REPOPARENT}/tfb-reverse-order"
  23. fi
  24. echo "building tfb docker image"
  25. docker build -t techempower/tfb \
  26. --build-arg USER_ID=$(id -u) \
  27. --build-arg GROUP_ID=$(id -g) .
  28. echo "running tfb docker image"
  29. docker run \
  30. -e USER_ID=$(id -u) \
  31. --network=host \
  32. --mount type=bind,source=$TFB_REPOPARENT/$TFB_REPONAME,target=/FrameworkBenchmarks \
  33. techempower/tfb \
  34. --server-host $TFB_SERVER_HOST \
  35. --client-host $TFB_CLIENT_HOST \
  36. --database-host $TFB_DATABASE_HOST \
  37. --network-mode host \
  38. --results-name "$TFB_RUN_NAME" \
  39. --results-environment "$TFB_ENVIRONMENT" \
  40. --results-upload-uri "$TFB_UPLOAD_URI" \
  41. $(if [ "$TFB_RUN_ORDER" = "reverse" ]; then echo "--reverse-order"; fi) \
  42. --quiet
  43. echo "zipping the results"
  44. zip -r results.zip results
  45. echo "uploading the results"
  46. curl \
  47. -i -v \
  48. -X POST \
  49. --header "Content-Type: application/zip" \
  50. --data-binary @results.zip \
  51. $TFB_UPLOAD_URI
  52. echo "done uploading results"