CI: Remove stable/phosphorus jobs
[releng/builder.git] / jjb / docs / docs_version_bump_projects.sh
index 069304fb6d5a2a2427bcffd538d9aad043838ff9..e67989678d64d72ad6d9da0807a90c6e835c0f31 100644 (file)
@@ -12,7 +12,7 @@
 update_file_usage () {
     echo "Usage: $0 <release_name> <PUBLISH>"
     echo ""
-    echo "    release_name:  The release_name e.g Magnesium ."
+    echo "    release_name:  The release_name e.g Chlorine, Sulfur."
     echo "    PUBLISH:  Set to true to PUBLISH"
     echo ""
 }
@@ -28,9 +28,21 @@ while getopts :h: opts; do
         ;;
   esac
 done
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --python python3 "git-review==2.3.1"
+
+# Workaround for git-review failing to copy the commit-msg hook to submodules
+git config core.hooksPath "$(git rev-parse --show-toplevel)/.git/hooks"
+
+git config --global --add gitreview.username "jenkins-$SILO"
+cd "$WORKSPACE"/autorelease || exit
+GERRIT_PROJECT="releng/autorelease"
 if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
     # User input
-    RELEASE_NAME=$RELEASE_NAME
+    RELEASE_NAME=${RELEASE_NAME:-}
     # Captilize Version Name
     release_name="$(tr '[:lower:]' '[:upper:]' <<< "${RELEASE_NAME:0:1}")${RELEASE_NAME:1}"
     echo "Start Version Updating in odl-projects"
@@ -38,13 +50,15 @@ if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
     ################
     # Start script #
     ###############
-    pip install --user --quiet --upgrade git-review
-    git config --global --add gitreview.username "jenkins-$SILO"
     git submodule update
     #'|| true' for repo like serviceutils where docs/conf.yaml doesn't exist
     command='sed -i ''"s/.*version.*/version: '"$release_name"'/"'' docs/conf.yaml || true'
-    git submodule foreach "git checkout $STREAM"
+    git submodule foreach "git checkout $GERRIT_BRANCH"
+    echo "git checkout $GERRIT_BRANCH"
+    git submodule foreach "git branch"
     git submodule foreach "$command"
+    # Workaround for git-review failing to copy the commit-msg hook to submodules
+    # git submodule foreach 'git config core.hooksPath "$(git rev-parse --show-toplevel)/.git/hooks"'
     if [ "$PUBLISH" == "true" ]
       then
         echo "Update docs header to $release_name in $STREAM"
@@ -54,4 +68,4 @@ if [ "$GERRIT_PROJECT" == "releng/autorelease" ]; then
     Should be $release_name on $STREAM.' || true"
         git submodule foreach "git review || true"
     fi
-fi
\ No newline at end of file
+fi