4NK_template/scripts/agents/deployment_agent.sh

34 lines
1.3 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR="${1:-.}"
OUTPUT_DIR="${2:-tests/reports/agents}"
mkdir -p "$OUTPUT_DIR"
SUMMARY_FILE="$OUTPUT_DIR/deployment_agent.md"
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh" || true
echo "# Agent Déploiement" > "$SUMMARY_FILE"
echo >> "$SUMMARY_FILE"
pushd "$TARGET_DIR" >/dev/null
if [[ "$SCOPE" == "changed" ]]; then
relevant=(docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml)
any=0; for p in "${relevant[@]}"; do if is_path_changed "$p"; then any=1; break; fi; done
if [[ $any -eq 0 ]]; then echo "- Aucun changement pertinent (SCOPE=changed)." >> "$SUMMARY_FILE"; echo "Rapport: $SUMMARY_FILE"; popd >/dev/null; exit 0; fi
fi
echo "## Résultats locaux" >> "$SUMMARY_FILE"
ok=1
for f in docs/DEPLOYMENT.md docs/RELEASE_PLAN.md .gitea/workflows/ci.yml; do
if [[ ! -e "$f" ]]; then echo "- Manquant: $f" >> "$SUMMARY_FILE"; ok=0; fi
done
if [[ $ok -eq 1 ]]; then echo "- Prérequis documentaires présents." >> "$SUMMARY_FILE"; fi
PROMPT=$(cat <<'EOF'
Établis une checklist de déploiement minimale (préchecks, variables, smoke tests, rollback, postdeploy) adaptée à un template CI Gitea.
EOF
)
scripts/agents/ai_prompt.sh "$PROMPT" >> "$SUMMARY_FILE" || true
echo "Rapport: $SUMMARY_FILE"
popd >/dev/null