feat: self-update of master and agents (#15) (#32)

This commit was merged in pull request #32.
This commit is contained in:
2026-10-13 10:17:52 +00:00
parent ec28d1e027
commit 850a670446
39 changed files with 1421 additions and 130 deletions
+10 -1
View File
@@ -16,7 +16,7 @@ import (
// Version is the protocol version this build speaks. Agents send it in
// Hello. Phase-1 agents do not send the field, which reads as 0.
const Version = 3
const Version = 4
// MinJobVersion is the lowest agent protocol version the master sends jobs to.
const MinJobVersion = 2
@@ -26,6 +26,11 @@ const MinJobVersion = 2
// with a digest.
const MinPinnedRefVersion = 3
// MinSelfUpdateVersion is the lowest agent protocol version the master sends a
// job for the agent's own Compose service to. Older agents neither run the
// update in a helper container nor resume it after restarting.
const MinSelfUpdateVersion = 4
// MaxJobOutput caps the job output an agent keeps and the master stores, in
// bytes. Only the tail is kept. With JSON escaping (worst case 6 bytes per
// byte) a JobResult carrying this much output still fits the 1 MiB read limit.
@@ -141,6 +146,10 @@ type JobStart struct {
SwarmClusterID string `json:"swarm_cluster_id,omitempty"`
SwarmService string `json:"swarm_service,omitempty"`
Ref string `json:"ref"`
// Self says the service is the agent's own. The agent runs such a job
// after every other queued job; whether it needs a helper container is
// decided by the agent itself.
Self bool `json:"self,omitempty"`
}
// JobProgress carries output produced since the previous JobProgress for the