set -x
# shellcheck disable=SC1090
-source ~/lf-env.sh
+. ~/lf-env.sh
-lf-activate-venv "git-review==1.28"
+lf-activate-venv --python python3 "git-review==2.3.1"
RELEASE=${RELEASE:-$(echo "$GERRIT_EVENT_COMMENT_TEXT" | base64 -d | grep generate-release-notes | awk '{print $2}')}
if [ -z "$RELEASE" ]; then
git clone -b "$GERRIT_BRANCH" https://git.opendaylight.org/gerrit/docs.git "$DOCS_DIR"
cd "$DOCS_DIR" || exit 1
cp "$WORKSPACE/release-notes.rst" "docs/release-notes/release-notes-${RELEASE,,}.rst"
-sed -i -e '$a .. release-notes-${RELEASE,,}' "docs/release-notes/index.rst"
git add docs/release-notes/
GERRIT_COMMIT_MESSAGE="Update release notes for $RELEASE"
git status
git remote add gerrit "ssh://jenkins-$SILO@git.opendaylight.org:29418/docs.git"
+# Workaround for git-review failing to copy the commit-msg hook to submodules
+git config core.hooksPath "$(git rev-parse --show-toplevel)/.git/hooks"
+
# Don't fail the build if this command fails because it's possible that there
# is no changes since last update.
-git review --yes -t "$GERRIT_TOPIC" || true
+git review --yes -t "$GERRIT_TOPIC" "$GERRIT_BRANCH" || true