X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fgerrit-push-patch.sh;h=8bddfa9db94b5dccd1a3fc206afe72a78174965f;hb=1591cbc2cf8a6cd9591cf95ef7460ff1d17feffd;hp=b70651307417f86597c69e0aeab627a725c18a8f;hpb=dbd05cd4100a27a545cc2c7f0388018449d982c3;p=releng%2Fglobal-jjb.git diff --git a/shell/gerrit-push-patch.sh b/shell/gerrit-push-patch.sh index b7065130..8bddfa9d 100644 --- a/shell/gerrit-push-patch.sh +++ b/shell/gerrit-push-patch.sh @@ -42,15 +42,21 @@ pip install --quiet --upgrade "pip==9.0.3" setuptools pip install --quiet --upgrade git-review 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" \ @@ -60,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