public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Oleg Obleukhov <leoleovich@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/oscillatord] rawhide: rebuild: make reruns finish the job
Date: Fri, 13 Nov 2026 14:56:51 GMT	[thread overview]
Message-ID: <179458181103.1.13553038960509123105.rpms-oscillatord-f96f7cee61e4@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/oscillatord
            Branch : rawhide
            Commit : f96f7cee61e43e2549882350bccc89bc75a191ce
            Author : Oleg Obleukhov <leoleovich@fedoraproject.org>
            Date   : 2026-11-13T14:55:52+00:00
            Stats  : +73/-33 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/oscillatord/c/f96f7cee61e43e2549882350bccc89bc75a191ce?branch=rawhide

            Log:
            rebuild: make reruns finish the job

Bodhi printed its login message on stdout, which the summary took for the update URL, and its login endpoint dropped connections for four of seven branches. Retry dropped Bodhi requests in one process, looking for the update first since a create whose reply was dropped may have gone through, and keep the tracebacks in the branch log. A rerun skips branches that already have an update (their side tag may be merged and gone) and asks for the SSH key only when something needs pushing.

[skip changelog]

---
diff --git a/rebuild/bodhi_helper.py b/rebuild/bodhi_helper.py
index f334af4..101c4a0 100755
--- a/rebuild/bodhi_helper.py
+++ b/rebuild/bodhi_helper.py
@@ -1,15 +1,19 @@
 #!/usr/bin/env python3
 """Bodhi helper for release-inner.sh.
 
-bodhi_helper.py releases                   active releases as dist-git branch names (rawhide and ELN excluded)
-bodhi_helper.py find NVR                   URL of an existing update containing NVR, or nothing
-bodhi_helper.py create-from-tag NOTES TAG  file one update from a Koji side tag, print its URL
+bodhi_helper.py releases                     active releases as dist-git branch names (rawhide and ELN excluded)
+bodhi_helper.py find NVR                     URL of an existing update containing NVR, or nothing
+bodhi_helper.py ensure-update NOTES TAG NVR  URL of the update containing NVR, filed from side tag TAG if missing
 """
 
+import contextlib
 import re
 import sys
+import time
 
-from bodhi.client.bindings import BodhiClient
+import requests
+from bodhi.client.bindings import BodhiClient, BodhiClientException
+from bodhi.client.oidcclient import OIDCClientError
 
 
 def branch(release):
@@ -23,6 +27,39 @@ def order(b):
     return (m.group(1) == "epel", -int(m.group(2)), m.group(3) is not None, -int(m.group(3) or 0))
 
 
+def find(client, nvr):
+    for u in client.query(builds=nvr)["updates"]:
+        return u["url"]
+    return None
+
+
+def ensure_update(client, notes, tag, nvr, attempts=6):
+    # Bodhi drops connections now and then, and a create whose reply was dropped may still have gone through.
+    for attempt in range(attempts):
+        try:
+            url = find(client, nvr)
+            if url:
+                return url
+            # The client prints its login progress to stdout, which carries the URL.
+            with contextlib.redirect_stdout(sys.stderr):
+                resp = client.save(
+                    from_tag=tag,
+                    type="enhancement",
+                    severity="low",
+                    notes=notes,
+                    autokarma=True,
+                    autotime=True,
+                    stable_karma=1,
+                    unstable_karma=-3,
+                )
+            return resp.get("updates", [resp])[0]["url"]
+        except (BodhiClientException, OIDCClientError) as e:
+            if not isinstance(e.__context__, requests.exceptions.RequestException) or attempt == attempts - 1:
+                raise
+            print(f"Bodhi dropped the connection ({e}), retrying", file=sys.stderr)
+            time.sleep(15 * 2**attempt)
+
+
 def main():
     cmd = sys.argv[1]
     client = BodhiClient()
@@ -42,24 +79,11 @@ def main():
         keep = [b for b in seen if re.fullmatch(r"f\d+|epel\d+(\.\d+)?", b)]
         print(" ".join(sorted(keep, key=order)))
     elif cmd == "find":
-        for u in client.query(builds=sys.argv[2])["updates"]:
-            print(u["url"])
-            return
-    elif cmd == "create-from-tag":
-        notes, tag = sys.argv[2], sys.argv[3]
-        client.ensure_auth()
-        resp = client.save(
-            from_tag=tag,
-            type="enhancement",
-            severity="low",
-            notes=notes,
-            autokarma=True,
-            autotime=True,
-            stable_karma=1,
-            unstable_karma=-3,
-        )
-        for u in resp.get("updates", [resp]):
-            print(u["url"])
+        url = find(client, sys.argv[2])
+        if url:
+            print(url)
+    elif cmd == "ensure-update":
+        print(ensure_update(client, *sys.argv[2:5]))
     else:
         sys.exit(f"unknown command {cmd}")
 

