4NK_env/scripts/check-repos-status.sh
LeCoffre Deployment d8d4530d2d auto_clea
2025-09-25 21:26:28 +00:00

151 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
echo "🔍 VÉRIFICATION DU STATUT DES DÉPÔTS"
echo "==================================="
# Fonction de logging
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
# Liste des projets
declare -a PROJECTS=(
"lecoffre_node"
"sdk_relay"
"sdk_storage"
"sdk_client"
"sdk_common"
"sdk-signer-client"
"ihm_client"
"lecoffre-front"
"doc_api"
"IA_agents"
)
BASE_DIR="/home/debian/4NK_env"
log "📊 Statut des projets dans $BASE_DIR:"
echo ""
for project in "${PROJECTS[@]}"; do
project_path="$BASE_DIR/$project"
echo "📦 $project:"
if [ -d "$project_path" ]; then
cd "$project_path"
# Vérifier si c'est un dépôt Git
if [ -d ".git" ]; then
# Informations Git
current_branch=$(git branch --show-current 2>/dev/null || echo "N/A")
last_commit=$(git log -1 --oneline 2>/dev/null || echo "Aucun commit")
git_status=$(git status --porcelain 2>/dev/null || echo "Erreur Git")
echo " ✅ Dépôt Git détecté"
echo " 📍 Branche: $current_branch"
echo " 📝 Dernier commit: $last_commit"
if [ "$git_status" = "Erreur Git" ]; then
echo " ⚠️ Problème Git détecté"
elif [ -n "$git_status" ]; then
echo " 🔄 Modifications non commitées"
else
echo " ✅ Dépôt propre"
fi
else
echo " ⚠️ Dossier sans dépôt Git"
fi
# Vérifier les fichiers importants
if [ -f "Dockerfile" ]; then
echo " 🐳 Dockerfile présent"
fi
if [ -f "docker-compose.yml" ]; then
echo " 🐙 docker-compose.yml présent"
fi
if [ -f ".env" ]; then
echo " ⚙️ Fichier .env présent"
fi
cd "$BASE_DIR"
else
echo " ❌ Dossier introuvable"
fi
echo ""
done
# Vérifier le dépôt 4NK_env lui-même
log "🏠 Statut du dépôt 4NK_env:"
cd "$BASE_DIR"
if [ -d ".git" ]; then
current_branch=$(git branch --show-current 2>/dev/null || echo "N/A")
last_commit=$(git log -1 --oneline 2>/dev/null || echo "Aucun commit")
git_status=$(git status --porcelain 2>/dev/null || echo "Erreur Git")
echo " ✅ Dépôt Git 4NK_env détecté"
echo " 📍 Branche: $current_branch"
echo " 📝 Dernier commit: $last_commit"
if [ "$git_status" = "Erreur Git" ]; then
echo " ⚠️ Problème Git détecté"
elif [ -n "$git_status" ]; then
echo " 🔄 Modifications non commitées"
else
echo " ✅ Dépôt propre"
fi
else
echo " ⚠️ Dépôt 4NK_env non initialisé"
echo " 💡 Exécutez: ./scripts/init-4nk-env-repo.sh"
fi
echo ""
log "📋 Résumé des actions recommandées:"
# Vérifier quels projets ne sont pas sur la branche ext
ext_missing=()
for project in "${PROJECTS[@]}"; do
project_path="$BASE_DIR/$project"
if [ -d "$project_path/.git" ]; then
cd "$project_path"
current_branch=$(git branch --show-current 2>/dev/null || echo "N/A")
if [ "$current_branch" != "ext" ]; then
ext_missing+=("$project")
fi
cd "$BASE_DIR"
fi
done
if [ ${#ext_missing[@]} -gt 0 ]; then
echo " 🔄 Projets à mettre sur la branche 'ext':"
for project in "${ext_missing[@]}"; do
echo " - $project"
done
echo " 💡 Exécutez: ./scripts/clone-all-repos.sh"
fi
# Vérifier les fichiers manquants
missing_files=()
for file in ".gitignore" ".dockerignore" "README.md"; do
if [ ! -f "$BASE_DIR/$file" ]; then
missing_files+=("$file")
fi
done
if [ ${#missing_files[@]} -gt 0 ]; then
echo " 📄 Fichiers manquants:"
for file in "${missing_files[@]}"; do
echo " - $file"
done
fi
echo ""
log "✅ Vérification terminée"