Deploys the qbit-maid stack on Komodo (https://k.jonb.io) automatically after the container image is pushed to the registry.
Why not a webhook
The existing stack webhook fires on git push, which happens before Gitea Actions builds and pushes the image. Komodo would pull the previous :latest, deploy it, and report success — the new code never lands. This calls the Komodo API from the workflow instead, after the push completes.
Changes
.gitea/scripts/komodo-deploy.sh — POSTs /execute/DeployStack, fails on non-200, then polls /read/GetUpdate until Complete and checks success, printing Komodo's log on failure. Supports KOMODO_TARGET_TYPE=procedure for future use.
.gitea/workflows/docker.yml — deploys stack qbit-maid after the image push (required).
.gitea/workflows/docker-dev.yml — deploys vars.KOMODO_STACK_DEV; skips cleanly when unset so dev builds never fail.
test_komodo_deploy.py — 15 unittest cases against a mock Komodo API.
.gitea/workflows/test.yml — runs the tests on push to main/dev* and on PRs.
docs/komodo-deploy-plan.md — design notes and setup instructions.
Bugs found and fixed during review
Permission denied on first run — this repo has core.fileMode=false, so chmod +x never reached git and the runner got the script as 100644. Fixed by marking it 100755 in the index and invoking via sh.
Shell-dependent exit code — :? exits 1 under bash but 2 under dash (the Ubuntu runner's sh), so two tests passed locally and failed in CI. Replaced with explicit if [ -z ... ] checks so every failure path exits 1.
Verification
15/15 tests pass locally and in CI (test.yml green on b2b8f6c).
docker-dev.yml green on the same commit.
Both workflows parse as valid YAML; script passes sh -n.
Confirm Auto Pull is enabled on stack qbit-maid (if off, deploys reuse the cached image and report success without changing anything)
Consider removing the existing stack webhook — it now redeploys the stale image on every push
Set KOMODO_STACK_DEV repository variable if you have a dev stack
The first real deploy happens on the next push to main after merge.
## What this does
Deploys the `qbit-maid` stack on Komodo (`https://k.jonb.io`) automatically after the container image is pushed to the registry.
## Why not a webhook
The existing stack webhook fires on `git push`, which happens **before** Gitea Actions builds and pushes the image. Komodo would pull the previous `:latest`, deploy it, and report success — the new code never lands. This calls the Komodo API from the workflow instead, after the push completes.
## Changes
- **`.gitea/scripts/komodo-deploy.sh`** — POSTs `/execute/DeployStack`, fails on non-200, then polls `/read/GetUpdate` until `Complete` and checks `success`, printing Komodo's log on failure. Supports `KOMODO_TARGET_TYPE=procedure` for future use.
- **`.gitea/workflows/docker.yml`** — deploys stack `qbit-maid` after the image push (required).
- **`.gitea/workflows/docker-dev.yml`** — deploys `vars.KOMODO_STACK_DEV`; skips cleanly when unset so dev builds never fail.
- **`test_komodo_deploy.py`** — 15 unittest cases against a mock Komodo API.
- **`.gitea/workflows/test.yml`** — runs the tests on push to `main`/`dev*` and on PRs.
- **`docs/komodo-deploy-plan.md`** — design notes and setup instructions.
## Bugs found and fixed during review
1. **`Permission denied` on first run** — this repo has `core.fileMode=false`, so `chmod +x` never reached git and the runner got the script as `100644`. Fixed by marking it `100755` in the index and invoking via `sh`.
2. **Shell-dependent exit code** — `:?` exits 1 under bash but 2 under dash (the Ubuntu runner's `sh`), so two tests passed locally and failed in CI. Replaced with explicit `if [ -z ... ]` checks so every failure path exits 1.
## Verification
- 15/15 tests pass locally and in CI (`test.yml` green on `b2b8f6c`).
- `docker-dev.yml` green on the same commit.
- Both workflows parse as valid YAML; script passes `sh -n`.
## Before merging
- [x] Add Gitea secrets `KOMODO_URL`, `KOMODO_API_KEY`, `KOMODO_API_SECRET`
- [x] Confirm **Auto Pull** is enabled on stack `qbit-maid` (if off, deploys reuse the cached image and report success without changing anything)
- [ ] Consider removing the existing stack webhook — it now redeploys the stale image on every push
- [ ] Set `KOMODO_STACK_DEV` repository variable if you have a dev stack
The first real deploy happens on the next push to `main` after merge.
Adds a shared .gitea/scripts/komodo-deploy.sh that calls the Komodo
/execute/DeployStack API after the image is pushed, then polls
/read/GetUpdate until the deploy completes.
A push webhook cannot do this correctly: it fires before the image
exists in the registry, so Komodo would redeploy the previous :latest.
- docker.yml deploys stack 'qbit-maid' (required)
- docker-dev.yml deploys vars.KOMODO_STACK_DEV, skipped when unset
core.fileMode is false in this repo, so the exec bit on
komodo-deploy.sh was not recorded and the runner hit
'Permission denied'. Mark the file executable in the index and
invoke it via 'sh' so the step no longer depends on the mode bit.
15 unittest cases exercising the real script end to end: target
selection, auth headers, request shape, success/failure, HTTP 401/400,
unreachable host, polling to completion, and timeout.
Runs in CI via .gitea/workflows/test.yml on push to main/dev* and on
pull requests. No network or live Komodo instance required.
':?' exits 1 under bash but 2 under dash (the Ubuntu runner's sh),
so the two missing-variable tests failed in CI while passing locally.
Replace with explicit checks so every failure path exits 1.
jblu
merged commit 147758a1e8 into main2026-10-27 00:31:12 -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.
What this does
Deploys the
qbit-maidstack on Komodo (https://k.jonb.io) automatically after the container image is pushed to the registry.Why not a webhook
The existing stack webhook fires on
git push, which happens before Gitea Actions builds and pushes the image. Komodo would pull the previous:latest, deploy it, and report success — the new code never lands. This calls the Komodo API from the workflow instead, after the push completes.Changes
.gitea/scripts/komodo-deploy.sh— POSTs/execute/DeployStack, fails on non-200, then polls/read/GetUpdateuntilCompleteand checkssuccess, printing Komodo's log on failure. SupportsKOMODO_TARGET_TYPE=procedurefor future use..gitea/workflows/docker.yml— deploys stackqbit-maidafter the image push (required)..gitea/workflows/docker-dev.yml— deploysvars.KOMODO_STACK_DEV; skips cleanly when unset so dev builds never fail.test_komodo_deploy.py— 15 unittest cases against a mock Komodo API..gitea/workflows/test.yml— runs the tests on push tomain/dev*and on PRs.docs/komodo-deploy-plan.md— design notes and setup instructions.Bugs found and fixed during review
Permission deniedon first run — this repo hascore.fileMode=false, sochmod +xnever reached git and the runner got the script as100644. Fixed by marking it100755in the index and invoking viash.:?exits 1 under bash but 2 under dash (the Ubuntu runner'ssh), so two tests passed locally and failed in CI. Replaced with explicitif [ -z ... ]checks so every failure path exits 1.Verification
test.ymlgreen onb2b8f6c).docker-dev.ymlgreen on the same commit.sh -n.Before merging
KOMODO_URL,KOMODO_API_KEY,KOMODO_API_SECRETqbit-maid(if off, deploys reuse the cached image and report success without changing anything)KOMODO_STACK_DEVrepository variable if you have a dev stackThe first real deploy happens on the next push to
mainafter merge.