fix: address multiple bugs from code review
- teardown_all.sh: replace `yes |` pipeline with `< <(yes)` process
substitution to avoid SIGPIPE (exit 141) false failures under pipefail
- phase6_teardown.sh: extract push mirror `.id` instead of `.remote_name`
to match the DELETE /push_mirrors/{id} API contract
- phase5_migrate_pipelines.sh: expand sed regex from `[a-z_]*` to
`[a-z_.]*` to handle nested GitHub contexts like
`github.event.pull_request.number`
- lib/common.sh: render_template now requires explicit variable list to
prevent envsubst from eating Nginx variables ($host, $proxy_add_...)
- backup scripts: remove MacBook relay, use direct Unraid↔Fedora SCP;
fix dump path to write to /data/ (mounted volume) instead of /tmp/
(container-only); add unzip -t integrity verification
- preflight.sh: add --skip-port-checks flag for resuming with
--start-from (ports already bound by earlier phases)
- run_all.sh: update run_step to pass extra args; use --skip-port-checks
when --start-from > 1
- post-checks (phase4/7/9): wrap API calls in helper functions with
>/dev/null redirection instead of passing -o /dev/null as API data
- phase8: replace GitHub archiving with [MIRROR] description marking
and disable wiki/projects/Pages (archived repos reject push mirrors)
- restore_to_primary.sh: add require_vars for Fedora SSH variables
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
set -euo pipefail
|
||||
|
||||
# =============================================================================
|
||||
# phase8_teardown.sh — Reverse the cutover: remove HTTPS, un-archive GitHub
|
||||
# phase8_teardown.sh — Reverse the cutover: remove HTTPS, restore GitHub repos
|
||||
# Steps:
|
||||
# 1. Remove Nginx gitea.conf + reload
|
||||
# 2. Remove cert renewal cron
|
||||
# 3. Optionally remove SSL certificates
|
||||
# 4. Un-archive GitHub repos + restore original descriptions
|
||||
# 4. Restore GitHub repo descriptions, re-enable wiki/projects
|
||||
# =============================================================================
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
@@ -67,37 +67,35 @@ if [[ "$SSL_MODE" == "letsencrypt" ]]; then
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Step 4: Un-archive GitHub repos + restore original descriptions
|
||||
# The archive description format is: "[MOVED] ... — was: ORIGINAL_DESC"
|
||||
# Step 4: Restore GitHub repos — description, wiki, projects
|
||||
# The mirror description format is: "[MIRROR] ... — was: ORIGINAL_DESC"
|
||||
# We parse the original description from after "— was: " to restore it.
|
||||
# ---------------------------------------------------------------------------
|
||||
printf 'Un-archive GitHub repos and restore descriptions? [y/N] '
|
||||
printf 'Restore GitHub repo descriptions and re-enable wiki/projects? [y/N] '
|
||||
read -r confirm
|
||||
if [[ "$confirm" =~ ^[Yy]$ ]]; then
|
||||
for repo in "${REPOS[@]}"; do
|
||||
IS_ARCHIVED=$(github_api GET "/repos/${GITHUB_USERNAME}/${repo}" 2>/dev/null | jq -r '.archived' || echo "false")
|
||||
if [[ "$IS_ARCHIVED" != "true" ]]; then
|
||||
log_info "GitHub repo ${repo} not archived — skipping"
|
||||
CURRENT_DESC=$(github_api GET "/repos/${GITHUB_USERNAME}/${repo}" 2>/dev/null | jq -r '.description // ""')
|
||||
if [[ "$CURRENT_DESC" != "[MIRROR]"* ]]; then
|
||||
log_info "GitHub repo ${repo} not marked as mirror — skipping"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Extract original description from the archived description
|
||||
CURRENT_DESC=$(github_api GET "/repos/${GITHUB_USERNAME}/${repo}" 2>/dev/null | jq -r '.description // ""')
|
||||
# Extract original description from the mirror description
|
||||
ORIGINAL_DESC=""
|
||||
if [[ "$CURRENT_DESC" == *" — was: "* ]]; then
|
||||
# Extract everything after "— was: "
|
||||
ORIGINAL_DESC="${CURRENT_DESC##* — was: }"
|
||||
fi
|
||||
|
||||
# Un-archive and restore description
|
||||
# Restore description, homepage, and re-enable wiki/projects
|
||||
RESTORE_PAYLOAD=$(jq -n \
|
||||
--arg description "$ORIGINAL_DESC" \
|
||||
'{archived: false, description: $description}')
|
||||
'{description: $description, homepage: "", has_wiki: true, has_projects: true}')
|
||||
|
||||
if github_api PATCH "/repos/${GITHUB_USERNAME}/${repo}" "$RESTORE_PAYLOAD" >/dev/null 2>&1; then
|
||||
log_success "Un-archived GitHub repo: ${repo}"
|
||||
log_success "Restored GitHub repo: ${repo}"
|
||||
else
|
||||
log_error "Failed to un-archive GitHub repo: ${repo}"
|
||||
log_error "Failed to restore GitHub repo: ${repo}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user