Fix Argo CD Gitea SSH access
Homelab Main / deploy (push) Successful in 1m25s Details

This commit is contained in:
juvdiaz 2026-06-02 16:44:42 -06:00
parent 80df5624e2
commit 57a6a7283c
3 changed files with 12 additions and 5 deletions

View File

@ -10,7 +10,7 @@ variable "argocd_namespace" {
variable "gitops_repo_url" {
type = string
default = "ssh://192.168.100.89:32222/jv/my-homelab-configs.git"
default = "ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git"
}
variable "website_image_ref" {

View File

@ -1014,7 +1014,11 @@ repo_target="$${repo_url#ssh://}"
repo_target="$${repo_target#*@}"
repo_target="$${repo_target%%/*}"
repo_host="$${repo_target%%:*}"
if [ -z "$${repo_host}" ]; then
repo_port="$${repo_target#*:}"
if [ "$${repo_port}" = "$${repo_target}" ]; then
repo_port="22"
fi
if [ -z "$${repo_host}" ] || [ -z "$${repo_port}" ]; then
echo "Could not determine GitOps SSH host from $${repo_url}" >&2
exit 1
fi
@ -1025,7 +1029,11 @@ trap 'rm -f "$${known_hosts_file}" "$${known_hosts_sorted}"' EXIT
kubectl --kubeconfig "${self.triggers.kubeconfig_path}" -n "${self.triggers.namespace}" get configmap argocd-ssh-known-hosts-cm \
-o jsonpath='{.data.ssh_known_hosts}' > "$${known_hosts_file}" 2>/dev/null || true
if [ "$${repo_port}" = "22" ]; then
ssh-keyscan -H "$${repo_host}" >> "$${known_hosts_file}" 2>/dev/null
else
ssh-keyscan -H -p "$${repo_port}" "$${repo_host}" >> "$${known_hosts_file}" 2>/dev/null
fi
sort -u "$${known_hosts_file}" > "$${known_hosts_sorted}"
kubectl --kubeconfig "${self.triggers.kubeconfig_path}" -n "${self.triggers.namespace}" create configmap argocd-ssh-known-hosts-cm \
--from-file=ssh_known_hosts="$${known_hosts_sorted}" \
@ -1555,4 +1563,3 @@ resource "helm_release" "extra_tools" {
}
}
}

View File

@ -20,7 +20,7 @@ variable "calico_operator_node_name" {
variable "gitops_repo_url" {
type = string
default = "ssh://192.168.100.89:32222/jv/my-homelab-configs.git"
default = "ssh://git@192.168.100.89:32222/jv/my-homelab-configs.git"
}
variable "gitops_ssh_key_path" {