tfb-startup.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 [ -z "$TFB_RUN_ORDER" ]; then
  18. export TFB_RUN_ORDER="reverse"
  19. else
  20. unset TFB_RUN_ORDER
  21. fi
  22. echo "building tfb docker image"
  23. docker build -t techempower/tfb \
  24. --build-arg USER_ID=$(id -u) \
  25. --build-arg GROUP_ID=$(id -g) .
  26. echo "running tfb docker image"
  27. docker run \
  28. -e USER_ID=$(id -u) \
  29. --network=host \
  30. --mount type=bind,source=$TFB_REPOPARENT/$TFB_REPONAME,target=/FrameworkBenchmarks \
  31. techempower/tfb \
  32. --server-host $TFB_SERVER_HOST \
  33. --client-host $TFB_CLIENT_HOST \
  34. --database-host $TFB_DATABASE_HOST \
  35. --network-mode host \
  36. --results-name "$TFB_RUN_NAME" \
  37. --results-environment "$TFB_ENVIRONMENT" \
  38. --results-upload-uri "$TFB_UPLOAD_URI" \
  39. $(if [ "$TFB_RUN_ORDER" = "reverse" ]; then echo "--reverse-order"; fi) \
  40. --quiet
  41. echo "zipping the results"
  42. zip -r results.zip results
  43. echo "uploading the results"
  44. curl \
  45. -i -v \
  46. -X POST \
  47. --header "Content-Type: application/zip" \
  48. --data-binary @results.zip \
  49. $TFB_UPLOAD_URI
  50. echo "done uploading results"