Merge pull request #76856 from SataQiu/fix-hack-cherrypick-20190420

Fix shellcheck failures of hack/cherry_pick_pull.sh
k3s-v1.15.3
Kubernetes Prow Robot 2019-04-21 09:25:44 -07:00 committed by GitHub
commit 75d45bdfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View File

@ -21,7 +21,6 @@
./cluster/restore-from-backup.sh ./cluster/restore-from-backup.sh
./cluster/test-e2e.sh ./cluster/test-e2e.sh
./cluster/validate-cluster.sh ./cluster/validate-cluster.sh
./hack/cherry_pick_pull.sh
./hack/ginkgo-e2e.sh ./hack/ginkgo-e2e.sh
./hack/grab-profiles.sh ./hack/grab-profiles.sh
./hack/lib/init.sh ./hack/lib/init.sh

View File

@ -84,8 +84,10 @@ shift 1
declare -r PULLS=( "$@" ) declare -r PULLS=( "$@" )
function join { local IFS="$1"; shift; echo "$*"; } function join { local IFS="$1"; shift; echo "$*"; }
declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789" PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
declare -r PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789" declare -r PULLDASH
PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
declare -r PULLSUBJ
echo "+++ Updating remotes..." echo "+++ Updating remotes..."
git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}" git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}"
@ -96,9 +98,12 @@ if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then
exit 1 exit 1
fi fi
declare -r NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools. NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
declare -r NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')" declare -r NEWBRANCHREQ
declare -r NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)" NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
declare -r NEWBRANCH
NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
declare -r NEWBRANCHUNIQ
echo "+++ Creating local branch ${NEWBRANCHUNIQ}" echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
cleanbranch="" cleanbranch=""
@ -128,7 +133,8 @@ trap return_to_kansas EXIT
SUBJECTS=() SUBJECTS=()
function make-a-pr() { function make-a-pr() {
local rel="$(basename "${BRANCH}")" local rel
rel="$(basename "${BRANCH}")"
echo echo
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}" echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
@ -137,7 +143,8 @@ function make-a-pr() {
# when we shove the heredoc at hub directly, tickling the ioctl # when we shove the heredoc at hub directly, tickling the ioctl
# crash. # crash.
prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas prtext="$(mktemp -t prtext.XXXX)" # cleaned in return_to_kansas
local numandtitle=$(printf '%s\n' "${SUBJECTS[@]}") local numandtitle
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
cat >"${prtext}" <<EOF cat >"${prtext}" <<EOF
Automated cherry pick of ${numandtitle} Automated cherry pick of ${numandtitle}
@ -218,7 +225,7 @@ if [[ -n "${DRY_RUN}" ]]; then
exit 0 exit 0
fi fi
if git remote -v | grep ^${FORK_REMOTE} | grep ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git; then if git remote -v | grep ^"${FORK_REMOTE}" | grep "${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"; then
echo "!!! You have ${FORK_REMOTE} configured as your ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git" echo "!!! You have ${FORK_REMOTE} configured as your ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"
echo "This isn't normal. Leaving you with push instructions:" echo "This isn't normal. Leaving you with push instructions:"
echo echo