REMOTE name fixes for variables
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
REPOSITORY="$1";
|
||||
BRANCH="$2";
|
||||
REMOTE_HOST="$3";
|
||||
REMOTE="$4";
|
||||
if [ -n "${REMOTE}" ]; then
|
||||
REMOTE="origin"
|
||||
REMOTE_NAME="$4";
|
||||
if [ -n "${REMOTE_NAME}" ]; then
|
||||
REMOTE_NAME="origin"
|
||||
fi;
|
||||
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
||||
# shellcheck source=init.sh
|
||||
@@ -27,11 +27,14 @@ fi;
|
||||
if [[ "${REPOSITORY}" == *":"* ]]; then
|
||||
REPOSITORY=$(echo "${REPOSITORY}" | cut -d ":" -f 2);
|
||||
fi;
|
||||
if [ $error -eq 1 ]; then
|
||||
exit;
|
||||
fi;
|
||||
|
||||
error=0
|
||||
echo "* Validate SSH PEM Key exist and SSH config";
|
||||
if ! grep "Host ${REMOTE}" "${GIT_WEBHOOK_BASE_FOLDER}"/.ssh/config; then
|
||||
echo "ssh config entry for Host ${REMOTE} is missing";
|
||||
if ! grep "Host ${REMOTE_HOST}" "${GIT_WEBHOOK_BASE_FOLDER}"/.ssh/config; then
|
||||
echo "ssh config entry for Host ${REMOTE_HOST} is missing";
|
||||
error=1;
|
||||
else
|
||||
# make sure the identiy file is there
|
||||
@@ -52,7 +55,7 @@ fi;
|
||||
GIT_REPOSITORY_FOLDER=$(basename "${REPOSITORY}" .git);
|
||||
|
||||
echo "* New clone from ${REMOTE_HOST}:${REPOSITORY}/${BRANCH} into ${GIT_REPOSITORY_FOLDER}";
|
||||
GIT_COMMAND=("${GIT_COMMAND_BASE[@]}" "clone" "-b" "${BRANCH}" "--single-branch" "--depth" "1" "--origin" "${REMOTE}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}")
|
||||
GIT_COMMAND=("${GIT_COMMAND_BASE[@]}" "clone" "-b" "${BRANCH}" "--single-branch" "--depth" "1" "--origin" "${REMOTE_NAME}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}")
|
||||
echo "Command: ${GIT_COMMAND[*]}"
|
||||
# echo ${GIT_COMMAND_BASE} clone -b "${BRANCH}" --single-branch --depth 1 --origin "${REMOTE}" "${REMOTE_HOST}:${REPOSITORY}" "${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user