diff --git a/rebuild/release-inner.sh b/rebuild/release-inner.sh
index a0e8259..a642e97 100755
--- a/rebuild/release-inner.sh
+++ b/rebuild/release-inner.sh
@@ -172,17 +172,26 @@ for p in "${need[@]}"; do
   git -C "$d" add "$p.spec" sources .gitignore
   git -C "$d" commit -q -m "Update to $version"
 done
-ssh_login
+pending=0
 for p in "${pkgs[@]}"; do
-  d=$(co "$p")
-  refs=(rawhide)
   for b in "${targets[@]}"; do
-    [ "$b" = rawhide ] || [ -n "${blocked[$b]:-}" ] || refs+=("rawhide:$b")
+    [ -n "${blocked[$b]:-}" ] && continue
+    [ "$(git -C "$(co "$p")" rev-parse "origin/$b")" = "$(git -C "$(co "$p")" rev-parse rawhide)" ] || pending=1
   done
-  git -C "$d" push -q origin "${refs[@]}" || echo "push of $p reported errors, checking each branch"
-  git -C "$d" fetch -q origin
-  [ "$(git -C "$d" rev-parse origin/rawhide)" = "$(git -C "$d" rev-parse rawhide)" ] || die "push of $p rawhide failed"
 done
+if [ "$pending" = 1 ]; then
+  ssh_login
+  for p in "${pkgs[@]}"; do
+    d=$(co "$p")
+    refs=(rawhide)
+    for b in "${targets[@]}"; do
+      [ "$b" = rawhide ] || [ -n "${blocked[$b]:-}" ] || refs+=("rawhide:$b")
+    done
+    git -C "$d" push -q origin "${refs[@]}" || echo "push of $p reported errors, checking each branch"
+    git -C "$d" fetch -q origin
+    [ "$(git -C "$d" rev-parse origin/rawhide)" = "$(git -C "$d" rev-parse rawhide)" ] || die "push of $p rawhide failed"
+  done
+fi
 release=()
 for b in "${targets[@]}"; do
   [ -n "${blocked[$b]:-}" ] && continue
@@ -244,10 +253,18 @@ run_branch() {
 log "Building ${release[*]} in parallel"
 exec 3>&1
 for b in "${release[@]}"; do
+  # A branch that already has its update is done; its side tag may be merged and gone.
+  nvr=$(verrel oscillatord "$b")
+  if [ -n "$(python3 /rebuild/bodhi_helper.py find "$nvr" || true)" ]; then
+    echo "$(cat "$run_dir/$b.sidetag" 2>/dev/null || echo -) $nvr" >"$run_dir/$b.ok"
+    printf '%-9s %s already has a Bodhi update\n' "$b" "$nvr"
+    continue
+  fi
   run_branch "$b" >"$run_dir/$b.log" 2>&1 &
   job[$b]=$!
 done
 for b in "${release[@]}"; do
+  [ -n "${job[$b]:-}" ] || continue
   wait "${job[$b]}" || true
   unset "job[$b]"
 done
@@ -258,9 +275,7 @@ declare -A update_url
 for b in "${release[@]}"; do
   [ -s "$run_dir/$b.ok" ] || continue
   read -r sidetag nvr <"$run_dir/$b.ok"
-  url=$(python3 /rebuild/bodhi_helper.py find "$nvr" || true)
-  [ -n "$url" ] || url=$(python3 /rebuild/bodhi_helper.py create-from-tag "$notes" "$sidetag" | head -1) || true
-  update_url[$b]=$url
+  update_url[$b]=$(python3 /rebuild/bodhi_helper.py ensure-update "$notes" "$sidetag" "$nvr" 2>>"$run_dir/$b.log") || true
 done
 
 log "Summary"
@@ -275,7 +290,8 @@ for b in "${targets[@]}"; do
   if [ -n "${blocked[$b]:-}" ]; then
     printf '%-9s skipped: %s\n' "$b" "${blocked[$b]}"
   elif [ -s "$run_dir/$b.ok" ]; then
-    printf '%-9s built, but no Bodhi update was created from %s\n' "$b" "$(cut -d' ' -f1 "$run_dir/$b.ok")"
+    printf '%-9s built, but no Bodhi update was created from %s (log: %s)\n' "$b" "$(cut -d' ' -f1 "$run_dir/$b.ok")" \
+      "${STATE_DIR:-~/.cache/oscillatord-release}/work/state/$ver/$b.log"
   else
     printf '%-9s FAILED: %s (log: %s)\n' "$b" "$(cat "$run_dir/$b.fail" 2>/dev/null || echo "see log")" \
       "${STATE_DIR:-~/.cache/oscillatord-release}/work/state/$ver/$b.log"

                 reply	other threads:[~2026-11-13 14:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179458181103.1.13553038960509123105.rpms-oscillatord-f96f7cee61e4@fedoraproject.org \
    --to=leoleovich@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox