X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fgerrit-push-patch.sh;h=8bddfa9db94b5dccd1a3fc206afe72a78174965f;hb=5fe90576c6f500ff92fbe7b76e42aad7d5d35fcd;hp=62f8e9be1fc680835374e53c482bc969b82fdb6b;hpb=dc4922932780f79df731bc68d4f156f618d2fd25;p=releng%2Fglobal-jjb.git diff --git a/shell/gerrit-push-patch.sh b/shell/gerrit-push-patch.sh index 62f8e9be..8bddfa9d 100644 --- a/shell/gerrit-push-patch.sh +++ b/shell/gerrit-push-patch.sh @@ -44,12 +44,19 @@ set -u # End git-review workaround # Remove any leading or trailing quotes surrounding the strings # which can cause parse errors when passed as CLI options to commands +# shellcheck disable=SC2001 PROJECT="$(echo "$PROJECT" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +# shellcheck disable=SC2001 GERRIT_COMMIT_MESSAGE="$(echo "$GERRIT_COMMIT_MESSAGE" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +# shellcheck disable=SC2001 GERRIT_HOST="$(echo "$GERRIT_HOST" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +# shellcheck disable=SC2001 GERRIT_TOPIC="$(echo "$GERRIT_TOPIC" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +# shellcheck disable=SC2001 GERRIT_USER="$(echo "$GERRIT_USER" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +# shellcheck disable=SC2001 REVIEWERS_EMAIL="$(echo "$REVIEWERS_EMAIL" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g")" +job=$JOB_NAME/$BUILD_NUMBER CHANGE_ID=$(ssh -p 29418 "$GERRIT_USER@$GERRIT_HOST" gerrit query \ limit:1 owner:self is:open project:"$PROJECT" \ @@ -59,9 +66,9 @@ CHANGE_ID=$(ssh -p 29418 "$GERRIT_USER@$GERRIT_HOST" gerrit query \ awk '{ print $2 }') if [ -z "$CHANGE_ID" ]; then - git commit -sm "$GERRIT_COMMIT_MESSAGE" + git commit -sm "$GERRIT_COMMIT_MESSAGE" -m "Job: ${job}" else - git commit -sm "$GERRIT_COMMIT_MESSAGE" -m "Change-Id: $CHANGE_ID" + git commit -sm "$GERRIT_COMMIT_MESSAGE" -m "Job: ${job}\nChange-Id: $CHANGE_ID" fi git status