fix: use whitespaces instead of tabs
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Markus Pesch 2023-10-01 20:44:02 +02:00
parent 8e901429a3
commit 9fae1f4211
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 63 additions and 63 deletions

View File

@ -1,10 +1,13 @@
#!/bin/bash
set -e
set -x
FLAGS=""
GIT_FETCH_ARGS=""
GIT_CHECKOUT_ARGS=""
if [[ -n "${PLUGIN_DEPTH}" ]]; then
FLAGS="--depth=${PLUGIN_DEPTH}"
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} --depth=${PLUGIN_DEPTH}"
fi
if [ ! -d .git ]; then
@ -18,28 +21,25 @@ fi
# we intentially omit depth flags to avoid failed
# clones due to lack of history.
if [[ -z "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
set -e
set -x
git fetch origin
git checkout --quiet --force "${DRONE_COMMIT_SHA}"
exit 0
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} --quiet --force ${DRONE_COMMIT_SHA}"
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin"
fi
# the commit sha may be empty for builds that are
# manually triggered in Harness CI Enterprise. If
# the commit is empty we clone the branch.
if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -z "${DRONE_COMMIT_SHA}" ]]; then
set -e
set -x
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git checkout -b "${DRONE_COMMIT_BRANCH}" "refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
exit 0
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${DRONE_COMMIT_BRANCH} refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
fi
# if the commit sha and branch name not empty, fetch the branch even if a
# fast-forward is not possible. Checkout the specified commit sha which must be
# part of the branch.
set -e
set -x
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git checkout "${DRONE_COMMIT_SHA}" -b "refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${DRONE_COMMIT_SHA} -b refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
fi
git fetch ${GIT_FETCH_ARGS}
git checkout ${GIT_CHECKOUT_ARGS}

View File

@ -13,7 +13,7 @@ fi
set -e
set -x
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:"
git fetch ${FLAGS} origin "+refs/heads/${DRONE_COMMIT_BRANCH}:"
git checkout "${DRONE_COMMIT_BRANCH}"
git fetch origin "${DRONE_COMMIT_REF}:"

View File

@ -13,5 +13,5 @@ fi
set -e
set -x
git fetch "${FLAGS}" origin "+refs/tags/${DRONE_TAG}:"
git fetch ${FLAGS} origin "+refs/tags/${DRONE_TAG}:"
git checkout --quiet --force FETCH_HEAD