Context ------- Matches the pattern used by claude-memory-mcp (infra CLAUDE.md §CI/CD). GHA is cheap and parallel — build+push happens there. Woodpecker runs in-cluster and has kubectl access, so it owns the `kubectl set image` step. This change ----------- - `.github/workflows/ci.yml` — push to main runs ruff + mypy strict + pytest, then builds `viktorbarzin/broker-sync:<8-char-sha>` + `:latest` and pushes to DockerHub, then triggers Woodpecker. - `.woodpecker/deploy.yml` — kubectl set image on all 5 CronJobs in the broker-sync namespace (version probe + 4 sync jobs), then spawns a one-shot Job from the version CronJob as a smoke test and waits for completion. - Woodpecker repo ID is `TBD` — needs filling in once the repo is registered with Woodpecker (see infra CLAUDE.md Repo IDs list). The workflow skips deploy cleanly if still TBD, so this doesn't block green builds. Test plan --------- ## Automated Nothing to run locally — CI is verified by pushing and watching the run on GitHub. ## Manual Verification 1. Push this branch to GitHub, confirm `test` job runs and passes. 2. Push to `main`, confirm `build` job produces `viktorbarzin/broker-sync:<sha>` on DockerHub. 3. Register repo with Woodpecker, note the numeric repo ID, replace `TBD` in ci.yml, push again. 4. Confirm Woodpecker deploy pipeline runs `kubectl set image` on all 5 CronJobs and the smoke-test job returns `broker-sync 0.1.0`.
30 lines
1.7 KiB
YAML
30 lines
1.7 KiB
YAML
when:
|
|
- event: [manual, push]
|
|
|
|
steps:
|
|
- name: check-vars
|
|
image: alpine
|
|
commands:
|
|
- "[ -n \"$IMAGE_TAG\" ] || (echo 'IMAGE_TAG not set, skipping deploy'; exit 78)"
|
|
|
|
- name: deploy-cronjobs
|
|
image: bitnami/kubectl:latest
|
|
commands:
|
|
# broker-sync runs as CronJobs, not a Deployment. Update each CronJob's image
|
|
# so the next scheduled run picks it up. Running CronJob pods are untouched
|
|
# (Kubernetes doesn't do rolling updates on CronJob templates).
|
|
- "kubectl -n broker-sync set image cronjob/broker-sync-version broker-sync=viktorbarzin/broker-sync:${IMAGE_TAG}"
|
|
- "kubectl -n broker-sync set image cronjob/broker-sync-trading212 broker-sync=viktorbarzin/broker-sync:${IMAGE_TAG}"
|
|
- "kubectl -n broker-sync set image cronjob/broker-sync-imap broker-sync=viktorbarzin/broker-sync:${IMAGE_TAG}"
|
|
- "kubectl -n broker-sync set image cronjob/broker-sync-csv broker-sync=viktorbarzin/broker-sync:${IMAGE_TAG}"
|
|
- "kubectl -n broker-sync set image cronjob/broker-sync-fx-reconcile broker-sync=viktorbarzin/broker-sync:${IMAGE_TAG}"
|
|
|
|
- name: smoke-test
|
|
image: bitnami/kubectl:latest
|
|
commands:
|
|
# Spawn a one-shot Job from the version CronJob with the new image to prove
|
|
# the image is pullable and the CLI entrypoint works end-to-end.
|
|
- "kubectl -n broker-sync create job --from=cronjob/broker-sync-version broker-sync-smoke-${CI_COMMIT_SHA:0:8}"
|
|
- "kubectl -n broker-sync wait --for=condition=complete --timeout=300s job/broker-sync-smoke-${CI_COMMIT_SHA:0:8}"
|
|
- "kubectl -n broker-sync logs job/broker-sync-smoke-${CI_COMMIT_SHA:0:8}"
|
|
- "kubectl -n broker-sync delete job broker-sync-smoke-${CI_COMMIT_SHA:0:8}"
|