Files
ilkerandClaude Opus 5.5 ec96d7f5bc
ci / derle (push) Failing after 54s
hpcod: CI/CD (gitea actions: vet, test, govulncheck, paketle; hpcod-v* tag'inde web'e dagitim)
Yalnizca hpcod/ icin (paths: hpcod/**, .gitea/**). Tag hpcod-v1.2.3 ->
deploy-al surumu v1.2.3; surum ikiliye main.releaseVersion olarak yazilir.
Paket yalnizca /usr/local/bin/hpcod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 00:44:03 +02:00

32 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Paketi hedef sunuculara deploy-al ile gonderir (CI'da tag isinde calisir).
#
# .gitea/dagit.sh <paket.tar.gz> <uygulama> <surum> <hedef>... # hedef: web c1 c2 c3
#
# Ortam: DEPLOY_KEY (org/repo secret), DEPLOY_KNOWN_HOSTS (org/repo degiskeni).
# Anahtar sunucularda yalnizca /usr/local/sbin/deploy-al'i calistirabilir; c3'e
# hjump uzerinden (yalnizca 10.20.0.20:22 tuneli) gidilir.
# Kaynak: gitea.mynodes.xyz ilker/altyapi dagitim/sablon/ (degisiklik orada yapilir).
set -euo pipefail
P=$1 U=$2 V=$3; shift 3
[ -s "$P" ] || { echo "paket yok: $P" >&2; exit 1; }
: "${DEPLOY_KEY:?DEPLOY_KEY yok}" "${DEPLOY_KNOWN_HOSTS:?DEPLOY_KNOWN_HOSTS yok}"
d=$(mktemp -d); trap 'rm -rf "$d"' EXIT
printf '%s\n' "$DEPLOY_KEY" > "$d/k"; chmod 600 "$d/k"
printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$d/kh"
o=(-i "$d/k" -o IdentitiesOnly=yes -o BatchMode=yes -o UserKnownHostsFile="$d/kh"
-o StrictHostKeyChecking=yes -o ConnectTimeout=20 -o ServerAliveInterval=15)
for h in "$@"; do
echo "== $U $V -> $h"
case "$h" in
web) ssh "${o[@]}" root@10.0.0.11 "$U $V" < "$P" ;;
c1) ssh "${o[@]}" root@ns1.example.org "$U $V" < "$P" ;;
c2) ssh "${o[@]}" root@ns3.example.org "$U $V" < "$P" ;;
c3) ssh "${o[@]}" -o "ProxyCommand=ssh ${o[*]} -p 40020 -W %h:%p ilker@prox01.example.org" \
root@10.20.0.20 "$U $V" < "$P" ;;
*) echo "bilinmeyen hedef: $h" >&2; exit 1 ;;
esac
done