Skip to content
okurzPublic

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Latest commit

 

History

362 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal administration, openQA, OBS/openSUSE, Git, and system utility scripts.

Overview

This repository contains CLI tools, workflow helpers, and maintenance scripts.

Key areas include:

  • Git and code review automation: Tools for GitHub/GitLab PR triage, automated bot reviews, cleanup, branch rebasing, and signing (review-bot-batch, gh-pr-triage, gh-as-bot, glab-as-bot, gitea-review-cleanup, git-sign-and-push). gh-as-bot and glab-as-bot refuse forge writes unless REVIEW_BOT_POST=1 is set; review-bot-batch sets it for live runs and leaves it unset for --dry-run.
  • openQA and Open Build Service (OBS): Diagnostics and synchronization tools for OBS staging projects, dependency synchronization, and openQA investigations (obs-pr-repair, osc-sync-leap, osc-sync-deps, osc-get-pr-status, suse-qa-sle-etherpad-status).
  • System administration and utilities: Network helpers, backup utilities, desktop adjustments, and hardware monitoring scripts.

Highlighted tools

git-plans-dir

Prints the directory that holds a repository's plans: <primary checkout>/tasks, resolved from the git common directory so it is identical in the primary checkout and in every worktree. plans.dir in the git config overrides it.

# Same answer from the primary checkout and from any worktree
cd ~/local/os-autoinst/openQA && git plans-dir
cd ~/local/os-autoinst/oqa-154-cleanup && git plans-dir

Plans must be read and written in $(git plans-dir). A worktree's own tasks/ path is git-ignored, so a plan written there diverges without any git status report.

git-hooks/post-checkout

Links shared paths into a checkout as configured per repository, and only when the link is missing:

git config --add worktree.symlink "tasks=/path/to/primary/tasks"
git config worktree.setup "make prepare-node-env"

Installed by pointing the primary checkout's .git/hooks/post-checkout at this script; worktrees share that hooks directory. worktree.setup is printed rather than run so a checkout never blocks on an install.

git-worktree-audit

Project-agnostic pre-consolidation check: reports checkouts that hold branches or remote-tracking refs whose tip object the primary checkout does not have. Exits 1 when anything is at risk, so it can gate moving or removing a checkout.

# Audit a deep clone before retiring it into worktrees of the primary checkout
git worktree-audit --primary ~/local/os-autoinst/openQA ~/local/os-autoinst/oqa4

# Machine-readable, including ahead/behind and dirty counts
git worktree-audit --json --primary ~/local/os-autoinst/openQA archive/oqa4-20261120

Adopt at-risk refs locally before removing the checkout:

git -C primary fetch --no-tags /path/to/clone '+refs/heads/*:refs/remotes/clones/clone/*'
git -C primary fetch --no-tags /path/to/clone '+refs/remotes/*:refs/remotes/clones/clone/*'

git-delete-no-content-branches

Deletes local branches whose commits are all contained in remotes/origin/master or remotes/origin/main. With prune.worktrees=true (the default) a branch that is checked out in a worktree is deleted together with that worktree, and only when the worktree has neither uncommitted changes nor stashes. Disable it per repository with git config prune.worktrees false or per run with --keep-worktree; preview with --dry-run.

obs-pr-repair

Project-agnostic OBS PR diagnostics and recovery tool for GitHub repositories utilizing .obs/workflows.yml (e.g. openQA, os-autoinst, os-autoinst-scripts).

Usage

# Check current PR project from within git repository checkout:
obs-pr-repair

# Check specific PR in openQA:
obs-pr-repair --repo os-autoinst/openQA --pr 7968

# Recreate broken project (delete OBS project and cycle PR):
obs-pr-repair --recreate --pr 7968

# Non-interactive recreate:
obs-pr-repair --recreate --pr 7968 --yes

# Force-repair unbranched package:
obs-pr-repair --repair-branch --pr 7968

# Trigger rebuild of healthy project:
obs-pr-repair --rebuild --pr 7968

src-review

Approves and merges the trivial bot package updates on src.opensuse.org without a human read: a pull request merges only when the G1-G11 policy holds (update-bot author, exactly spec/changes/tarballs, a green build of the current head, a version equal to the normalized cpan_version, a spec delta inside the mechanical cpanspec vocabulary, one added changes entry, no unchecked CHECK: hint, diff and merge caps, 15 idle minutes, no --never package). Anything else escalates with the first failing rule in the digest. The build gate reads a success comment newer than the head; when the bot never re-commented after a push, it asks OBS instead: the PR project's <scmsync> must name the head and every repository must have succeeded.

