gitea: migrate canary repository consumers

This commit is contained in:
jenkins 2026-08-13 21:25:44 -03:00
parent 8a7616ea04
commit 7c9a02f298
4 changed files with 14 additions and 12 deletions

View File

@ -38,9 +38,9 @@ cmd_reset() {
note "GITEA_TOKEN unset; skipping repository cleanup" note "GITEA_TOKEN unset; skipping repository cleanup"
else else
for repo in $DEMO_REPOS; do for repo in $DEMO_REPOS; do
note "clearing bstein/$repo (demo repository)" note "clearing ${CODE_REPO_OWNER}/$repo (demo repository)"
local items 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 python3 -c 'import json,sys
for i in json.load(sys.stdin): for i in json.load(sys.stdin):
print(i["number"], "pr" if i.get("pull_request") else "issue")' 2>/dev/null || true)" 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 while read -r num kind; do
[ -z "$num" ] && continue [ -z "$num" ] && continue
curl -s --max-time 25 -o /dev/null -X DELETE -H "Authorization: token $GITEA_TOKEN" \ 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" note " deleted $kind #$num"
done <<< "$items" done <<< "$items"
fi fi
local branches 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 python3 -c 'import json,sys,urllib.parse
for b in json.load(sys.stdin): for b in json.load(sys.stdin):
if b["name"].startswith("hermes-repair/"): if b["name"].startswith("hermes-repair/"):
@ -66,7 +66,7 @@ for b in json.load(sys.stdin):
else else
for ref in $branches; do for ref in $branches; do
curl -s --max-time 25 -o /dev/null -X DELETE -H "Authorization: token $GITEA_TOKEN" \ 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}")" note " deleted branch $(printf '%b' "${ref//%/\\x}")"
done done
fi fi
@ -124,7 +124,7 @@ cmd_preflight() {
note "demo repository: NOT CLONED at $CODE_REPO_DIR" note "demo repository: NOT CLONED at $CODE_REPO_DIR"
fi fi
local open_prs 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 '?')" 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 "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)" 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() { cmd_status() {
shared_status shared_status
say "Open proposals" 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() { cmd_run() {
require_jenkins 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 local start_num next_num
start_num="$(last_build_number "$CODE_JOB")" start_num="$(last_build_number "$CODE_JOB")"
next_num=$((start_num + 1)) next_num=$((start_num + 1))
@ -189,7 +189,7 @@ PY
ariadne_ticks 400 3 ariadne_ticks 400 3
say "Pull request awaiting human review (nothing merges automatically)" 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 case "${1:-}" in

View File

@ -27,6 +27,7 @@ done
JENKINS_URL="${JENKINS_URL:-https://ci.bstein.dev}" JENKINS_URL="${JENKINS_URL:-https://ci.bstein.dev}"
GITEA_URL="${GITEA_URL:-https://scm.bstein.dev}" GITEA_URL="${GITEA_URL:-https://scm.bstein.dev}"
CODE_REPO_OWNER="${CODE_REPO_OWNER:-atlas}"
FIXTURE_JOB="hermes-triage-demo" FIXTURE_JOB="hermes-triage-demo"
CODE_JOB="hermes-code-demo" CODE_JOB="hermes-code-demo"
DEMO_NS="hermes-triage-demo" DEMO_NS="hermes-triage-demo"

View File

@ -38,6 +38,7 @@ NS_DEMO = "hermes-triage-demo"
NS_ARIADNE = "maintenance" NS_ARIADNE = "maintenance"
JENKINS = os.environ.get("JENKINS_URL", "https://ci.bstein.dev") JENKINS = os.environ.get("JENKINS_URL", "https://ci.bstein.dev")
GITEA = os.environ.get("GITEA_URL", "https://scm.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") GRAFANA = os.environ.get("GRAFANA_URL", "https://metrics.bstein.dev")
HERMES_UI = os.environ.get("HERMES_URL", "https://agent.hermes.bstein.dev") HERMES_UI = os.environ.get("HERMES_URL", "https://agent.hermes.bstein.dev")
POLL_SECONDS = 6 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" 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" (branch, pr_number, url). Hermes produced the patch as data; Ariadne"
f" validated it and pushed the branch.{RESET}") 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: else:
run(["kubectl", "-n", NS_DEMO, "get", "cm", "hermes-triage-demo-fixture", run(["kubectl", "-n", NS_DEMO, "get", "cm", "hermes-triage-demo-fixture",
"-o", "jsonpath={.data.state}"]) "-o", "jsonpath={.data.state}"])

View File

@ -464,7 +464,7 @@ data:
source { source {
git { git {
id('hermes-code-demo-branches') 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') credentialsId('gitea-pat')
traits { traits {
gitBranchDiscovery() gitBranchDiscovery()
@ -497,7 +497,7 @@ data:
scm { scm {
git { git {
remote { remote {
url('https://scm.bstein.dev/bstein/hermes-code-demo.git') url('https://scm.bstein.dev/atlas/hermes-code-demo.git')
credentials('gitea-pat') credentials('gitea-pat')
} }
branches('*/master') branches('*/master')