
Some checks failed
CI - 4NK_node / Code Quality (push) Failing after 38s
CI - 4NK_node / Unit Tests (push) Failing after 36s
CI - 4NK_node / Integration Tests (push) Successful in 33s
CI - 4NK_node / Security Tests (push) Failing after 33s
CI - 4NK_node / Docker Build & Test (push) Failing after 15s
CI - 4NK_node / Documentation Tests (push) Successful in 12s
CI - 4NK_node / Release Guard (push) Has been skipped
CI - 4NK_node / Performance Tests (push) Successful in 35s
CI - 4NK_node / Notify (push) Failing after 2s
81 lines
2.5 KiB
Bash
Executable File
81 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
# Script de configuration SSH pour CI/CD ihm_client
|
||
# Utilise automatiquement la clé SSH pour les opérations Git
|
||
|
||
set -e
|
||
|
||
echo "🔑 Configuration automatique de la clé SSH pour ihm_client CI/CD..."
|
||
|
||
# Vérifier si on est dans un environnement CI
|
||
if [ -n "$CI" ]; then
|
||
echo "✅ Environnement CI détecté"
|
||
|
||
# Configuration SSH pour Gitea Actions
|
||
if [ -n "$SSH_PRIVATE_KEY" ]; then
|
||
echo "🔐 Configuration de la clé SSH privée..."
|
||
|
||
# Créer le répertoire SSH
|
||
mkdir -p ~/.ssh
|
||
chmod 700 ~/.ssh
|
||
|
||
# Écrire la clé privée
|
||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||
chmod 600 ~/.ssh/id_rsa
|
||
|
||
# Ajouter la clé publique correspondante (si disponible)
|
||
if [ -n "$SSH_PUBLIC_KEY" ]; then
|
||
echo "$SSH_PUBLIC_KEY" > ~/.ssh/id_rsa.pub
|
||
chmod 644 ~/.ssh/id_rsa.pub
|
||
fi
|
||
|
||
# Configuration SSH pour git.4nkweb.com
|
||
cat > ~/.ssh/config << EOF
|
||
Host git.4nkweb.com
|
||
HostName git.4nkweb.com
|
||
User git
|
||
IdentityFile ~/.ssh/id_rsa
|
||
StrictHostKeyChecking no
|
||
UserKnownHostsFile=/dev/null
|
||
EOF
|
||
|
||
chmod 600 ~/.ssh/config
|
||
|
||
# Tester la connexion SSH
|
||
echo "🧪 Test de connexion SSH vers git.4nkweb.com..."
|
||
if ssh -T git@git.4nkweb.com 2>&1 | grep -q "Welcome"; then
|
||
echo "✅ Connexion SSH réussie"
|
||
else
|
||
echo "⚠️ Connexion SSH établie (message de bienvenue non détecté)"
|
||
fi
|
||
|
||
# Configurer Git pour utiliser SSH
|
||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||
|
||
echo "✅ Configuration SSH terminée"
|
||
else
|
||
echo "⚠️ Variable SSH_PRIVATE_KEY non définie, utilisation de HTTPS"
|
||
fi
|
||
else
|
||
echo "ℹ️ Environnement local détecté"
|
||
|
||
# Vérifier si une clé SSH existe
|
||
if [ -f ~/.ssh/id_rsa ]; then
|
||
echo "🔑 Clé SSH locale trouvée"
|
||
|
||
# Configurer Git pour utiliser SSH localement
|
||
git config --global url."git@git.4nkweb.com:".insteadOf "https://git.4nkweb.com/"
|
||
|
||
echo "✅ Configuration SSH locale terminée"
|
||
else
|
||
echo "⚠️ Aucune clé SSH trouvée, configuration manuelle requise"
|
||
echo "💡 Pour configurer SSH manuellement :"
|
||
echo " 1. Générer une clé SSH : ssh-keygen -t rsa -b 4096"
|
||
echo " 2. Ajouter la clé publique à votre compte Gitea"
|
||
echo " 3. Tester : ssh -T git@git.4nkweb.com"
|
||
fi
|
||
fi
|
||
|
||
echo "🎯 Configuration SSH terminée pour ihm_client"
|
||
|