49 lines
1.7 KiB
Bash
Executable File
49 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
source_root="${SOURCE_ROOT:-../sources}"
|
|
captured_at="$(date --iso-8601=seconds)"
|
|
|
|
printf 'captured_at: "%s"\n' "$captured_at"
|
|
printf 'source_root: "%s"\n' "$source_root"
|
|
printf 'sources:\n'
|
|
|
|
repo_names=(ai-soulmate-server ai-soulmate-client mlkj-admin nginx-server)
|
|
for repo_name in "${repo_names[@]}"; do
|
|
repo_path="$source_root/$repo_name"
|
|
printf ' - name: "%s"\n' "$repo_name"
|
|
printf ' path: "%s"\n' "$repo_path"
|
|
if [[ ! -d "$repo_path/.git" ]]; then
|
|
printf ' available: false\n'
|
|
printf ' reason: "git repository not found"\n'
|
|
continue
|
|
fi
|
|
|
|
commit_id="$(git -C "$repo_path" rev-parse HEAD)"
|
|
branch_name="$(git -C "$repo_path" branch --show-current)"
|
|
remote_url="$(git -C "$repo_path" remote get-url origin 2>/dev/null || true)"
|
|
sanitized_remote="$(printf '%s' "$remote_url" | sed -E 's#(https?://)[^/@]+@#\1#')"
|
|
if [[ -n "$(git -C "$repo_path" status --porcelain)" ]]; then
|
|
local_status=dirty
|
|
else
|
|
local_status=clean
|
|
fi
|
|
tracked_env_files="$(git -C "$repo_path" ls-files | grep -E '(^|/)\.env($|\.)' | grep -vE '\.example$' || true)"
|
|
if [[ -n "$tracked_env_files" ]]; then
|
|
tracked_env=true
|
|
else
|
|
tracked_env=false
|
|
fi
|
|
|
|
printf ' available: true\n'
|
|
printf ' branch: "%s"\n' "$branch_name"
|
|
printf ' commit: "%s"\n' "$commit_id"
|
|
printf ' local_status: "%s"\n' "$local_status"
|
|
printf ' origin: "%s"\n' "$sanitized_remote"
|
|
printf ' tracked_env_files: %s\n' "$tracked_env"
|
|
done
|
|
|
|
printf 'notes:\n'
|
|
printf ' - "This report records the checked-out state only; it does not validate deployment compatibility."\n'
|
|
printf ' - "Review tracked environment files and rotate any credentials before deployment."\n'
|