go_rc.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #!/bin/bash
  2. #
  3. # Automatically tag the first rc for a new point release
  4. #
  5. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  6. . $SCRIPT_DIR/parse_cmake.sh
  7. . $SCRIPT_DIR/parse_hpcc_chart.sh
  8. if [ -e pom.xml ] ; then
  9. . $SCRIPT_DIR/parse_hpcc_pom.sh
  10. fi
  11. sync_git
  12. parse_cmake
  13. if [ "$HPCC_MATURITY" = "closedown" ] || [ "$HPCC_MATURITY" = "trunk" ] ; then
  14. if (( "$HPCC_POINT" % 2 != 1 )) ; then
  15. if [ "$HPCC_POINT" = "0" ] ; then
  16. # special case when creating new minor release
  17. NEW_POINT=0
  18. if (( "$HPCC_MINOR" % 2 == 1 )) ; then
  19. NEW_MINOR=$((HPCC_MINOR+1))
  20. else
  21. echo "A closedown version should have an odd point or minor version to create a new rc"
  22. exit 2
  23. fi
  24. else
  25. echo "A closedown version should have an odd point version to create a new rc"
  26. exit 2
  27. fi
  28. else
  29. NEW_POINT=$((HPCC_POINT+1))
  30. NEW_MINOR=$HPCC_MINOR
  31. fi
  32. if [ "$HPCC_MATURITY" = "closedown" ] ; then
  33. if [ "$GIT_BRANCH" != "candidate-$HPCC_MAJOR.$NEW_MINOR.x" ]; then
  34. echo "Current branch should be candidate-$HPCC_MAJOR.$NEW_MINOR.x"
  35. exit 2
  36. fi
  37. else
  38. if [ "$GIT_BRANCH" != "master" ]; then
  39. echo "Current branch should be master"
  40. exit 2
  41. fi
  42. fi
  43. if [ "$GIT_BRANCH" = "master" ]; then
  44. doit "git checkout -b candidate-$HPCC_MAJOR.$NEW_MINOR.x"
  45. fi
  46. doit "git checkout -b candidate-$HPCC_MAJOR.$NEW_MINOR.$NEW_POINT"
  47. doit "git checkout $GIT_BRANCH"
  48. doit "git submodule update --init --recursive"
  49. if [ "$GIT_BRANCH" = "master" ]; then
  50. TRUNK_POINT=0
  51. TRUNK_MINOR=$((NEW_MINOR+1))
  52. else
  53. TRUNK_POINT=$((NEW_POINT+1))
  54. TRUNK_MINOR=$NEW_MINOR
  55. fi
  56. update_version_file $HPCC_MATURITY $TRUNK_POINT 0 $TRUNK_MINOR
  57. if [ -e helm/hpcc/Chart.yaml ] ; then
  58. update_chart_file helm/hpcc/Chart.yaml $HPCC_MATURITY $TRUNK_POINT 0 $TRUNK_MINOR
  59. doit "git add helm/hpcc/Chart.yaml"
  60. for f in helm/hpcc/templates/* ; do
  61. update_chart_file $f $HPCC_MATURITY $TRUNK_POINT 0 $TRUNK_MINOR
  62. if [ "$CHART_CHANGED" != "0" ] ; then
  63. doit "git add $f"
  64. fi
  65. done
  66. fi
  67. doit "git add $VERSIONFILE"
  68. doit "git commit -s -m \"Split off $HPCC_MAJOR.$NEW_MINOR.$NEW_POINT\""
  69. doit "git push $REMOTE"
  70. if [ "$GIT_BRANCH" = "master" ]; then
  71. doit "git checkout candidate-$HPCC_MAJOR.$NEW_MINOR.x"
  72. update_version_file closedown 0 0 $NEW_MINOR
  73. if [ -e helm/hpcc/Chart.yaml ] ; then
  74. update_chart_file helm/hpcc/Chart.yaml closedown 0 0 $NEW_MINOR
  75. doit "git add helm/hpcc/Chart.yaml"
  76. for f in helm/hpcc/templates/* ; do
  77. update_chart_file $f closedown 0 0 $NEW_MINOR
  78. if [ "$CHART_CHANGED" != "0" ] ; then
  79. doit "git add $f"
  80. fi
  81. done
  82. fi
  83. doit "git add $VERSIONFILE"
  84. doit "git commit -s -m \"Split off $HPCC_MAJOR.$NEW_MINOR.$NEW_POINT\""
  85. doit "git push $REMOTE candidate-$HPCC_MAJOR.$NEW_MINOR.x"
  86. fi
  87. GIT_BRANCH=candidate-$HPCC_MAJOR.$NEW_MINOR.$NEW_POINT
  88. doit "git checkout $GIT_BRANCH"
  89. doit "git submodule update --init --recursive"
  90. NEW_SEQUENCE=1
  91. else
  92. if [ "$HPCC_MATURITY" != "rc" ] ; then
  93. echo "Current branch should have closedown or rc maturity"
  94. exit 2
  95. fi
  96. if [ "$GIT_BRANCH" != "candidate-$HPCC_MAJOR.$HPCC_MINOR.$HPCC_POINT" ]; then
  97. echo "Current branch should be candidate-$HPCC_MAJOR.$HPCC_MINOR.$HPCC_POINT"
  98. exit 2
  99. fi
  100. NEW_POINT=$HPCC_POINT
  101. NEW_MINOR=$HPCC_MINOR
  102. NEW_SEQUENCE=$((HPCC_SEQUENCE+1))
  103. fi
  104. update_version_file rc $NEW_POINT $NEW_SEQUENCE $NEW_MINOR
  105. if [ -e helm/hpcc/Chart.yaml ] ; then
  106. update_chart_file helm/hpcc/Chart.yaml rc $NEW_POINT $NEW_SEQUENCE $NEW_MINOR
  107. doit "git add helm/hpcc/Chart.yaml"
  108. for f in helm/hpcc/templates/* ; do
  109. update_chart_file $f rc $NEW_POINT $NEW_SEQUENCE $NEW_MINOR
  110. if [ "$CHART_CHANGED" != "0" ] ; then
  111. doit "git add $f"
  112. fi
  113. done
  114. fi
  115. HPCC_MATURITY=rc
  116. HPCC_SEQUENCE=$NEW_SEQUENCE
  117. HPCC_MINOR=$NEW_MINOR
  118. HPCC_POINT=$NEW_POINT
  119. set_tag
  120. # Commit the change
  121. doit "git add $VERSIONFILE"
  122. doit "git commit -s -m \"$HPCC_NAME $HPCC_SHORT_TAG Release Candidate $HPCC_SEQUENCE\""
  123. doit "git push $REMOTE $GIT_BRANCH $FORCE"
  124. # tag it
  125. do_tag
  126. if [ -e helm/hpcc/Chart.yaml ] ; then
  127. # We publish any tagged version of helm chart to the helm-chart repo
  128. # but only copy helm chart sources across for "latest stable" version
  129. HPCC_DIR="$( pwd )"
  130. doit2 "pushd ../helm-chart 2>&1 > /dev/null"
  131. doit "git fetch $REMOTE"
  132. doit "git checkout master"
  133. doit "git merge --ff-only $REMOTE/master"
  134. doit "git submodule update --init --recursive"
  135. HPCC_PROJECTS=hpcc-helm
  136. HPCC_NAME=HPCC
  137. doit2 "cd docs"
  138. doit "helm package ${HPCC_DIR}/helm/hpcc/"
  139. doit "helm repo index . --url https://hpcc-systems.github.io/helm-chart"
  140. doit "git add *.tgz"
  141. doit "git commit -a -s -m \"$HPCC_NAME Helm Charts $HPCC_SHORT_TAG Release Candidate $HPCC_SEQUENCE\""
  142. doit "git push $REMOTE master $FORCE"
  143. doit2 "popd 2>&1 > /dev/null"
  144. fi