Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "CI: Use the tox-verify workflow to test all envs"
[releng/global-jjb.git]
/
shell
/
gerrit-fetch-dependencies.sh
diff --git
a/shell/gerrit-fetch-dependencies.sh
b/shell/gerrit-fetch-dependencies.sh
index
4870b10
..
c897f55
100644
(file)
--- a/
shell/gerrit-fetch-dependencies.sh
+++ b/
shell/gerrit-fetch-dependencies.sh
@@
-8,11
+8,14
@@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
+echo "---> gerrit-fetch-dependencies.sh"
# Fetches patches all projects provided by comment trigger
#
# Takes a list of Gerrit patches and fetches all projects and cherry-pick
# patches for projects. The trigger is
# 'recheck: SPACE_SEPERATED_LIST_OF_PATCHES'
# Fetches patches all projects provided by comment trigger
#
# Takes a list of Gerrit patches and fetches all projects and cherry-pick
# patches for projects. The trigger is
# 'recheck: SPACE_SEPERATED_LIST_OF_PATCHES'
+# or
+# 'reverify: SPACE_SEPERATED_LIST_OF_PATCHES'
#
# NOTE: This script assumes the user will provide the correct dependency order
# via the PATCHES list.
#
# NOTE: This script assumes the user will provide the correct dependency order
# via the PATCHES list.
@@
-22,14
+25,27
@@
set -eu -o pipefail
REPOS_DIR="$WORKSPACE/.repos"
REPOS_DIR="$WORKSPACE/.repos"
-PATCHES=($(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'recheck:' | awk -F: '{print $2}'))
+IFS=" " read -r -a PATCHES <<< \
+ "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | \
+ grep -E '(recheck:|reverify:)' | awk -F: '{print $2}')"
+
+# shellcheck disable=SC1090
+source ~/lf-env.sh
+
+lf-activate-venv "git-review==1.28"
+
projects=()
projects=()
-for patch in
$(echo "${PATCHES[@]}")
; do
+for patch in
"${PATCHES[@]}"
; do
json=$(curl -s "$GERRIT_URL/changes/$patch" | sed -e "s/)]}'//")
project=$(echo "$json" | jq -r '.project')
branch=$(echo "$json" | jq -r '.branch')
json=$(curl -s "$GERRIT_URL/changes/$patch" | sed -e "s/)]}'//")
project=$(echo "$json" | jq -r '.project')
branch=$(echo "$json" | jq -r '.branch')
+ if [ "$GERRIT_CHANGE_NUMBER" == "$patch" ]; then
+ echo "WARN: GERRIT_CHANGE and $patch are one and the same. Ignoring patch..."
+ continue
+ fi
+
if [ ! -d "$REPOS_DIR/$project" ]; then
git clone -q --depth 1 -b "$branch" "$GIT_URL/$project" "$REPOS_DIR/$project"
if [ ! -d "$REPOS_DIR/$project" ]; then
git clone -q --depth 1 -b "$branch" "$GIT_URL/$project" "$REPOS_DIR/$project"
@@
-38,7
+54,10
@@
for patch in $(echo "${PATCHES[@]}"); do
fi
pushd "$REPOS_DIR/$project"
fi
pushd "$REPOS_DIR/$project"
- git remote add gerrit "$GIT_URL/$project"
+ # If remote gerrit already exists just make sure path is expected
+ if ! git remote add gerrit "$GERRIT_URL/$project" > /dev/null 2>&1; then
+ git remote set-url gerrit "$GERRIT_URL/$project"
+ fi
git review --cherrypick="$patch"
popd
done
git review --cherrypick="$patch"
popd
done