feat: add Docker Swarm support (MODE=swarm) #4

Merged
shcizo merged 10 commits from worktree-docker-swarm-support into main 2026-07-04 18:54:18 +00:00

10 Commits

Author SHA1 Message Date
shcizo db84a2f6ba fix(api): plumb request tag into discovery so swarm mode deploys the requested version
req.Tag was only echoed in the HTTP response, never used to match jobs.
Compose mode didn't care (ComposeExecutor re-pulls the compose file's own
pinned tag), but SwarmExecutor sets the service image directly from
Job.Image, which was built from the untagged req.Image alone -- so a
Swarm deploy silently rewrote the service to :latest instead of the
requested tag. Build the full image:tag reference once in the handler
and pass it into FindJobs; NormaliseImage/ImagesMatch already strip
tags before matching, so this doesn't change which jobs match in either
mode.
2026-07-04 20:41:59 +02:00
shcizo 9881812eca docs: document MODE=swarm support and its opt-in label / manager-node requirements 2026-07-04 20:32:22 +02:00
shcizo ac3912367f merge: bring in CLAUDE.md and CI workflow from main 2026-07-04 20:31:25 +02:00
shcizo 9a3a200873 feat: wire MODE config to select compose or swarm discovery/executor 2026-07-04 20:28:28 +02:00
shcizo f92f8ac6b1 feat(api): surface ServiceID in update results for swarm jobs 2026-07-04 20:22:30 +02:00
shcizo 34865c9fd0 feat(updater): add SwarmExecutor to run docker service update via the Docker API
Adds the Swarm-mode counterpart to ComposeExecutor: updates a Swarm
service's image directly through the Docker SDK (ServiceInspectWithRaw +
ServiceUpdate with QueryRegistry=true so floating tags resolve to a fresh
digest), gated by the same Refused guard used in Compose mode. Satisfies
the existing Executor interface unchanged, so Queue needs no changes.
2026-07-04 20:19:00 +02:00
shcizo a8524e5ff4 feat(discovery): add SwarmDiscovery to find opted-in Swarm services by image
Verified the Docker SDK v28.5.2+incompatible ServiceList signature via go doc
before implementing: the options type is swarm.ServiceListOptions, not
types.ServiceListOptions as the brief assumed. Everything else (Service.ID,
Service.Spec via embedded Annotations for Name/Labels, TaskTemplate.ContainerSpec.Image)
matched the brief exactly.

Reuses discovery.ImagesMatch and discovery.HasOptIn rather than duplicating
matching/opt-in logic. Opt-in label is read from the service spec's own
labels since Swarm services have no local compose file to anchor a
STACKS_ROOT path check against (unlike Compose mode).
2026-07-04 20:12:44 +02:00
shcizo 9cf484e164 feat(discovery): add Image and ServiceID fields to Job for swarm support 2026-07-04 20:09:39 +02:00
shcizo 1002bb7b96 feat(config): add MODE env var to select compose or swarm operation 2026-07-04 20:06:50 +02:00
shcizo 8f999c69bd docs: add docker swarm support implementation plan 2026-07-04 20:05:02 +02:00