Compare commits
1 Commits
fix/1413
...
burn/1453-
| Author | SHA1 | Date | |
|---|---|---|---|
| b5e4210e6e |
@@ -1,31 +0,0 @@
|
||||
# Issue #1413 Verification
|
||||
|
||||
Status: already implemented on `main`
|
||||
|
||||
## Acceptance criteria check
|
||||
|
||||
1. ✅ `deploy.sh` comment for `nexus-main` uses port `8765`
|
||||
- Evidence: `deploy.sh:3`
|
||||
2. ✅ `deploy.sh` comment for `nexus-staging` uses port `8766`
|
||||
- Evidence: `deploy.sh:4`
|
||||
3. ✅ `docker-compose.yml` confirms those bindings
|
||||
- Evidence: `docker-compose.yml:9` is `"8765:8765"`
|
||||
- Evidence: `docker-compose.yml:15` is `"8766:8765"`
|
||||
|
||||
## Why no code fix was needed
|
||||
|
||||
The issue describes stale comments (`4200` / `4201`), but the current `main` branch already contains the corrected comments:
|
||||
|
||||
```text
|
||||
# Usage: ./deploy.sh — rebuild and restart nexus-main (port 8765)
|
||||
# ./deploy.sh staging — rebuild and restart nexus-staging (port 8766)
|
||||
```
|
||||
|
||||
## Value added in this PR
|
||||
|
||||
- adds `tests/test_deploy_script_ports.py` so future drift between `deploy.sh` comments and `docker-compose.yml` is caught automatically
|
||||
- documents the verification outcome here so the issue can be closed without reimplementing an already-merged fix
|
||||
|
||||
## Recommendation
|
||||
|
||||
Close issue #1413 as already implemented.
|
||||
@@ -35,7 +35,7 @@ for arg in "$@"; do
|
||||
done
|
||||
|
||||
API="$GITEA_URL/api/v1"
|
||||
AUTH="token $GITEA_TOKEN"
|
||||
AUTH="Authorization: token $GITEA_TOKEN"
|
||||
|
||||
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"; }
|
||||
|
||||
@@ -148,6 +148,51 @@ if [ "$DUPLICATES_FOUND" -eq 0 ]; then
|
||||
log "No duplicate PRs found"
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale branches from closed/merged PRs ───
|
||||
log "Checking for stale branches from closed/merged PRs..."
|
||||
|
||||
ALL_PRS=$(curl -s -H "$AUTH" "$API/repos/$REPO/pulls?state=closed&limit=100")
|
||||
STALE_BRANCHES_DELETED=0
|
||||
|
||||
if [ -n "$ALL_PRS" ] && [ "$ALL_PRS" != "null" ]; then
|
||||
echo "$ALL_PRS" | jq -r '.[] | select(.merged == false) | "\(.number)\t(.head.ref)\t\(.state)"' | while IFS=$'\t' read -r pr_num pr_branch pr_state; do
|
||||
[ -z "$pr_branch" ] && continue
|
||||
# Skip if branch doesn't exist
|
||||
branch_check=$(curl -s -o /dev/null -w "%{http_code}" -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch")
|
||||
if [ "$branch_check" != "200" ]; then
|
||||
continue
|
||||
fi
|
||||
log "Stale branch from closed PR #$pr_num: $pr_branch"
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
log "DRY RUN: Would delete branch $pr_branch"
|
||||
else
|
||||
curl -s -X DELETE -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch" > /dev/null
|
||||
log "Deleted branch $pr_branch"
|
||||
STALE_BRANCHES_DELETED=$((STALE_BRANCHES_DELETED + 1))
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale branches from merged PRs ───
|
||||
log "Checking for stale branches from merged PRs..."
|
||||
|
||||
if [ -n "$ALL_PRS" ] && [ "$ALL_PRS" != "null" ]; then
|
||||
echo "$ALL_PRS" | jq -r '.[] | select(.merged == true) | "\(.number)\t\(.head.ref)"' | while IFS=$'\t' read -r pr_num pr_branch; do
|
||||
[ -z "$pr_branch" ] && continue
|
||||
branch_check=$(curl -s -o /dev/null -w "%{http_code}" -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch")
|
||||
if [ "$branch_check" != "200" ]; then
|
||||
continue
|
||||
fi
|
||||
log "Stale branch from merged PR #$pr_num: $pr_branch"
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
log "DRY RUN: Would delete branch $pr_branch"
|
||||
else
|
||||
curl -s -X DELETE -H "$AUTH" "$API/repos/$REPO/branches/$pr_branch" > /dev/null
|
||||
log "Deleted branch $pr_branch"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# ─── Additional cleanup: Stale PRs ────────────────────────
|
||||
# Check for PRs older than 30 days with no activity
|
||||
log "Checking for stale PRs (older than 30 days)..."
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
NEXUS_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def test_deploy_sh_header_comments_match_live_ports():
|
||||
deploy_sh = (NEXUS_ROOT / "deploy.sh").read_text()
|
||||
assert "(port 8765)" in deploy_sh, "deploy.sh should document nexus-main on port 8765"
|
||||
assert "(port 8766)" in deploy_sh, "deploy.sh should document nexus-staging on port 8766"
|
||||
assert "4200" not in deploy_sh, "stale 4200 comment should not remain in deploy.sh"
|
||||
assert "4201" not in deploy_sh, "stale 4201 comment should not remain in deploy.sh"
|
||||
|
||||
|
||||
def test_deploy_sh_comments_match_docker_compose_bindings():
|
||||
deploy_sh = (NEXUS_ROOT / "deploy.sh").read_text().splitlines()
|
||||
compose = (NEXUS_ROOT / "docker-compose.yml").read_text()
|
||||
|
||||
main_comment = next(line for line in deploy_sh if "nexus-main" in line and "port" in line)
|
||||
staging_comment = next(line for line in deploy_sh if "nexus-staging" in line and "port" in line)
|
||||
|
||||
assert '"8765:8765"' in compose, "docker-compose should expose nexus-main on 8765"
|
||||
assert '"8766:8765"' in compose, "docker-compose should expose nexus-staging via host port 8766"
|
||||
assert "8765" in main_comment, "nexus-main deploy comment should cite 8765"
|
||||
assert "8766" in staging_comment, "nexus-staging deploy comment should cite 8766"
|
||||
Reference in New Issue
Block a user