1. Deploy only waited for lint; failing tests or a bandit finding still deployed
Deploy needs every job: Lint (Python), Lint (JS), Test, Security and Scan
2. The payload was just {"ref"} (replayable forever); nothing checked the deploy
Signed payload{"ref","sha","ts"}, unique per request. CI waits up to 5 minutes until /health reports that commit for the web app (sha) and the monitor (monitor_sha) with status ok, and only then tags deploy-<date>-<run>
3. actions/checkout@v3, a moving tag
Pinned to a full SHA: 11d5960a... # v4.4.0
4. Unpinned tools, and the test environment might not match production
Pinned tools in requirements-dev.txt (flake8 7.5.0, bandit 1.9.4, pytest 9.2.0, pytest-cov 7.1.0). Job images pinned by digest:python:3.13-trixie (CT 157 runs Python 3.13.5 on Debian 13) and node:22-bookworm for eslint via npm ci. No setup-python, which broke Pulse twice through the runner's shared tool cache
5. Only lint failures alerted
Notify: any failure on main or in the weekly run, and every deploy
new
Scan job: gitleaks over the full history (it would have caught the config backup removed in #74), actionlint with shellcheck on the workflow, and shellcheck on *.sh. Downloads are pinned and SHA-256 checked
Other changes:
One file:ci.yml replaces lint.yml, test.yml and security.yml.
When it runs: on pull requests, on pushes to main, and Mondays at 06:00 UTC. Branch pushes no longer build twice. Deploys queue and are never cancelled mid-way.
version.py: reads the checked-out commit from .git at startup, with no subprocess. It handles a detached HEAD, loose refs and packed-refs, and gives '' if anything is unreadable.
Checked before opening
Local runs: I ran every job's commands with the pinned versions in a fresh virtualenv:
flake8 is clean;
bandit -ll is clean (the same informational warnings as today);
765 tests pass at 76% coverage;
the deploy job's inline Python compiles.
Scanners: actionlint 1.7.12 (with shellcheck) is clean on ci.yml. gitleaks 8.30.1 over the full, purged history scanned 264 commits and found nothing.
Prod's /health is reachable through nginx from the LAN at http://10.10.10.61/health, which is what the verify step polls.
Branch protection (done 2026-11-29)
main now requires the new checks:
CI / Lint (Python) (pull_request)
CI / Lint (JS) (pull_request)
CI / Test (pull_request)
CI / Security (pull_request)
CI / Scan (pull_request)
They replace Lint / Python (flake8) (push), Lint / JS (eslint) (push), Security / Python Security (bandit) (push) and Test / Python Tests (pytest) (push). Those came from the workflows this PR removes, so they would never report again.
deploy/gandalf_deploy.sh in this repo: it refuses requests older than 5 minutes or not newer than the last one, checks that the sha is on origin/main, checks it out detached, installs, restarts, waits for /health to report it, and rolls back if it never does.
The webhook passes sha and ts to it.
The pve-infra 157-gandalf/deploy.sh keeps only the config files, so a pve-infra push no longer redeploys whatever main happens to be.
Part 1 of #55. Nothing changes on the server: today's webhook and deploy script keep working with the new payload.
## The problems in #55, and what this does
| #55 | Now |
|---|---|
| 1. Deploy only waited for lint; failing tests or a bandit finding still deployed | **Deploy needs every job:** Lint (Python), Lint (JS), Test, Security and Scan |
| 2. The payload was just `{"ref"}` (replayable forever); nothing checked the deploy | **Signed payload** `{"ref","sha","ts"}`, unique per request. **CI waits up to 5 minutes** until `/health` reports that commit for the web app (`sha`) and the monitor (`monitor_sha`) with status ok, and only then tags `deploy-<date>-<run>` |
| 3. `actions/checkout@v3`, a moving tag | **Pinned to a full SHA**: `11d5960a... # v4.4.0` |
| 4. Unpinned tools, and the test environment might not match production | **Pinned tools** in `requirements-dev.txt` (flake8 7.5.0, bandit 1.9.4, pytest 9.2.0, pytest-cov 7.1.0). **Job images pinned by digest:** `python:3.13-trixie` (CT 157 runs Python 3.13.5 on Debian 13) and `node:22-bookworm` for eslint via `npm ci`. No setup-python, which broke Pulse twice through the runner's shared tool cache |
| 5. Only lint failures alerted | **Notify:** any failure on `main` or in the weekly run, and every deploy |
| new | **Scan job:** gitleaks over the full history (it would have caught the config backup removed in #74), actionlint with shellcheck on the workflow, and shellcheck on `*.sh`. Downloads are pinned and SHA-256 checked |
Other changes:
- **One file:** `ci.yml` replaces `lint.yml`, `test.yml` and `security.yml`.
- **When it runs:** on pull requests, on pushes to `main`, and Mondays at 06:00 UTC. Branch pushes no longer build twice. Deploys queue and are never cancelled mid-way.
- **`version.py`:** reads the checked-out commit from `.git` at startup, with no subprocess. It handles a detached HEAD, loose refs and packed-refs, and gives `''` if anything is unreadable.
## Checked before opening
- **Local runs:** I ran every job's commands with the pinned versions in a fresh virtualenv:
- flake8 is clean;
- bandit `-ll` is clean (the same informational warnings as today);
- 765 tests pass at 76% coverage;
- the deploy job's inline Python compiles.
- **Scanners:** actionlint 1.7.12 (with shellcheck) is clean on `ci.yml`. gitleaks 8.30.1 over the full, purged history scanned 264 commits and found nothing.
- **Prod's `/health`** is reachable through nginx from the LAN at `http://10.10.10.61/health`, which is what the verify step polls.
## Branch protection (done 2026-11-29)
`main` now requires the new checks:
```
CI / Lint (Python) (pull_request)
CI / Lint (JS) (pull_request)
CI / Test (pull_request)
CI / Security (pull_request)
CI / Scan (pull_request)
```
They replace `Lint / Python (flake8) (push)`, `Lint / JS (eslint) (push)`, `Security / Python Security (bandit) (push)` and `Test / Python Tests (pytest) (push)`. Those came from the workflows this PR removes, so they would never report again.
## Part 2 (#77, server side, needs approval)
- `deploy/gandalf_deploy.sh` in this repo: it refuses requests older than 5 minutes or not newer than the last one, checks that the sha is on `origin/main`, checks it out detached, installs, restarts, waits for `/health` to report it, and rolls back if it never does.
- The webhook passes `sha` and `ts` to it.
- The pve-infra `157-gandalf/deploy.sh` keeps only the config files, so a pve-infra push no longer redeploys whatever `main` happens to be.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
gandalf#55, part 1 (no server changes needed).
- .gitea/workflows/ci.yml replaces lint.yml, test.yml and security.yml.
Jobs: Lint (Python) with the dash check, Lint (JS), Test, Security,
Scan (gitleaks over the full history, actionlint, shellcheck), Deploy
and Notify. Deploy needs every check, so failing tests or a bandit or
gitleaks finding no longer reach production.
- Pinned: actions/checkout to a full SHA, job images to digests (Python
3.13 on Debian 13 like CT 157, Node 22 for eslint), Python tools in the
new requirements-dev.txt, scanner downloads by SHA-256. No setup-python
(the runner's shared tool cache broke Pulse twice).
- Builds run on pull requests and on pushes to main only, plus a weekly
run on main; concurrency queues deploys and never cancels one.
- Deploy signs {"ref", "sha", "ts"} (unique per request), then waits up to
5 minutes until /health reports that commit for both processes, and only
then tags deploy-<date>-<run>.
- /health reports `sha` (version.py reads .git at startup, no subprocess)
and `monitor_sha` (the monitor writes it every cycle).
Part 2 (server side): the pinned deploy script that refuses stale or
replayed requests, deploys exactly that sha and rolls back.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runner (act) runs JavaScript actions such as actions/checkout inside
the job container, and python:3.13-trixie has no node, so checkout failed
with 'exec: node: executable file not found'. Debian's nodejs (20.x) is
enough for checkout v4 and keeps the job image matching production.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Python 3.12+ tokenizes f-strings, so pycodestyle now checks inside them.
CI runs flake8 on production's Python 3.13; the old CI and local checks
ran an older Python and never saw it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jared
merged commit b71d5f4c24 into main2026-11-29 00:00:28 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part 1 of #55. Nothing changes on the server: today's webhook and deploy script keep working with the new payload.
The problems in #55, and what this does
{"ref"}(replayable forever); nothing checked the deploy{"ref","sha","ts"}, unique per request. CI waits up to 5 minutes until/healthreports that commit for the web app (sha) and the monitor (monitor_sha) with status ok, and only then tagsdeploy-<date>-<run>actions/checkout@v3, a moving tag11d5960a... # v4.4.0requirements-dev.txt(flake8 7.5.0, bandit 1.9.4, pytest 9.2.0, pytest-cov 7.1.0). Job images pinned by digest:python:3.13-trixie(CT 157 runs Python 3.13.5 on Debian 13) andnode:22-bookwormfor eslint vianpm ci. No setup-python, which broke Pulse twice through the runner's shared tool cachemainor in the weekly run, and every deploy*.sh. Downloads are pinned and SHA-256 checkedOther changes:
ci.ymlreplaceslint.yml,test.ymlandsecurity.yml.main, and Mondays at 06:00 UTC. Branch pushes no longer build twice. Deploys queue and are never cancelled mid-way.version.py: reads the checked-out commit from.gitat startup, with no subprocess. It handles a detached HEAD, loose refs and packed-refs, and gives''if anything is unreadable.Checked before opening
-llis clean (the same informational warnings as today);ci.yml. gitleaks 8.30.1 over the full, purged history scanned 264 commits and found nothing./healthis reachable through nginx from the LAN athttp://10.10.10.61/health, which is what the verify step polls.Branch protection (done 2026-11-29)
mainnow requires the new checks:They replace
Lint / Python (flake8) (push),Lint / JS (eslint) (push),Security / Python Security (bandit) (push)andTest / Python Tests (pytest) (push). Those came from the workflows this PR removes, so they would never report again.Part 2 (#77, server side, needs approval)
deploy/gandalf_deploy.shin this repo: it refuses requests older than 5 minutes or not newer than the last one, checks that the sha is onorigin/main, checks it out detached, installs, restarts, waits for/healthto report it, and rolls back if it never does.shaandtsto it.157-gandalf/deploy.shkeeps only the config files, so a pve-infra push no longer redeploys whatevermainhappens to be.🤖 Generated with Claude Code
gandalf#55, part 1 (no server changes needed). - .gitea/workflows/ci.yml replaces lint.yml, test.yml and security.yml. Jobs: Lint (Python) with the dash check, Lint (JS), Test, Security, Scan (gitleaks over the full history, actionlint, shellcheck), Deploy and Notify. Deploy needs every check, so failing tests or a bandit or gitleaks finding no longer reach production. - Pinned: actions/checkout to a full SHA, job images to digests (Python 3.13 on Debian 13 like CT 157, Node 22 for eslint), Python tools in the new requirements-dev.txt, scanner downloads by SHA-256. No setup-python (the runner's shared tool cache broke Pulse twice). - Builds run on pull requests and on pushes to main only, plus a weekly run on main; concurrency queues deploys and never cancels one. - Deploy signs {"ref", "sha", "ts"} (unique per request), then waits up to 5 minutes until /health reports that commit for both processes, and only then tags deploy-<date>-<run>. - /health reports `sha` (version.py reads .git at startup, no subprocess) and `monitor_sha` (the monitor writes it every cycle). Part 2 (server side): the pinned deploy script that refuses stale or replayed requests, deploys exactly that sha and rolls back. Co-Authored-By: Claude Opus 5.5 <[email protected]>