Go框架demo
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.

82 lines
1.7 KiB

3 years ago
  1. #!/bin/sh
  2. # ci.sh
  3. # This script for build go projects.
  4. # @version 170327:2
  5. # @author zhangxuhong <zhangxuhong@xitu.io>
  6. #
  7. # [ci]
  8. echo "-[ci]-"
  9. echo "start"
  10. # ----------------------------[manual config here]------------------------------
  11. # base config
  12. REPO_SRC=/data/repo/baidu_link_submit_ms
  13. BUILD_TARGET=baidu_link_submit_ms
  14. # fetch source config
  15. go_packages=(
  16. "github.com/astaxie/beego"
  17. )
  18. http_proxy=""
  19. # deploy config
  20. DEPLOY_SRC=/data/repo
  21. DEPLOY_LOG_SRC=/data/logs
  22. ACTION=$1
  23. RELEASE_ENV=$2
  24. DEV_ENV_LOCATION=(
  25. "root@192.168.0.203"
  26. )
  27. BETA_ENV_LOCATION=(
  28. "root@192.168.0.222"
  29. )
  30. ONLINE_ENV_LOCATION=(
  31. "root@192.168.100.42" # microservice03v
  32. "root@192.168.100.44" # microservice04v
  33. "root@192.168.100.46" # microservice04v
  34. )
  35. # ------------------------------------------------------------------------------
  36. # check if release env fit repo src
  37. NOW_PWD=`pwd`
  38. if [ "$NOW_PWD" != "${REPO_SRC}/scripts" ] && [ "$NOW_PWD" != "${REPO_SRC}" ]; then
  39. echo -e "\033[43m[WARRING!] PWD is ${NOW_PWD}, but REPO_SRC is ${REPO_SRC} \033[0m";
  40. echo -e "please check your REPO_SRC config to make sure that you config this file correctly.";
  41. exit 1;
  42. fi
  43. # run scripts
  44. SCRIPTS_SRC="${REPO_SRC}/scripts/ci"
  45. if [ "${ACTION}" == "build" ]; then
  46. . "${SCRIPTS_SRC}/fetch_source.sh"
  47. . "${SCRIPTS_SRC}/build.sh"
  48. elif [ "${ACTION}" == "release" ]; then
  49. . "${SCRIPTS_SRC}/fetch_source.sh"
  50. . "${SCRIPTS_SRC}/build.sh"
  51. . "${SCRIPTS_SRC}/deploy.sh"
  52. elif [ "${ACTION}" == "run_bee" ]; then
  53. . "${SCRIPTS_SRC}/run_bee.sh"
  54. else
  55. echo "usage:"
  56. echo "./ci.sh [action: build/release/run_bee] [beta/online/bee_path]"
  57. echo ""
  58. echo "e.g."
  59. echo "./ci.sh release beta"
  60. echo ""
  61. fi
  62. echo "end"