You've already forked git-docker
fix: use whitespaces instead of tabs
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -1,17 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n "${DRONE_WORKSPACE}" ]]; then
|
||||
# ensure the unprivileged drone user can write
|
||||
# to the workspace. This is required because
|
||||
# the workspace is a docker volume and is owned
|
||||
# by root.
|
||||
# sudo mkdir -p ${DRONE_WORKSPACE}
|
||||
# sudo chown drone:drone ${DRONE_WORKSPACE}
|
||||
# ensure the unprivileged drone user can write
|
||||
# to the workspace. This is required because
|
||||
# the workspace is a docker volume and is owned
|
||||
# by root.
|
||||
# sudo mkdir -p ${DRONE_WORKSPACE}
|
||||
# sudo chown drone:drone ${DRONE_WORKSPACE}
|
||||
|
||||
# ensure the workspace is the current working
|
||||
# directory. This should already be the case,
|
||||
# but we cd just to be safe.
|
||||
cd "${DRONE_WORKSPACE}" || exit 1
|
||||
# ensure the workspace is the current working
|
||||
# directory. This should already be the case,
|
||||
# but we cd just to be safe.
|
||||
cd "${DRONE_WORKSPACE}" || exit 1
|
||||
fi
|
||||
|
||||
# force the home directory path.
|
||||
@ -25,7 +25,7 @@ fi
|
||||
# the netrc file.
|
||||
|
||||
if [[ -n "${DRONE_NETRC_MACHINE}" ]]; then
|
||||
cat <<EOF > "${HOME}/.netrc"
|
||||
cat <<EOF > "${HOME}/.netrc"
|
||||
machine ${DRONE_NETRC_MACHINE}
|
||||
login ${DRONE_NETRC_USERNAME}
|
||||
password ${DRONE_NETRC_PASSWORD}
|
||||
@ -36,13 +36,13 @@ fi
|
||||
# the ssh key and add the netrc machine to the
|
||||
# known hosts file.
|
||||
if [[ -n "${DRONE_SSH_KEY}" ]]; then
|
||||
mkdir "${HOME}/.ssh"
|
||||
echo -n "${DRONE_SSH_KEY}" > "${HOME}/.ssh/id_rsa"
|
||||
chmod 600 "${HOME}/.ssh/id_rsa"
|
||||
mkdir "${HOME}/.ssh"
|
||||
echo -n "${DRONE_SSH_KEY}" > "${HOME}/.ssh/id_rsa"
|
||||
chmod 600 "${HOME}/.ssh/id_rsa"
|
||||
|
||||
touch "${HOME}/.ssh/known_hosts"
|
||||
chmod 600 "${HOME}/.ssh/known_hosts"
|
||||
ssh-keyscan -H "${DRONE_NETRC_MACHINE}" > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||
touch "${HOME}/.ssh/known_hosts"
|
||||
chmod 600 "${HOME}/.ssh/known_hosts"
|
||||
ssh-keyscan -H "${DRONE_NETRC_MACHINE}" > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||
fi
|
||||
|
||||
# # AWS codecommit support using AWS access key & secret key
|
||||
@ -62,11 +62,11 @@ fi
|
||||
|
||||
|
||||
if [[ -z "${DRONE_COMMIT_AUTHOR_NAME}" ]]; then
|
||||
export DRONE_COMMIT_AUTHOR_NAME=drone
|
||||
export DRONE_COMMIT_AUTHOR_NAME=drone
|
||||
fi
|
||||
|
||||
if [[ -z "${DRONE_COMMIT_AUTHOR_EMAIL}" ]]; then
|
||||
export DRONE_COMMIT_AUTHOR_EMAIL=drone@localhost
|
||||
export DRONE_COMMIT_AUTHOR_EMAIL=drone@localhost
|
||||
fi
|
||||
|
||||
export GIT_AUTHOR_NAME=${DRONE_COMMIT_AUTHOR_NAME}
|
||||
@ -95,30 +95,30 @@ case ${DRONE_COMMIT_REF} in
|
||||
esac
|
||||
|
||||
git_clone_retry(){
|
||||
retries="${PLUGIN_RETRIES:-0}"
|
||||
if [ -n "${retries##*[0-9]*}" ] || [ "${retries}" -lt 0 ]; then
|
||||
echo "PLUGIN_RETRIES defined but is not a number: ${retries}" >&2
|
||||
exit 1
|
||||
fi
|
||||
retries="${PLUGIN_RETRIES:-0}"
|
||||
if [ -n "${retries##*[0-9]*}" ] || [ "${retries}" -lt 0 ]; then
|
||||
echo "PLUGIN_RETRIES defined but is not a number: ${retries}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cloning with ${retries} retries"
|
||||
n=0
|
||||
until [ "$n" -gt "${retries}" ]; do
|
||||
$1 && return
|
||||
n=$((n+1))
|
||||
done
|
||||
echo "Cloning with ${retries} retries"
|
||||
n=0
|
||||
until [ "$n" -gt "${retries}" ]; do
|
||||
$1 && return
|
||||
n=$((n+1))
|
||||
done
|
||||
|
||||
exit 1
|
||||
exit 1
|
||||
}
|
||||
|
||||
case ${CLONE_TYPE} in
|
||||
pull_request)
|
||||
git_clone_retry clone-pull-request
|
||||
;;
|
||||
git_clone_retry clone-pull-request
|
||||
;;
|
||||
tag)
|
||||
git_clone_retry clone-tag
|
||||
;;
|
||||
git_clone_retry clone-tag
|
||||
;;
|
||||
*)
|
||||
git_clone_retry clone-commit
|
||||
;;
|
||||
git_clone_retry clone-commit
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user