checkout.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # set -x
  3. # read -p "🗃 : 请确保您已经fork了本仓库,并且fork了以下的的仓库(y/n):
  4. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-common
  5. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-cloudenv
  6. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-compute
  7. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-network
  8. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-dashboard
  9. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-storage
  10. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-k8s
  11. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-helm
  12. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-db
  13. # 📦 ssh://git@git.yunion.io/fep/dashboard-module-monitor
  14. # " userConfirm
  15. # if [ "$userConfirm" == "n" ]
  16. # then
  17. # echo "请先fork上面👆的仓库之后重试"
  18. # exit -1
  19. # fi
  20. branch=$1
  21. currentPath=$(dirname $0)
  22. checkout(){
  23. local moduleName=$1; shift
  24. local path=$1; shift
  25. { # try
  26. echo
  27. cd $currentPath/$path
  28. git fetch && \
  29. git checkout $branch && \
  30. # 不显示输出
  31. cd - 2>&1 >/dev/null && \
  32. echo "\033[32m [$moduleName] 已切换本地分支 [$branch] \033[0m"
  33. } || { # catch
  34. echo "\033[31m [$moduleName] 切换到分支 [$branch] 发生错误,请手动执行 \033[0m"
  35. exit -1
  36. }
  37. }
  38. checkout 'dashboard' ../
  39. checkout 'dashboard-module-common' ../src
  40. checkout 'dashboard-module-cloudenv' ../containers/Cloudenv
  41. checkout 'dashboard-module-compute' ../containers/Compute
  42. checkout 'dashboard-module-dashboard' ../containers/Dashboard
  43. checkout 'dashboard-module-network' ../containers/Network
  44. checkout 'dashboard-module-storage' ../containers/Storage
  45. checkout 'dashboard-module-k8s' ../containers/K8S
  46. checkout 'dashboard-module-helm' ../containers/Helm
  47. checkout 'dashboard-module-db' ../containers/DB
  48. checkout 'dashboard-module-monitor' ../containers/Monitor
  49. exit 0