From 7c9a02f298fa9923e4f5666617059f33b36d8526 Mon Sep 17 00:00:00 2001 From: jenkins Date: Thu, 13 Aug 2026 21:25:44 -0300 Subject: [PATCH] gitea: migrate canary repository consumers --- scripts/ops/hermes_code_demo.sh | 18 +++++++++--------- scripts/ops/hermes_demo_lib.sh | 1 + scripts/ops/hermes_triage_monitor.py | 3 ++- services/jenkins/configmap-jcasc.yaml | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/ops/hermes_code_demo.sh b/scripts/ops/hermes_code_demo.sh index 7638ce52c..2e42db21f 100755 --- a/scripts/ops/hermes_code_demo.sh +++ b/scripts/ops/hermes_code_demo.sh @@ -38,9 +38,9 @@ cmd_reset() { note "GITEA_TOKEN unset; skipping repository cleanup" else for repo in $DEMO_REPOS; do - note "clearing bstein/$repo (demo repository)" + note "clearing ${CODE_REPO_OWNER}/$repo (demo repository)" local items - items="$(gitea_get "/api/v1/repos/bstein/$repo/issues?state=all&limit=100" | + items="$(gitea_get "/api/v1/repos/${CODE_REPO_OWNER}/$repo/issues?state=all&limit=100" | python3 -c 'import json,sys for i in json.load(sys.stdin): print(i["number"], "pr" if i.get("pull_request") else "issue")' 2>/dev/null || true)" @@ -50,13 +50,13 @@ for i in json.load(sys.stdin): while read -r num kind; do [ -z "$num" ] && continue curl -s --max-time 25 -o /dev/null -X DELETE -H "Authorization: token $GITEA_TOKEN" \ - "$GITEA_URL/api/v1/repos/bstein/$repo/issues/$num" + "$GITEA_URL/api/v1/repos/${CODE_REPO_OWNER}/$repo/issues/$num" note " deleted $kind #$num" done <<< "$items" fi local branches - branches="$(gitea_get "/api/v1/repos/bstein/$repo/branches" | + branches="$(gitea_get "/api/v1/repos/${CODE_REPO_OWNER}/$repo/branches" | python3 -c 'import json,sys,urllib.parse for b in json.load(sys.stdin): if b["name"].startswith("hermes-repair/"): @@ -66,7 +66,7 @@ for b in json.load(sys.stdin): else for ref in $branches; do curl -s --max-time 25 -o /dev/null -X DELETE -H "Authorization: token $GITEA_TOKEN" \ - "$GITEA_URL/api/v1/repos/bstein/$repo/branches/$ref" + "$GITEA_URL/api/v1/repos/${CODE_REPO_OWNER}/$repo/branches/$ref" note " deleted branch $(printf '%b' "${ref//%/\\x}")" done fi @@ -124,7 +124,7 @@ cmd_preflight() { note "demo repository: NOT CLONED at $CODE_REPO_DIR" fi local open_prs - open_prs="$(gitea_get "/api/v1/repos/bstein/hermes-code-demo/pulls?state=open" 2>/dev/null | + open_prs="$(gitea_get "/api/v1/repos/${CODE_REPO_OWNER}/hermes-code-demo/pulls?state=open" 2>/dev/null | python3 -c 'import json,sys; print(len(json.load(sys.stdin)))' 2>/dev/null || echo '?')" note "open hermes-code-demo PRs: $open_prs (must be 0 — the duplicate guard refuses while one is open)" note "code proposals enabled: $(kubectl -n maintenance exec deploy/ariadne -c ariadne -- printenv ARIADNE_HERMES_CODE_ENABLED 2>/dev/null)" @@ -135,12 +135,12 @@ cmd_preflight() { cmd_status() { shared_status say "Open proposals" - note "https://scm.bstein.dev/bstein/hermes-code-demo/pulls" + note "$GITEA_URL/${CODE_REPO_OWNER}/hermes-code-demo/pulls" } cmd_run() { require_jenkins - [ -d "$CODE_REPO_DIR/.git" ] || { echo "clone bstein/hermes-code-demo to $CODE_REPO_DIR first" >&2; exit 1; } + [ -d "$CODE_REPO_DIR/.git" ] || { echo "clone ${CODE_REPO_OWNER}/hermes-code-demo to $CODE_REPO_DIR first" >&2; exit 1; } local start_num next_num start_num="$(last_build_number "$CODE_JOB")" next_num=$((start_num + 1)) @@ -189,7 +189,7 @@ PY ariadne_ticks 400 3 say "Pull request awaiting human review (nothing merges automatically)" - note "https://scm.bstein.dev/bstein/hermes-code-demo/pulls" + note "$GITEA_URL/${CODE_REPO_OWNER}/hermes-code-demo/pulls" } case "${1:-}" in diff --git a/scripts/ops/hermes_demo_lib.sh b/scripts/ops/hermes_demo_lib.sh index fa664cab4..7505f0cc3 100755 --- a/scripts/ops/hermes_demo_lib.sh +++ b/scripts/ops/hermes_demo_lib.sh @@ -27,6 +27,7 @@ done JENKINS_URL="${JENKINS_URL:-https://ci.bstein.dev}" GITEA_URL="${GITEA_URL:-https://scm.bstein.dev}" +CODE_REPO_OWNER="${CODE_REPO_OWNER:-atlas}" FIXTURE_JOB="hermes-triage-demo" CODE_JOB="hermes-code-demo" DEMO_NS="hermes-triage-demo" diff --git a/scripts/ops/hermes_triage_monitor.py b/scripts/ops/hermes_triage_monitor.py index d5362c35c..303f182a2 100755 --- a/scripts/ops/hermes_triage_monitor.py +++ b/scripts/ops/hermes_triage_monitor.py @@ -38,6 +38,7 @@ NS_DEMO = "hermes-triage-demo" NS_ARIADNE = "maintenance" JENKINS = os.environ.get("JENKINS_URL", "https://ci.bstein.dev") GITEA = os.environ.get("GITEA_URL", "https://scm.bstein.dev") +CODE_REPO_OWNER = os.environ.get("CODE_REPO_OWNER", "atlas") GRAFANA = os.environ.get("GRAFANA_URL", "https://metrics.bstein.dev") HERMES_UI = os.environ.get("HERMES_URL", "https://agent.hermes.bstein.dev") POLL_SECONDS = 6 @@ -395,7 +396,7 @@ def evidence_for(key: str, incident: str = "") -> None: print(f" {DIM}the pull request Ariadne opened is recorded on the incident above" f" (branch, pr_number, url). Hermes produced the patch as data; Ariadne" f" validated it and pushed the branch.{RESET}") - print(f" {YELLOW}pull requests: {GITEA}/bstein/hermes-code-demo/pulls{RESET}\n") + print(f" {YELLOW}pull requests: {GITEA}/{CODE_REPO_OWNER}/hermes-code-demo/pulls{RESET}\n") else: run(["kubectl", "-n", NS_DEMO, "get", "cm", "hermes-triage-demo-fixture", "-o", "jsonpath={.data.state}"]) diff --git a/services/jenkins/configmap-jcasc.yaml b/services/jenkins/configmap-jcasc.yaml index dfdfbc6e1..43f4cc7d2 100644 --- a/services/jenkins/configmap-jcasc.yaml +++ b/services/jenkins/configmap-jcasc.yaml @@ -464,7 +464,7 @@ data: source { git { id('hermes-code-demo-branches') - remote('https://scm.bstein.dev/bstein/hermes-code-demo.git') + remote('https://scm.bstein.dev/atlas/hermes-code-demo.git') credentialsId('gitea-pat') traits { gitBranchDiscovery() @@ -497,7 +497,7 @@ data: scm { git { remote { - url('https://scm.bstein.dev/bstein/hermes-code-demo.git') + url('https://scm.bstein.dev/atlas/hermes-code-demo.git') credentials('gitea-pat') } branches('*/master')