#13063 F43 Post Cleanups (Automate first, if it dont happen then do it manually) - Due Nov 11 (Two weeks from release)
Opened by jnsamyak. Modified

F43 Post Cleanups (Automate first, if it dont happen then do it manually) - Due Nov 11 (Two weeks from release)


Metadata Update from @amedvede:
- Issue assigned to amedvede

Metadata Update from @amedvede:
- Issue assigned to jnsamyak (was: amedvede)

Metadata Update from @jnsamyak:
- Issue tagged with: medium-gain, medium-trouble, ops

Removing N_Beta from Torrents - DONE!

| msg": "Job started. You can watch the logs with: oc -n mirrormanager logs -f job/job-move-devel-to-release-fedora-linux-43"

PLAY RECAP *********************************************************************************************
os-control01.rdu3.fedoraproject.org : ok=17   changed=8    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
os-control01.stg.rdu3.fedoraproject.org : ok=17   changed=8    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

mirrormanager conf move-to-release script also ran;

Also for removing, I'm testing out the following script:

#!/bin/bash
#
# Fedora Compose Cleanup Script
# Author: Samyak Jain
# Description:
#   Cleans up old Beta/Final RC directories, old composes, and stale development directories.
#   Includes checks for MirrorManager playbook completion and safeguards.
set -euo pipefail
# === CONFIGURATION ===
LOGFILE="/var/log/fedora_compose_cleanup.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')
DRY_RUN=true  # Set to 'false' to actually delete files
# Paths
STAGE_DIR="/pub/alt/stage"
BRANCHED_COMPOSE_DIR="/mnt/koji/compose/branched"
RELEASE_COMPOSE_DIR="/mnt/koji/compose/43"
FEDORA_DEV_DIR="/pub/fedora/linux/development/43"
FEDORA_SECONDARY_DEV_DIR="/pub/fedora-secondary/development/43"
ALT_DEV_DIR="/pub/alt/development"
# === LOGGING FUNCTION ===
log() {
    echo "[$DATE] $1" | tee -a "$LOGFILE"
}
delete_dir() {
    local path="$1"
    if [[ "$DRY_RUN" == true ]]; then
        log "[DRY-RUN] Would remove: $path"
    else
        log "Removing: $path"
        rm -rf "$path"
    fi
}
# === 1. Remove Beta/Final RC directories ===
log "=== Cleaning Beta and Final RC directories from $STAGE_DIR ==="
find "$STAGE_DIR" -maxdepth 1 -type d \( -iname "*Beta*" -o -iname "*Final*" -o -iname "*RC*" \) | while read -r dir; do
    delete_dir "$dir"
done
# === 2. Clean up old composes ===
cleanup_composes() {
    local compose_path="$1"
    log "=== Cleaning old composes in $compose_path ==="
    if [[ -d "$compose_path" ]]; then
        cd "$compose_path"
        local latest
        latest=$(ls -1d * | sort -V | tail -n 1)
        for dir in *; do
            [[ "$dir" == "$latest" ]] && continue
            [[ -d "$dir" ]] && delete_dir "$dir"
        done
    else
        log "Directory not found: $compose_path"
    fi
}
cleanup_composes "$BRANCHED_COMPOSE_DIR"
cleanup_composes "$RELEASE_COMPOSE_DIR"
# === 3. Remove development dirs (2 weeks post release) ===
log "=== Removing development directories (2 weeks post release) ==="
for dir in "$FEDORA_DEV_DIR" "$FEDORA_SECONDARY_DEV_DIR"; do
    [[ -d "$dir" ]] && delete_dir "$dir"
done
# === 4. MirrorManager playbook check ===
MIRROR_CHECK_FILE="/var/run/mirrormanager_ran.flag"
log "=== Checking if MirrorManager playbook has been run ==="
if [[ -f "$MIRROR_CHECK_FILE" ]]; then
    log "MirrorManager playbook has already been run (flag file found)."
else
    log "MirrorManager playbook not yet run. Skipping post-run cleanup."
    log "Creating flag file after run..."
    if [[ "$DRY_RUN" == false ]]; then
        touch "$MIRROR_CHECK_FILE"
    fi
fi
# === 5. Clean up /pub/alt/development except rawhide ===
log "=== Cleaning /pub/alt/development except rawhide ==="
if [[ -d "$ALT_DEV_DIR" ]]; then
    cd "$ALT_DEV_DIR"
    for dir in *; do
        [[ "$dir" == "rawhide" ]] && continue
        [[ -d "$dir" ]] && delete_dir "$dir"
    done
fi
log "=== Cleanup completed successfully ==="

Metadata Update from @jnsamyak:
- Issue untagged with: sprint-4
- Issue tagged with: sprint-5

Metadata