Share the target filter, fix cd-status branch, record deploy status

- enabled_targets/names_for: one implementation of 'a host acts only on its
  own targets'; --host s5 and --host s5.fisher.hu now select the same targets
- shell_value: JSON booleans reach shell consumers as true/false
- cd-status: capture before eval, so the unconfigured-host branch is reachable
- cd-deploy writes a .status record; cd-status reads it instead of grepping
  the log's prose
- cd-render-hooks --list-urls replaces two inline JSON readers
This commit is contained in:
fisher
2026-08-23 08:50:45 +00:00
parent b48e112ed7
commit 62c62baf05
8 changed files with 119 additions and 62 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ deploy ended.
| This repository | `~/S/my-cd-webhook` |
| Secrets (0600) | `~/.config/cd-webhook/secrets.env` |
| Rendered hooks (0600, generated) | `~/.config/cd-webhook/hooks.json` |
| Deploy logs and locks | `~/.local/state/cd-webhook/<target>.log` |
| Deploy logs, locks, last-deploy records | `~/.local/state/cd-webhook/<target>.{log,lock,status}` |
| systemd unit | `~/.config/systemd/user/cd-webhook.service` |
```bash
@@ -74,7 +74,7 @@ missed deploy, not a wrong one.
## Adding a host
1. Add the host to `"hosts"` in `targets.json` with its WireGuard address and
port `21600`.
the same port the other hosts there use.
2. Add its targets.
3. Commit and push this repository.
4. On the host: clone, `./install/install.sh`, fill in `secrets.env`, re-run.
+7
View File
@@ -7,6 +7,13 @@ Short notes on things that were not obvious. Prune stale ones.
`importlib.machinery.SourceFileLoader`. Importing `importlib.util` alone is
not enough — `importlib.machinery` needs its own import.
- **`if eval "$(cmd)"` tests the wrong thing.** `eval` reports the status of the
string it evaluates, and an empty string is success — so a failing `cmd` makes
the `if` take the *true* branch with nothing assigned, and `set -u` then aborts
on the first variable the branch reads. Capture first
(`if out="$(cmd)"; then eval "$out"`). This had made `cd-status`'s "host is not
configured" message unreachable.
- **`docker/metadata-action`'s `type=sha,format=short` produces 7 characters.**
That is why `image_tag_template` uses `{short7}`. domaindingo's `build.yml`
prefixes it with the branch, giving `test-sha-abc1234` / `prod-sha-abc1234`.