Skip to content

feat: port backup script to Python, fix DCO default (#17) - #19

Merged
askb merged 1 commit into
mainfrom
feat/python-port
Nov 7, 2026
Merged

askb merged 1 commit into
mainfrom
feat/python-port

Conversation

@askb

@askb askb commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces gitops_backup.sh (bash, ~420 lines) with gitops_backup.py (stdlib-only Python). Same options, env overrides, status file, log format and git/PR behaviour.

  • Parity: tests/self_check.sh runs unmodified against the Python script — locally and inside the built image (Alpine Python 3.12).
  • Image: apk add python3; jq/curl removed (90 MB amd64).
  • Tests: tests/test_gitops_backup.py drives the script end to end against a bare origin + fake GitHub REST API (http.server) — covers pr_created, pr_open_unchanged, pr_updated stacking, foreign-PR filtering, config errors, file-list cap, API URL scheme check.
  • Tooling: pyproject.toml (ruff, mypy strict, pytest), ruff pre-commit hooks, new CI job Python Lint & Tests. Existing required check names unchanged.
  • Fixes Default commit_email gitops-backup@localhost fails the DCO GitHub App #17: default commit_email → [email protected] (DCO app rejected @localhost). Existing installs keep their saved value.

Version bumped to 0.5.0.

Test plan

  • pre-commit run --all-files (14 hooks)
  • ruff check / ruff format --check / mypy --strict
  • pytest — 6 passed
  • bash tests/self_check.sh — 11 cases OK (host 3.14 and image 3.12)
  • docker build amd64 smoke + py_compile
  • CI green

Replace the 420-line bash gitops_backup.sh with a stdlib-only Python
implementation (gitops_backup.py). The contract is unchanged: same
options.json inputs, env overrides, status file, log rotation,
token-less remote header, PR create/dedupe flow and never-checkout
branch handling. tests/self_check.sh is the parity gate and runs
unmodified against the new script (also verified inside the built
image on Alpine's Python 3.12).

Image: apk python3 added, jq/curl dropped; service loop now runs
python3 /app/gitops_backup.py.

Tooling: pyproject.toml (ruff, mypy --strict, pytest), ruff pre-commit
hooks, new "Python Lint & Tests" CI job. Existing required check names
are untouched. tests/test_gitops_backup.py runs the script end to end
against a bare origin plus a fake GitHub REST server to cover
pr_created, pr_open_unchanged, pr_updated (stacking onto the open PR
branch) and foreign-PR filtering, which self_check.sh could not reach.

Fixes #17: default commit_email is now
[email protected] so Signed-off-by passes the DCO
GitHub App. Saved options on existing installs are not changed.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Anil Belur <[email protected]>
@askb
askb merged commit fe82439 into main Nov 7, 2026
7 checks passed
@askb
askb deleted the feat/python-port branch November 7, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default commit_email gitops-backup@localhost fails the DCO GitHub App

1 participant