# What would be approved and merged, as one JSON document
src-review --orgs perl --dry-run --json

# Approve only, then merge in a later run; each head is recorded in the ledger
src-review --approve --digest
src-review --merge --limit 3 --digest

# Replay the committed corpus of the last closed perl pull requests, no network
src-review --dry-run --input test/fixtures/src-review-closed

# Check the token before a merge run
src-review --check-token

The approval body starts with Automated trivial-update approval by src-review, so an automated approval is distinguishable from a judgement call. State lives in ~/.cache/src-review/: decisions.jsonl is an append-only ledger keyed by repo, pull request and head sha, digest.md collects the runs. Only the approval and the merge are ever written — no comment, label, title edit or branch deletion — and a merged package is checked once, 30 minutes later, with a read-only osc meta pkg devel:languages:perl.

It runs unattended from src-review.timer in ~/.config/systemd/user/ (10:03 and 10:57 daily, --merge --digest wrapped in flock), so the digest is the review surface. A run that could not post an approval or a merge it attempted exits 1, and OnFailure=src-review-mail@src-review.service mails the journal tail to okurz@suse.de; an ordinary rule escalation stays a digest line. Every mode reads the ledger, so a --dry-run reports the day's merge budget and the heads still waiting for a merge.

review-loop-supervise

Keeps review-bot-batch --watch alive on a flaky GitHub: it replaces a slice whose census aborted on a transient HTTP 502 instead of letting it sleep --interval, idles while the 24 h review quota (QUOTA_GLOBAL, read from the tool so a raised cap needs no edit here) is exhausted, and decides liveness from the process tree and /var/tmp/review-bot, never from /tmp/cycle.log, which a running session does not touch.

# 10 h, detached: a foreground run dies with the terminal or the caller's timeout
setsid nohup review-loop-supervise 600 > /tmp/supervise.out 2>&1 &

# Ten parallel shard batches instead of the default three; shards are residue classes of PR
# numbers, so they never pick the same pull request
REVIEW_LOOP_SHARDS=10 review-loop-supervise 600

It prepends review-loop-shim/gh-as-bot to the launched slice's PATH: that shim retries read-only api graphql calls on a transient 5xx and passes mutations and every other command through, which is what the census needs without editing review-bot-batch. review-loop-record "<finding>" appends one measured line plus the ok/skip/defer/FAILED and census counters to the ## Findings log of the plan that owns it; the open work is tasks/011_census_survives_heavy_search_502.md and tasks/012_classify_session_outcome_not_api_visibility.md.

Operating the loop from a fresh session

The loop runs detached, so a new session neither owns nor disturbs it. Read before acting:

ps -eo pid,args | grep 'review-loop-supervis[e]'          # exactly one supervisor, or none
tail -5 /tmp/cycle.log                                    # census:, ok/skip/defer/withheld/FAILED, done:
tail -3 /tmp/supervise.out                                # restart lines and quota idles
for p in ok skip defer withheld FAILED; do printf '%s %s\n' "$p" "$(grep -cE "^$p " /tmp/cycle.log)"; done
ls -td /var/tmp/review-bot/*/ | head -1                    # the cycle in flight, one log per pull request
  • Never start a second supervisor or batch: every shard holds flock on /tmp/slice.pid.<n>.lock, and a duplicated shard reviews the same pull request twice (openSUSE/qem-bot#699, hidden as duplicate).
  • Stop with kill -TERM <supervisor>: it terminates the shards it started, so a restart cannot orphan one. Restart with the command above whenever the code changed.
  • Per-PR evidence: <cycle>/<repo>-<n>.log (the session's own output, including why it withheld or deferred) and the matching .report.md.
  • Ledgers under ~/.cache/review-bot/: waits.csv (one row per session with its outcome, and the quota that only counts posted reviews), skipped.json (parked heads, back when the head moves or with --recheck), deferred.json (heads whose CI has not run).
  • review-loop-record "<finding>" appends the measured line plus the loop counters to the ## Findings log of the plan that owns it.

Development and testing

Python dependencies and virtual environments are managed using uv.

Running tests

Run tests and checks via make:

# Run all unit tests with coverage and static analysis
make test

# Run unit tests only
make test-unit

# Run fast unit tests without coverage
make test-unit-no-coverage

Static analysis and style checks

# Fast style and static analysis (ruff, shellcheck, banned patterns, lockfile)
make checkstyle

# Run type checker (ty)
make check-types

# Automatically format code and apply lint fixes
make tidy

License

MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages