Fix
Some checks failed
Deploy KubeViz / deploy (push) Has been cancelled

This commit is contained in:
2026-03-01 08:39:05 +01:00
parent ee7a118fea
commit 0480ba7e84

View File

@@ -34,16 +34,26 @@ jobs:
exit 1
fi
if [ -z "${token}" ]; then
echo "No token available for git clone."
echo "Set secret CI_REPO_TOKEN with read access to ${repo}."
host="$(printf '%s' "${server_url}" | sed -E 's#https?://##')"
if [ -n "${token}" ]; then
proto="$(printf '%s' "${server_url}" | sed -E 's#(https?://).*#\1#')"
repo_url="${proto}${actor}:${token}@${host}/${repo}.git"
echo "Using token-based checkout."
elif [ -f "${HOME}/.ssh/id_ed25519" ] || [ -f "${HOME}/.ssh/id_rsa" ]; then
mkdir -p "${HOME}/.ssh"
chmod 700 "${HOME}/.ssh"
if [ ! -f "${HOME}/.ssh/known_hosts" ]; then
ssh-keyscan -t rsa,ecdsa,ed25519 "${host}" >> "${HOME}/.ssh/known_hosts"
chmod 600 "${HOME}/.ssh/known_hosts"
fi
repo_url="git@${host}:${repo}.git"
echo "Using SSH deploy-key checkout (${repo_url})."
else
echo "No token available and no SSH key found for git clone."
echo "Either set CI_REPO_TOKEN secret or install deploy key at ${HOME}/.ssh/id_ed25519."
exit 1
fi
proto="$(printf '%s' "${server_url}" | sed -E 's#(https?://).*#\1#')"
host="$(printf '%s' "${server_url}" | sed -E 's#https?://##')"
repo_url="${proto}${actor}:${token}@${host}/${repo}.git"
rm -rf "${workspace}"
mkdir -p "${workspace}"
git clone --depth 1 --no-tags "${repo_url}" "${workspace}"