Skip to content

Modern Docker Management, Designed for Everyone

refactor: move docker utils package in go.getarcane.app/docker (#4296)

Kyle Mendell636ba0950d5e
diff --git a/.golangci.yml b/.golangci.yml
index 4e12bc61f..24559b18b 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -47,6 +47,7 @@ linters:
- gocritic
- gomodguard_v2
- govet
+ - importas
- ineffassign
- lll
- misspell
@@ -105,6 +106,13 @@ linters:
gocognit:
min-complexity: 40
+ importas:
+ alias:
+ - pkg: go.getarcane.app/docker
+ alias: docker
+ - pkg: github.com/getarcaneapp/arcane/backend/v2/internal/docker
+ alias: dockerInternal
+
lll:
line-length: 200
diff --git a/AGENTS.md b/AGENTS.md
index 7d80f3f3e..dead06019 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -148,7 +148,7 @@ Use:
Before adding backend logic, search the owning domain and the relevant shared packages:
-- `backend/pkg/dockerutil`: Docker names, labels, clients, logs, and stream helpers
+- `go.getarcane.app/docker` (Kit): Docker names, labels, clients, logs, and stream helpers
- `backend/pkg/projects`: Compose parsing, discovery, and image references
- `backend/pkg/pagination`: in-memory and database pagination
- `backend/pkg/libarcane`: reusable Arcane engines and transport behavior
diff --git a/backend/cli/recovery/recovery.go b/backend/cli/recovery/recovery.go
index c96b7716a..a2761804c 100644
--- a/backend/cli/recovery/recovery.go
+++ b/backend/cli/recovery/recovery.go
@@ -20,6 +20,7 @@ import (
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
"github.com/spf13/cobra"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"gorm.io/gorm"
"gorm.io/gorm/clause"
@@ -29,7 +30,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
"github.com/getarcaneapp/arcane/backend/v2/internal/system"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
rusticruntime "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/rustic"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/francis"
)
@@ -77,7 +77,7 @@ func runRestoreInternal(cmd *cobra.Command, _ []string) error {
if pullErr != nil {
return fmt.Errorf("pull Arcane tools image for Rustic: %w", pullErr)
}
- if pullErr = dockerutil.RenderJSONMessageStream(reader, nil); pullErr != nil {
+ if pullErr = docker.RenderJSONMessageStream(reader, nil); pullErr != nil {
_ = reader.Close()
return fmt.Errorf("pull Arcane tools image for Rustic: %w", pullErr)
}
diff --git a/backend/cli/upgrade/upgrade.go b/backend/cli/upgrade/upgrade.go
index dce71f35b..853be1b46 100644
--- a/backend/cli/upgrade/upgrade.go
+++ b/backend/cli/upgrade/upgrade.go
@@ -15,12 +15,12 @@ import (
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/client"
"github.com/spf13/cobra"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
kit "go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"go.getarcane.app/updater/labels"
- docker "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
)
diff --git a/backend/go.mod b/backend/go.mod
index bdf9be591..83030115f 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -31,7 +31,7 @@ require (
github.com/getarcaneapp/arcane/cli/v2 v2.14.0
github.com/getarcaneapp/arcane/types/v2 v2.14.0
github.com/go-git/go-billy/v5 v5.9.2
- github.com/go-git/go-git/v5 v5.19.2
+ github.com/go-git/go-git/v5 v5.19.3
github.com/go-webauthn/webauthn v0.18.2
github.com/gofrs/flock v0.13.1
github.com/google/go-containerregistry v0.22.1
@@ -64,14 +64,15 @@ require (
github.com/subosito/gotenv v1.6.0
github.com/wneessen/go-mail v0.8.1
go.getarcane.app/acfs v0.6.2
- go.getarcane.app/builds v0.4.3
- go.getarcane.app/docker/compat v0.1.1
- go.getarcane.app/docker/convert v0.3.3
- go.getarcane.app/kit v0.3.2
- go.getarcane.app/streams v0.4.4
+ go.getarcane.app/builds v0.4.4
+ go.getarcane.app/docker v0.1.0
+ go.getarcane.app/docker/compat v0.1.2
+ go.getarcane.app/docker/convert v0.3.4
+ go.getarcane.app/kit v0.4.0
+ go.getarcane.app/streams v0.4.5
go.getarcane.app/sys/cgroup v0.2.4
- go.getarcane.app/sys/crypto v0.2.2
- go.getarcane.app/updater v0.11.2
+ go.getarcane.app/sys/crypto v0.3.0
+ go.getarcane.app/updater v0.11.3
go.uber.org/fx v1.24.0
go.yaml.in/yaml/v4 v4.0.0-rc.6
golang.org/x/crypto v0.57.0
@@ -196,7 +197,6 @@ require (
github.com/jinzhu/now v1.1.5 // indirect
github.com/jonboulle/clockwork v0.5.0 // indirect
github.com/kevinburke/ssh_config v1.6.0 // indirect
- github.com/klauspost/cpuid/v2 v2.4.0 // indirect
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f // indirect
github.com/knqyf263/go-deb-version v0.0.0-20241115132648-6f4aee6ccd23 // indirect
github.com/knqyf263/go-rpm-version v0.0.0-20220614171824-631e686d1075 // indirect
@@ -240,7 +240,7 @@ require (
github.com/package-url/packageurl-go v0.1.6 // indirect
github.com/parthivsaikia/go-pacman-version v0.0.0-20260212091406-8640ae78daee // indirect
github.com/philhofer/fwd v1.2.0 // indirect
- github.com/pjbgf/sha1cd v0.6.0 // indirect
+ github.com/pjbgf/sha1cd v0.7.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index 39ad43479..e9b3b9d56 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -278,8 +278,8 @@ github.com/go-git/go-billy/v5 v5.9.2 h1:OXFSRyz4g20upsGDJgQG9Bak1l/ZEv8GHVYB52O7
github.com/go-git/go-billy/v5 v5.9.2/go.mod h1:ExsU+jcGwXTBOnyilvAnEM1wug1IxHr4yP2ZXsNRtV0=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
-github.com/go-git/go-git/v5 v5.19.2 h1:wkfn7vOlUBu8ivAWKBWisTiwJK4jYHzTF8Ndv1LyGqY=
-github.com/go-git/go-git/v5 v5.19.2/go.mod h1:QqCBE1EFN5ddFmrliLQ3/ntRCUjZU3EJuwuB/jWEHjk=
+github.com/go-git/go-git/v5 v5.19.3 h1:qHttbZ+Am7wEjdTpR1XMQ4rl42FK9SIXzZ4o9x7s6M4=
+github.com/go-git/go-git/v5 v5.19.3/go.mod h1:Ye4C8dVigkqrv9UsB4NMdSLV4yAIkLiIhW61gcOyhl4=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -441,8 +441,6 @@ github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7Dmvb
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ=
github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
-github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
-github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f h1:GvCU5GXhHq+7LeOzx/haG7HSIZokl3/0GkoUFzsRJjg=
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f/go.mod h1:q59u9px8b7UTj0nIjEjvmTWekazka6xIt6Uogz5Dm+8=
github.com/knqyf263/go-deb-version v0.0.0-20241115132648-6f4aee6ccd23 h1:dWzdsqjh1p2gNtRKqNwuBvKqMNwnLOPLzVZT1n6DK7s=
@@ -581,8 +579,8 @@ github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdD
github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
-github.com/pjbgf/sha1cd v0.6.0 h1:3WJ8Wz8gvDz29quX1OcEmkAlUg9diU4GxJHqs0/XiwU=
-github.com/pjbgf/sha1cd v0.6.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM=
+github.com/pjbgf/sha1cd v0.7.0 h1:ZRNPKHj+gfkLBf0KJv/p1Hmz+7bqCT5o311YX0nq+DA=
+github.com/pjbgf/sha1cd v0.7.0/go.mod h1:pKR5Li+qTCo+ebqITZfwPlJGoCFCvSO00qxjbNtTUFQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -747,22 +745,24 @@ github.com/zmb3/spotify/v2 v2.3.1 h1:aEyIPotROM3JJjHMCImFROgnPIUpzVo8wymYSaPSd9w
github.com/zmb3/spotify/v2 v2.3.1/go.mod h1:+LVh9CafHu7SedyqYmEf12Rd01dIVlEL845yNhksW0E=
go.getarcane.app/acfs v0.6.2 h1:5cO8uWPz16lg+aP/iQe+k5IIDTToccCqoakwoDfUOOE=
go.getarcane.app/acfs v0.6.2/go.mod h1:Z+0Gs4LGNjvGMLq+TKv/oGKh29FRbAH6mcVPwY5KhFI=
-go.getarcane.app/builds v0.4.3 h1:GCxkZlPzpWk5OwCxAqqI4XII0MMowBSjfEYZWtEiH9I=
-go.getarcane.app/builds v0.4.3/go.mod h1:Mzxkcl7S3zb9c206K+IDrU0vpjati4D+6i2k9RvwoqE=
-go.getarcane.app/docker/compat v0.1.1 h1:x/mawtU3DWpMzbxvqXUShGaI3m+MzPNYv4OB3VUebqM=
-go.getarcane.app/docker/compat v0.1.1/go.mod h1:vDKmRqX9ktTFDeR7M+IPxNNPtIgo02x2h5WMxlFv5LE=
-go.getarcane.app/docker/convert v0.3.3 h1:cbgbehnWLOarwloU0BMU5gpgFCM7DoCvcDEpS3tUrFg=
-go.getarcane.app/docker/convert v0.3.3/go.mod h1:QuGCXstmM/3cPVZse0sPe3RSZ/Hkj6M7zV3UDpWdxJo=
-go.getarcane.app/kit v0.3.2 h1:L7CAvGawDg70K/vVxDeM2xZBCHqwuthc9B5OwQwL0Hc=
-go.getarcane.app/kit v0.3.2/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
-go.getarcane.app/streams v0.4.4 h1:R8cJf6AvT3kg578JM6hJuLo4gOnCBCu+e3VPSVgpiKk=
-go.getarcane.app/streams v0.4.4/go.mod h1:Og1Zb9NlWoNX2EYfEheneoKnJaONoCJtFE5j3KHtL7w=
+go.getarcane.app/builds v0.4.4 h1:r9e97gmG2vic6kZB1UfTp9vSpqb1nPYA6CBlbaCvH64=
+go.getarcane.app/builds v0.4.4/go.mod h1:8B6z4dKZqE36Y+Rpudx7AIL3BXeIoqsMgrJQepRKeds=
+go.getarcane.app/docker v0.1.0 h1:iUhl7amZsdAE4p2efVRd0i1tw1Vl9i1VgFqdBAf90S8=
+go.getarcane.app/docker v0.1.0/go.mod h1:uGxT363iZM6n2WLXCz2T0ejCP/8xInuJNzXnySLe+pc=
+go.getarcane.app/docker/compat v0.1.2 h1:B1xx0iU4J+BKlrK+QVO0+axXfDBzK/tUPUDQtRtDcuY=
+go.getarcane.app/docker/compat v0.1.2/go.mod h1:vDKmRqX9ktTFDeR7M+IPxNNPtIgo02x2h5WMxlFv5LE=
+go.getarcane.app/docker/convert v0.3.4 h1:S5lph5rskjv+DAEdvJ03TNuFh6DOgcH6Lb5xbH2xRBE=
+go.getarcane.app/docker/convert v0.3.4/go.mod h1:QuGCXstmM/3cPVZse0sPe3RSZ/Hkj6M7zV3UDpWdxJo=
+go.getarcane.app/kit v0.4.0 h1:3PqyAmBfp07ZOK1ztCwS6vuOzQKFtXeMbk+P0oxhIK4=
+go.getarcane.app/kit v0.4.0/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
+go.getarcane.app/streams v0.4.5 h1:F4h+yYqICn6GmW1yeBoxHFNkDGcWg6/0XGWPMmp5yBU=
+go.getarcane.app/streams v0.4.5/go.mod h1:Og1Zb9NlWoNX2EYfEheneoKnJaONoCJtFE5j3KHtL7w=
go.getarcane.app/sys/cgroup v0.2.4 h1:8gwVZENjddDZmWU2LxTFEZnxHYC9pY0YZhk8f3Woup0=
go.getarcane.app/sys/cgroup v0.2.4/go.mod h1:hJyCjpx04VcaaSvkRsMvZl5OLUlAQ60K5gEy1ctuU4U=
-go.getarcane.app/sys/crypto v0.2.2 h1:EO0jr95L9tAU5ZShr5AxkL7LdXJNZBlC+/CSKYg8O1s=
-go.getarcane.app/sys/crypto v0.2.2/go.mod h1:bA7dHfhnUCXl06+RxBJjwtoLR01J9WSZft6yoVnW4jE=
-go.getarcane.app/updater v0.11.2 h1:W3zvb2LZ1QgYeKrK6vbFK4MqfUQHgD4Pe2s1aLO9JNM=
-go.getarcane.app/updater v0.11.2/go.mod h1:hCzKPVcZvPkkIgC568RagIB/DRytQLbhC1Q06uVzJx8=
+go.getarcane.app/sys/crypto v0.3.0 h1:vuPTlS7yIkXsfEfJcQ6jzoWoMEQ97DP/fmCZ3Pom73U=
+go.getarcane.app/sys/crypto v0.3.0/go.mod h1:Rxnq1pb5HVSoJ4VKmL6LZGCrztMONaypXKc8Zg0BMhE=
+go.getarcane.app/updater v0.11.3 h1:diLzw5yEQdOvTbRUFvFzZMW0zsjcNffOBmX/4TMHtsg=
+go.getarcane.app/updater v0.11.3/go.mod h1:JqnOb7WwtgUTyTJLq4zEUdaKpTSqb1CRvZ45XfgYq2M=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
diff --git a/backend/internal/build/service.go b/backend/internal/build/service.go
index d39ecbe17..bfd43cb92 100644
--- a/backend/internal/build/service.go
+++ b/backend/internal/build/service.go
@@ -18,6 +18,7 @@ import (
"go.getarcane.app/builds/api"
"go.getarcane.app/builds/pkg/contextsource"
"go.getarcane.app/builds/types"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/kit/pkg/capture"
gitkit "go.getarcane.app/kit/pkg/git"
@@ -25,12 +26,11 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/build/children/workspace"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/gitrepo"
"github.com/getarcaneapp/arcane/backend/v2/internal/registry"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/gitutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
)
@@ -38,7 +38,7 @@ import (
type BuildService struct {
db *database.DB
settings *settings.SettingsService
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
registryService *registry.ContainerRegistryService
gitRepository *gitrepo.GitRepositoryService
eventService *event.EventService
@@ -54,7 +54,7 @@ const buildHistoryOutputLimitBytes = 2 * 1024 * 1024
func NewBuildService(
db *database.DB,
localSettings *settings.SettingsService,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
registryService *registry.ContainerRegistryService,
gitRepository *gitrepo.GitRepositoryService,
eventService *event.EventService,
@@ -124,7 +124,7 @@ func (
writer := io.Writer(logCapture)
var logWriter io.WriteCloser
if progressWriter != nil {
- logWriter = dockerutils.NewLogLineWriter(progressWriter)
+ logWriter = docker.NewLogLineWriter(progressWriter)
writer = io.MultiWriter(logWriter, logCapture)
}
diff --git a/backend/internal/container/handler.go b/backend/internal/container/handler.go
index e0c565a1f..cf23f9710 100644
--- a/backend/internal/container/handler.go
+++ b/backend/internal/container/handler.go
@@ -18,6 +18,7 @@ import (
dockercontainer "github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/samber/mo"
+ "go.getarcane.app/docker/types"
"go.getarcane.app/kit/pkg"
"github.com/getarcaneapp/arcane/backend/v2/internal/activity"
@@ -28,7 +29,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/middleware"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
@@ -717,7 +717,7 @@ func (h *ContainerHandler) RedeployContainer(ctx context.Context, input *Contain
)
activitylib.AwaitHandlerActivitySlot(runtimeCtx, h.activityService, activityID, input.EnvironmentID)
activityWriter := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, io.Discard, "Redeploying container")
- redeployCtx := context.WithValue(runtimeCtx, dockerutils.ProgressWriterKey{}, activityWriter)
+ redeployCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, activityWriter)
newContainerID, err := h.containerService.RedeployContainer(redeployCtx, input.ContainerID, *user)
if err != nil {
activitylib.FlushWriter(activityWriter)
@@ -806,7 +806,7 @@ func (h *ContainerHandler) EditContainer(ctx context.Context, input *EditContain
)
activitylib.AwaitHandlerActivitySlot(runtimeCtx, h.activityService, activityID, input.EnvironmentID)
activityWriter := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, io.Discard, "Editing container")
- editCtx := context.WithValue(runtimeCtx, dockerutils.ProgressWriterKey{}, activityWriter)
+ editCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, activityWriter)
newContainerID, err := h.containerService.EditContainer(editCtx, input.ContainerID, input.Body, *user)
if err != nil {
activitylib.FlushWriter(activityWriter)
diff --git a/backend/internal/container/service.go b/backend/internal/container/service.go
index 42f0eadf3..99dcac663 100644
--- a/backend/internal/container/service.go
+++ b/backend/internal/container/service.go
@@ -24,7 +24,9 @@ import (
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/client"
"github.com/samber/hot"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
+ "go.getarcane.app/docker/types"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"go.getarcane.app/updater"
@@ -34,12 +36,11 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/container/children/stats"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/project"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
@@ -48,7 +49,7 @@ import (
)
type ContainerService struct {
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
eventService *event.EventService
imageService *image.ImageService
settingsService *settings.SettingsService
@@ -72,7 +73,7 @@ type ContainerListResult struct {
func NewContainerService(
eventService *event.EventService,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
imageService *image.ImageService,
settingsService *settings.SettingsService,
projectService *project.ProjectService,
@@ -197,11 +198,11 @@ func (
}
defer func() { _ = reader.Close() }()
- progressWriter, _ := ctx.Value(dockerutils.ProgressWriterKey{}).(io.Writer)
- logWriter := dockerutils.NewLogLineWriter(progressWriter)
+ progressWriter, _ := ctx.Value(types.ProgressWriterKey{}).(io.Writer)
+ logWriter := docker.NewLogLineWriter(progressWriter)
defer func() { _ = logWriter.Close() }()
- streamErr := dockerutils.RenderJSONMessageStream(reader, logWriter)
+ streamErr := docker.RenderJSONMessageStream(reader, logWriter)
if streamErr != nil {
s.eventService.LogErrorEvent(ctx, event.EventTypeContainerError, "container", containerID, containerName, user.ID, user.Username, "0", streamErr, database.JSON{
"action": action,
@@ -578,8 +579,8 @@ func (
return "", false, nil
}
containerLabels := containerInfo.Config.Labels
- projectName := dockerutils.ComposeProjectLabel(containerLabels)
- serviceName := dockerutils.ComposeServiceLabel(containerLabels)
+ projectName := docker.ComposeProjectLabel(containerLabels)
+ serviceName := docker.ComposeServiceLabel(containerLabels)
if projectName == "" || serviceName == "" {
return "", false, nil
}
@@ -1145,7 +1146,7 @@ func (s *ContainerService) GetContainerEditConfig(ctx context.Context, container
containerLabels = containerInfo.Config.Labels
}
- isCompose := dockerutils.ComposeProjectLabel(containerLabels) != ""
+ isCompose := docker.ComposeProjectLabel(containerLabels) != ""
currentContainerID, currentContainerErr := cgroup.CurrentContainerID()
editDisabled := labels.ShouldDisableArcaneServerRedeploy(containerLabels, containerInfo.ID, currentContainerID, currentContainerErr)
@@ -1181,7 +1182,7 @@ func (s *ContainerService) EditContainer(ctx context.Context, containerID string
containerName := strings.TrimPrefix(containerInfo.Name, "/")
- if localProject := dockerutils.ComposeProjectLabel(containerInfo.Config.Labels); localProject != "" {
+ if localProject := docker.ComposeProjectLabel(containerInfo.Config.Labels); localProject != "" {
return "", fmt.Errorf("compose project %s: %w", localProject, common.ErrContainerComposeManaged)
}
@@ -1269,9 +1270,9 @@ func (s *ContainerService) GetContainerDetails(ctx context.Context, id string) (
details.RedeployDisabled = labels.ShouldDisableArcaneServerRedeploy(details.Labels, details.ID, currentContainerID, currentContainerErr)
var excluded map[string]bool
if s.settingsService != nil {
- excluded = dockerutils.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
+ excluded = docker.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
}
- details.AutoUpdateEnabled = !labels.IsUpdateDisabled(details.Labels) && !dockerutils.ContainerNameExcluded([]string{details.Name}, excluded)
+ details.AutoUpdateEnabled = !labels.IsUpdateDisabled(details.Labels) && !docker.ContainerNameExcluded([]string{details.Name}, excluded)
updates := s.lookupContainerUpdateInfoInternal(ctx, []container.Summary{{ID: details.ID, Image: details.Image, ImageID: details.ImageID, Labels: details.Labels}})
details.UpdateInfo = updates[details.ID]
s.applyContainerDetailsIconInternal(ctx, &details)
@@ -1505,9 +1506,9 @@ func (
}
defer func() { _ = reader.Close() }()
- progressWriter, _ := ctx.Value(dockerutils.ProgressWriterKey{}).(io.Writer)
- logWriter := dockerutils.NewLogLineWriter(progressWriter)
- streamErr := dockerutils.RenderJSONMessageStream(reader, logWriter)
+ progressWriter, _ := ctx.Value(types.ProgressWriterKey{}).(io.Writer)
+ logWriter := docker.NewLogLineWriter(progressWriter)
+ streamErr := docker.RenderJSONMessageStream(reader, logWriter)
_ = logWriter.Close()
if streamErr != nil {
s.eventService.LogErrorEvent(
@@ -1805,7 +1806,7 @@ func getContainerProjectNameInternal(localContainer containertypes.Summary) stri
return containerNoProjectGroup
}
- projectName := dockerutils.ComposeProjectLabel(localContainer.Labels)
+ projectName := docker.ComposeProjectLabel(localContainer.Labels)
return kit.Ternary(projectName == "", containerNoProjectGroup, projectName)
}
@@ -1853,7 +1854,7 @@ func (
items := make([]containertypes.Summary, 0, len(containers))
var excluded map[string]bool
if s.settingsService != nil {
- excluded = dockerutils.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
+ excluded = docker.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
}
for _, dc := range containers {
summary := containertypes.NewSummary(dc)
@@ -1865,7 +1866,7 @@ func (
}
summary.UpdateInfo = updateInfoMap[dc.ID]
summary.RedeployDisabled = labels.ShouldDisableArcaneServerRedeploy(summary.Labels, summary.ID, currentContainerID, currentContainerErr)
- summary.AutoUpdateEnabled = !labels.IsUpdateDisabled(dc.Labels) && !dockerutils.ContainerNameExcluded(dc.Names, excluded)
+ summary.AutoUpdateEnabled = !labels.IsUpdateDisabled(dc.Labels) && !docker.ContainerNameExcluded(dc.Names, excluded)
summary.Hidden, _ = kit.ParseBool(dc.Labels[libarcane.HiddenResourceLabel])
items = append(items, summary)
}
@@ -1908,14 +1909,14 @@ func (s *ContainerService) resolveContainerIconInternal(ctx context.Context, loc
return iconcatalog.Resolve(project.IconCatalogForContext(ctx), explicitIcon)
}
- projectName := dockerutils.ComposeProjectLabel(localLabels)
+ projectName := docker.ComposeProjectLabel(localLabels)
if projectName == "" || s == nil || s.projectService == nil {
return iconcatalog.Resolve(project.IconCatalogForContext(ctx), explicitIcon)
}
meta := s.getCachedProjectIconMetadataInternal(ctx, projectName, metadataByProject)
- serviceName := dockerutils.ComposeServiceLabel(localLabels)
+ serviceName := docker.ComposeServiceLabel(localLabels)
return iconcatalog.Resolve(project.IconCatalogForContext(ctx), cmp.Or(
explicitIcon,
meta.ServiceIconSets[serviceName],
@@ -2125,7 +2126,7 @@ func (s *ContainerService) buildContainerFilterAccessors() []pagination.FilterAc
{
Key: "standalone",
Fn: func(c containertypes.Summary, filterValue string) bool {
- isStandalone := dockerutils.ComposeProjectLabel(c.Labels) == ""
+ isStandalone := docker.ComposeProjectLabel(c.Labels) == ""
value, valid := kit.ParseBool(filterValue)
return !valid || isStandalone == value
},
@@ -2280,7 +2281,7 @@ func (s *ContainerService) StreamLogs(ctx context.Context, containerID string, l
defer func() { _ = logs.Close() }()
isTTY := containerInspect.Container.Config != nil && containerInspect.Container.Config.Tty
- return dockerutils.StreamContainerLogs(ctx, logs, logsChan, follow, isTTY)
+ return docker.StreamContainerLogs(ctx, logs, logsChan, follow, isTTY)
}
// DownloadLogs returns every log line Docker retains for the container as a
@@ -2304,7 +2305,7 @@ func (s *ContainerService) DownloadLogs(ctx context.Context, containerID string)
pr, pw := io.Pipe()
go func() {
_, copyErr := stdcopy.StdCopy(pw, pw, logs)
- if dockerutils.IsExpectedStreamEndError(copyErr) {
+ if docker.IsExpectedStreamEndError(copyErr) {
copyErr = nil
}
_ = pw.CloseWithError(copyErr)
diff --git a/backend/internal/dashboard/service.go b/backend/internal/dashboard/service.go
index 1ecf1da5e..54e427f1b 100644
--- a/backend/internal/dashboard/service.go
+++ b/backend/internal/dashboard/service.go
@@ -16,6 +16,7 @@ import (
versiontypes "github.com/getarcaneapp/arcane/types/v2/version"
volumetypes "github.com/getarcaneapp/arcane/types/v2/volume"
dockercontainer "github.com/moby/moby/api/types/container"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"go.getarcane.app/updater/labels"
@@ -25,7 +26,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/apikey"
"github.com/getarcaneapp/arcane/backend/v2/internal/container"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/environment"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/project"
@@ -33,7 +34,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/version"
"github.com/getarcaneapp/arcane/backend/v2/internal/volume"
"github.com/getarcaneapp/arcane/backend/v2/internal/vulnerability"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/iconcatalog"
)
@@ -47,7 +47,7 @@ const (
type DashboardService struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
containerService *container.ContainerService
projectService *project.ProjectService
imageService *image.ImageService
@@ -79,7 +79,7 @@ type DashboardActionItemsOptions struct {
func NewDashboardService(
db *database.DB,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
containerService *container.ContainerService,
projectService *project.ProjectService,
imageService *image.ImageService,
@@ -188,12 +188,12 @@ func (s *DashboardService) buildSnapshotInternal(ctx context.Context, options Da
} else {
var excluded map[string]bool
if s.settingsService != nil {
- excluded = dockerutils.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
+ excluded = docker.ExcludedContainerNameSet(s.settingsService.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
}
for _, container := range filteredContainers {
summary := containertypes.NewSummary(container)
summary.RedeployDisabled = labels.ShouldDisableArcaneServerRedeploy(summary.Labels, summary.ID, currentContainerID, currentContainerErr)
- summary.AutoUpdateEnabled = !labels.IsUpdateDisabled(container.Labels) && !dockerutils.ContainerNameExcluded(container.Names, excluded)
+ summary.AutoUpdateEnabled = !labels.IsUpdateDisabled(container.Labels) && !docker.ContainerNameExcluded(container.Names, excluded)
containerItems = append(containerItems, summary)
}
}
@@ -226,7 +226,7 @@ func (s *DashboardService) buildSnapshotInternal(ctx context.Context, options Da
imagePage = imageItems[:min(dashboardSnapshotPreloadLimit, len(imageItems))]
}
- imageUsageCounts := docker.CountImageUsage(dockerImages, imageConsumers)
+ imageUsageCounts := dockerInternal.CountImageUsage(dockerImages, imageConsumers)
// Uses the unfiltered container list so a volume mounted only by an internal
// container still counts as in use, matching the volumes page.
@@ -403,7 +403,7 @@ func (s *DashboardService) getPendingResourceUpdatesCountInternal(ctx context.Co
func filterStandaloneDockerContainersInternal(containers []dockercontainer.Summary) []dockercontainer.Summary {
filtered := make([]dockercontainer.Summary, 0, len(containers))
for _, c := range containers {
- if dockerutils.ComposeProjectLabel(c.Labels) != "" {
+ if docker.ComposeProjectLabel(c.Labels) != "" {
continue
}
filtered = append(filtered, c)
diff --git a/backend/internal/docker/service.go b/backend/internal/docker/service.go
index 786bcc193..26f10d5ee 100644
--- a/backend/internal/docker/service.go
+++ b/backend/internal/docker/service.go
@@ -20,6 +20,7 @@ import (
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/volume"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/streams/bus"
@@ -29,7 +30,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
)
diff --git a/backend/internal/image/service.go b/backend/internal/image/service.go
index 353aa1e45..142967fcc 100644
--- a/backend/internal/image/service.go
+++ b/backend/internal/image/service.go
@@ -23,6 +23,7 @@ import (
"github.com/moby/moby/client"
"github.com/samber/hot"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/updater"
"go.getarcane.app/updater/pkg/utils/tagpolicy"
@@ -30,7 +31,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/activity"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/image/children/attestations"
"github.com/getarcaneapp/arcane/backend/v2/internal/image/children/patch"
@@ -38,7 +39,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/registry"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
"github.com/getarcaneapp/arcane/backend/v2/internal/vulnerability"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/registryauth"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
@@ -47,7 +47,7 @@ import (
type ImageService struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
imageUpdateService *imageupdate.ImageUpdateService
registryService *registry.ContainerRegistryService
vulnerabilityService *vulnerability.VulnerabilityService
@@ -59,7 +59,7 @@ type ImageService struct {
func NewImageService(
db *database.DB,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
registryService *registry.ContainerRegistryService,
imageUpdateService *imageupdate.ImageUpdateService,
vulnerabilityService *vulnerability.VulnerabilityService,
@@ -280,8 +280,8 @@ func (s *ImageService) PullImage(ctx context.Context, imageName string, progress
}
defer func() { _ = reader.Close() }()
- logWriter := dockerutils.NewLogLineWriter(progressWriter)
- streamErr := dockerutils.RenderJSONMessageStream(reader, logWriter)
+ logWriter := docker.NewLogLineWriter(progressWriter)
+ streamErr := docker.RenderJSONMessageStream(reader, logWriter)
_ = logWriter.Close()
if streamErr != nil {
if errors.Is(streamErr, context.Canceled) || strings.Contains(streamErr.Error(), "context canceled") {
@@ -479,7 +479,7 @@ func (s *ImageService) LoadImageFromReader(ctx context.Context, reader io.Reader
var result imagetypes.LoadResult
var responseBuilder strings.Builder
- streamErr := dockerutils.RenderJSONMessageStream(loadResp, &responseBuilder)
+ streamErr := docker.RenderJSONMessageStream(loadResp, &responseBuilder)
if streamErr != nil {
s.eventService.LogErrorEvent(
ctx,
@@ -1032,7 +1032,7 @@ func (s *ImageService) BuildProjectIDMap(ctx context.Context, containers []conta
if c.Labels == nil {
continue
}
- if projectName := dockerutils.ComposeProjectLabel(c.Labels); projectName != "" {
+ if projectName := docker.ComposeProjectLabel(c.Labels); projectName != "" {
projectNameSet[projectName] = struct{}{}
}
}
@@ -1059,7 +1059,7 @@ func BuildVolumeUsageMap(containers []container.Summary, projectIDByName map[str
continue
}
- projectName := dockerutils.ComposeProjectLabel(c.Labels)
+ projectName := docker.ComposeProjectLabel(c.Labels)
if projectName != "" {
projectID := projectIDByName[projectName]
@@ -1078,7 +1078,7 @@ func BuildVolumeUsageMap(containers []container.Summary, projectIDByName map[str
continue
}
- containerName := cmp.Or(dockerutils.ContainerNameFromNames(c.Names), c.ID)
+ containerName := cmp.Or(docker.ContainerNameFromNames(c.Names), c.ID)
if containerSeen[c.ImageID] == nil {
containerSeen[c.ImageID] = make(map[string]bool)
diff --git a/backend/internal/network/service.go b/backend/internal/network/service.go
index ab527434a..cdb94bba6 100644
--- a/backend/internal/network/service.go
+++ b/backend/internal/network/service.go
@@ -15,6 +15,7 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/kit/pkg/mapping"
@@ -22,20 +23,19 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
)
type NetworkService struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
eventService *event.EventService
}
-func NewNetworkService(db *database.DB, dockerService *docker.DockerClientService, eventService *event.EventService) *NetworkService {
+func NewNetworkService(db *database.DB, dockerService *dockerInternal.DockerClientService, eventService *event.EventService) *NetworkService {
return &NetworkService{
db: db,
dockerService: dockerService,
@@ -122,7 +122,7 @@ func (s *NetworkService) GetNetworkTopology(ctx context.Context) (*networktypes.
Metadata: networktypes.TopologyNodeMetadata{
Driver: rawNetwork.Driver,
Scope: rawNetwork.Scope,
- IsDefault: dockerutil.IsDefaultNetwork(rawNetwork.Name),
+ IsDefault: docker.IsDefaultNetwork(rawNetwork.Name),
},
})
@@ -383,7 +383,7 @@ func (s *NetworkService) ListNetworksPaginated(ctx context.Context, params pagin
return nil, pagination.Response{}, networktypes.UsageCounts{}, fmt.Errorf("failed to list containers: %w", err)
}
- inUseByID, inUseByName := dockerutil.BuildNetworkUsageMaps(containers)
+ inUseByID, inUseByName := docker.BuildNetworkUsageMaps(containers)
networkList, err := compat.NetworkListWithCompatibility(ctx, dockerClient, client.NetworkListOptions{})
if err != nil {
@@ -414,7 +414,7 @@ func buildTopologyContainerInfoInternal(containers []container.Summary) map[stri
for _, rawContainer := range containers {
name := rawContainer.ID
if len(rawContainer.Names) > 0 {
- name = dockerutil.ContainerNameFromNames(rawContainer.Names)
+ name = docker.ContainerNameFromNames(rawContainer.Names)
}
infoByID[rawContainer.ID] = topologyContainerInfo{
Name: name,
@@ -433,7 +433,7 @@ func (s *NetworkService) convertToNetworkSummaries(rawNets []network.Summary, in
return nil, fmt.Errorf("failed to map network: %w", err)
}
netDto.InUse = inUseByID[netDto.ID] || inUseByName[netDto.Name]
- netDto.IsDefault = dockerutil.IsDefaultNetwork(netDto.Name)
+ netDto.IsDefault = docker.IsDefaultNetwork(netDto.Name)
items = append(items, netDto)
}
return items, nil
diff --git a/backend/internal/port/service.go b/backend/internal/port/service.go
index 55f12b948..f70119ae2 100644
--- a/backend/internal/port/service.go
+++ b/backend/internal/port/service.go
@@ -8,18 +8,18 @@ import (
"github.com/getarcaneapp/arcane/types/v2/container"
porttypes "github.com/getarcaneapp/arcane/types/v2/port"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
)
type PortService struct {
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
}
-func NewPortService(dockerService *docker.DockerClientService) *PortService {
+func NewPortService(dockerService *dockerInternal.DockerClientService) *PortService {
return &PortService{dockerService: dockerService}
}
@@ -128,7 +128,7 @@ func (s *PortService) buildPortSortBindings() []pagination.SortBinding[porttypes
func primaryContainerNameInternal(names []string, id string) string {
if len(names) > 0 && names[0] != "" {
- return dockerutil.ContainerNameFromNames(names)
+ return docker.ContainerNameFromNames(names)
}
if len(id) >= 12 {
return id[:12]
diff --git a/backend/internal/project/children/details/service.go b/backend/internal/project/children/details/service.go
index b99cc6b4b..1bc467865 100644
--- a/backend/internal/project/children/details/service.go
+++ b/backend/internal/project/children/details/service.go
@@ -21,16 +21,16 @@ import (
"github.com/getarcaneapp/arcane/types/v2/project"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"go.getarcane.app/updater/labels"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/imageupdate"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/iconcatalog"
@@ -40,12 +40,12 @@ import (
// Service reads project runtime state, include files and update checks.
type Service struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
imageService *image.ImageService
settingsService *settings.SettingsService
}
-func New(db *database.DB, dockerService *docker.DockerClientService, imageService *image.ImageService, settingsService *settings.SettingsService) *Service {
+func New(db *database.DB, dockerService *dockerInternal.DockerClientService, imageService *image.ImageService, settingsService *settings.SettingsService) *Service {
return &Service{db: db, dockerService: dockerService, imageService: imageService, settingsService: settingsService}
}
@@ -78,7 +78,7 @@ func (s *Service) runtimeImageIDsByContainerInternal(ctx context.Context, projec
return imageIDs
}
for _, c := range containers {
- if dockerutil.ComposeProjectLabel(c.Labels) == projectName && c.ImageID != "" {
+ if docker.ComposeProjectLabel(c.Labels) == projectName && c.ImageID != "" {
imageIDs[c.ID] = c.ImageID
}
}
@@ -339,7 +339,7 @@ func ConfiguredRuntimeServiceUpdateInfo(services []types.ServiceConfig, runtime
for _, service := range runtime {
name := service.Name
if name == "" {
- name = dockerutil.ComposeServiceLabel(service.ContainerLabels)
+ name = docker.ComposeServiceLabel(service.ContainerLabels)
}
config, ok := configs[name]
if !ok || scoped[service.ContainerID] == nil {
diff --git a/backend/internal/project/children/lifecycle/service.go b/backend/internal/project/children/lifecycle/service.go
index 6226b8333..eb597b1cb 100644
--- a/backend/internal/project/children/lifecycle/service.go
+++ b/backend/internal/project/children/lifecycle/service.go
@@ -26,13 +26,13 @@ import (
"github.com/moby/moby/client"
"github.com/samber/mo"
"go.getarcane.app/acfs"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/kit/pkg/capture"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
@@ -41,11 +41,11 @@ import (
// Service runs pre-deploy scripts in throwaway runner containers.
type Service struct {
settingsService *settings.SettingsService
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
imageService *image.ImageService
}
-func New(settingsService *settings.SettingsService, dockerService *docker.DockerClientService, imageService *image.ImageService) *Service {
+func New(settingsService *settings.SettingsService, dockerService *dockerInternal.DockerClientService, imageService *image.ImageService) *Service {
return &Service{settingsService: settingsService, dockerService: dockerService, imageService: imageService}
}
@@ -141,7 +141,7 @@ func BuildLifecycleMounts(workspace *mount.Mount, extras []lifecycletype.ExtraMo
// The project directory is mounted read-write so scripts can write
// artifacts the deploy then consumes — e.g. `sops -d secrets.enc.env > .env`.
// Anything written persists on the host until the next sync overwrites it.
- // The workspace mount itself is built by MountForCurrentContainerSubpath
+ // The workspace mount itself is built by MountForSubpath
// so it carries the right Type (bind or volume) and any required
// VolumeOptions.Subpath.
mounts = append(mounts, *workspace)
@@ -250,9 +250,11 @@ func (s *Service) RunScript(
// plain bind that points at the right host subdir. If Arcane is running
// on the host (no container inspect available), fall back to a bind on
// the project path as-is.
- workspaceMount, mountErr := dockerutils.MountForCurrentContainerSubpath(ctx, dockerClient, projectPath, LifecycleWorkspaceMount)
- if mountErr != nil {
- slog.WarnContext(ctx, "failed to derive workspace mount; falling back to bind on project path", "projectPath", projectPath, "error", mountErr)
+ var workspaceMount *mount.Mount
+ if inspect, inspectErr := libarcane.InspectCurrentArcaneContainer(ctx, dockerClient); inspectErr != nil {
+ slog.WarnContext(ctx, "failed to derive workspace mount; falling back to bind on project path", "projectPath", projectPath, "error", inspectErr)
+ } else {
+ workspaceMount = docker.MountForSubpath(inspect.Mounts, projectPath, LifecycleWorkspaceMount)
}
if workspaceMount == nil {
workspaceMount = &mount.Mount{Type: mount.TypeBind, Source: projectPath, Target: LifecycleWorkspaceMount}
diff --git a/backend/internal/project/children/listing/service.go b/backend/internal/project/children/listing/service.go
index ae4c02c1e..ba0e320c5 100644
--- a/backend/internal/project/children/listing/service.go
+++ b/backend/internal/project/children/listing/service.go
@@ -17,6 +17,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/project"
"github.com/moby/moby/api/types/container"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/kit/pkg/mapping"
"go.getarcane.app/sys/cgroup"
@@ -24,7 +25,6 @@ import (
"gorm.io/gorm"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/iconcatalog"
diff --git a/backend/internal/project/handler.go b/backend/internal/project/handler.go
index 01dd44a12..d20ddf972 100644
--- a/backend/internal/project/handler.go
+++ b/backend/internal/project/handler.go
@@ -19,6 +19,7 @@ import (
"github.com/getarcaneapp/arcane/types/v2/volume"
workspacetypes "github.com/getarcaneapp/arcane/types/v2/workspace"
"github.com/samber/mo"
+ "go.getarcane.app/docker/types"
"go.getarcane.app/kit/pkg/mapping"
"gorm.io/gorm"
@@ -26,7 +27,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
"github.com/getarcaneapp/arcane/backend/v2/internal/project/children/tags"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/handlerutil"
@@ -275,7 +275,7 @@ type projectStreamOperationConfigInternal struct {
SuccessMessage string
Metadata database.JSON
// Action runs the operation. ctx carries the stream writer under
- // dockerutils.ProgressWriterKey; it is also passed directly for actions
+ // types.ProgressWriterKey; it is also passed directly for actions
// that take a writer parameter.
Action func(ctx context.Context, writer io.Writer) error
}
@@ -326,7 +326,7 @@ func (h *ProjectHandler) streamProjectOperationInternal(environmentID, projectID
writer := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, rawWriter, cfg.WriterStep)
- opCtx := context.WithValue(runtimeCtx, docker.ProgressWriterKey{}, writer)
+ opCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, writer)
if err := cfg.Action(opCtx, writer); err != nil {
activitylib.FlushWriter(writer)
activitylib.CompleteHandlerActivity(runtimeCtx, h.activityService, activityID, cfg.FailureMessage, err)
@@ -396,7 +396,7 @@ func (h *ProjectHandler) DownProject(ctx context.Context, input *DownProjectInpu
false,
)
activityWriter := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, io.Discard, "Stopping project")
- downCtx := context.WithValue(runtimeCtx, docker.ProgressWriterKey{}, activityWriter)
+ downCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, activityWriter)
if downProjectErr := h.projectService.DownProject(downCtx, input.ProjectID, *user); downProjectErr != nil {
activitylib.FlushWriter(activityWriter)
activitylib.CompleteHandlerActivity(runtimeCtx, h.activityService, activityID, "Project stopped", downProjectErr)
@@ -664,7 +664,7 @@ func (h *ProjectHandler) DestroyProject(ctx context.Context, input *DestroyProje
false,
)
activityWriter := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, io.Discard, "Destroying project")
- destroyCtx := context.WithValue(runtimeCtx, docker.ProgressWriterKey{}, activityWriter)
+ destroyCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, activityWriter)
if destroyProjectErr := h.projectService.DestroyProject(destroyCtx, input.ProjectID, removeFiles, removeVolumes, *user); destroyProjectErr != nil {
activitylib.FlushWriter(activityWriter)
activitylib.CompleteHandlerActivity(runtimeCtx, h.activityService, activityID, "Project destroyed", destroyProjectErr)
@@ -897,7 +897,7 @@ func (h *ProjectHandler) runProjectActivityActionInternal(ctx context.Context, e
)
}
activityWriter := activitylib.NewWriter(runtimeCtx, h.activityService, activityID, io.Discard, cfg.WriterStep)
- actionCtx := context.WithValue(runtimeCtx, docker.ProgressWriterKey{}, activityWriter)
+ actionCtx := context.WithValue(runtimeCtx, types.ProgressWriterKey{}, activityWriter)
if actionErr := cfg.Action(actionCtx, projectID, *user); actionErr != nil {
activitylib.FlushWriter(activityWriter)
activitylib.CompleteHandlerActivity(runtimeCtx, h.activityService, activityID, cfg.FailureMessage, actionErr)
diff --git a/backend/internal/project/service.go b/backend/internal/project/service.go
index c66e0b82b..e4f441097 100644
--- a/backend/internal/project/service.go
+++ b/backend/internal/project/service.go
@@ -32,6 +32,8 @@ import (
"github.com/samber/mo"
"go.getarcane.app/acfs"
acfstypes "go.getarcane.app/acfs/types"
+ "go.getarcane.app/docker"
+ dockertypes "go.getarcane.app/docker/types"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/kit/pkg/mapping"
"go.getarcane.app/sys/cgroup"
@@ -46,7 +48,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/imageupdate"
@@ -61,7 +63,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/project/children/workspace"
"github.com/getarcaneapp/arcane/backend/v2/internal/registry"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
@@ -81,7 +82,7 @@ type ProjectService struct {
settingsService *settings.SettingsService
eventService *event.EventService
imageService *image.ImageService
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
lifecycleService *LifecycleService
workspace *workspace.Service
details *projectdetails.Service
@@ -286,7 +287,7 @@ func NewProjectService(
settingsService *settings.SettingsService,
eventService *event.EventService,
imageService *image.ImageService,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
buildService buildServiceInternal,
lifecycleService *LifecycleService,
containerRegistryService *registry.ContainerRegistryService,
@@ -837,7 +838,7 @@ func NewLifecycleService(
db *database.DB,
settingsService *settings.SettingsService,
eventService *event.EventService,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
imageService *image.ImageService,
) *LifecycleService {
return &LifecycleService{
@@ -1139,7 +1140,7 @@ func (s *ProjectService) updateProjectServicesInternal(ctx context.Context, proj
return fmt.Errorf("resolve registry credentials: %w", err)
}
- progressWriter, _ := ctx.Value(dockerutil.ProgressWriterKey{}).(io.Writer)
+ progressWriter, _ := ctx.Value(dockertypes.ProgressWriterKey{}).(io.Writer)
if updateServicesErr := s.composeCoordinator.UpdateServices(ctx, projecttypes.ComposeServiceUpdate{
Project: compProj, Services: servicesToUpdate, Dependents: dependents, StoppedDependents: stoppedDependents,
Images: s.deployment.ImageOperations(&user, credentials), Progress: progressWriter,
@@ -1257,7 +1258,7 @@ func (s *ProjectService) DeployProject(ctx context.Context, projectID string, us
}
}()
- progressWriter, _ := ctx.Value(dockerutil.ProgressWriterKey{}).(io.Writer)
+ progressWriter, _ := ctx.Value(dockertypes.ProgressWriterKey{}).(io.Writer)
projectModel, err := s.composeCoordinator.Deploy(ctx, projecttypes.ComposeDeployment{
ProjectID: projectID, ProjectPath: projectFromDb.Path, Options: options,
DefaultPullPolicy: s.settingsService.GetStringSetting(ctx, "defaultDeployPullPolicy", "missing"),
@@ -1569,7 +1570,7 @@ func (s *ProjectService) RedeployProject(ctx context.Context, projectID string,
return errors.New("arcane cannot redeploy itself; use the system upgrade flow (Settings -> Updates) instead")
}
- progressWriter, _ := ctx.Value(dockerutil.ProgressWriterKey{}).(io.Writer)
+ progressWriter, _ := ctx.Value(dockertypes.ProgressWriterKey{}).(io.Writer)
if progressWriter == nil {
progressWriter = io.Discard
}
@@ -2495,7 +2496,7 @@ func (s *ProjectService) CountProjectsWithPendingUpdates(ctx context.Context, al
details[i].RuntimeServices = append(
details[i].RuntimeServices,
projecttypes.RuntimeService{
- Name: dockerutil.ComposeServiceLabel(
+ Name: docker.ComposeServiceLabel(
c.Labels,
),
ContainerID: c.ID,
diff --git a/backend/internal/swarm/children/services/service.go b/backend/internal/swarm/children/services/service.go
index 76364ad37..d0c27f51c 100644
--- a/backend/internal/swarm/children/services/service.go
+++ b/backend/internal/swarm/children/services/service.go
@@ -15,8 +15,8 @@ import (
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/swarm"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
)
diff --git a/backend/internal/system/children/backup/children/snapshots/service.go b/backend/internal/system/children/backup/children/snapshots/service.go
index 2e10740bd..ea996b16f 100644
--- a/backend/internal/system/children/backup/children/snapshots/service.go
+++ b/backend/internal/system/children/backup/children/snapshots/service.go
@@ -22,13 +22,13 @@ import (
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
"go.getarcane.app/acfs"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"github.com/getarcaneapp/arcane/backend/v2/internal/backup"
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
diff --git a/backend/internal/system/children/backup/service.go b/backend/internal/system/children/backup/service.go
index 113c8e1ed..a8fab5740 100644
--- a/backend/internal/system/children/backup/service.go
+++ b/backend/internal/system/children/backup/service.go
@@ -26,6 +26,7 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
@@ -36,7 +37,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/middleware"
"github.com/getarcaneapp/arcane/backend/v2/internal/s3"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
@@ -44,7 +45,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/system/children/backup/children/volumes"
"github.com/getarcaneapp/arcane/backend/v2/internal/volume"
"github.com/getarcaneapp/arcane/backend/v2/pkg/authz"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
@@ -107,7 +107,7 @@ type Dependencies struct {
Store Store
DB *database.DB
SQLDB func() (*sql.DB, error)
- Docker *docker.DockerClientService
+ Docker *dockerInternal.DockerClientService
Volumes *volume.VolumeService
Engine *backup.Engine
S3Destinations *s3.S3DestinationService
@@ -122,7 +122,7 @@ type Dependencies struct {
// schedules, replication, retention, and restore.
type Service struct {
store Store
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
volumeService *volume.VolumeService
engine *backup.Engine
s3Destinations *s3.S3DestinationService
@@ -206,7 +206,7 @@ func recoveryHelperExecutableInternal(mounts []container.MountPoint, executableP
if executablePath == "" {
return "", nil, errors.New("arcane executable path is empty")
}
- executableMount := dockerutil.MountForSubpath(mounts, executablePath, systemRecoveryHelperPath)
+ executableMount := docker.MountForSubpath(mounts, executablePath, systemRecoveryHelperPath)
if executableMount == nil {
return executablePath, nil, nil
}
@@ -915,7 +915,7 @@ func (s *Service) RestoreBackup(ctx context.Context, id, recoveryKey string, use
}
current := inspectResult.Container
// The helper reads the restored manifest and database through /app/data.
- appDataMount := dockerutil.MountForDestination(current.Mounts, "/app/data", "/app/data")
+ appDataMount := docker.MountForDestination(current.Mounts, "/app/data", "/app/data")
if appDataMount == nil {
return errors.New("arcane system restore requires /app/data to be mounted")
}
@@ -975,7 +975,7 @@ func (s *Service) RestoreBackup(ctx context.Context, id, recoveryKey string, use
return currentContainerIDErr == nil
},
func(ctx context.Context, inspect *container.InspectResponse, dockerHost string) string {
- return dockerutil.SelectDockerHostReachableNetworkMode(ctx, dockerClient, inspect, dockerHost)
+ return docker.SelectDockerHostReachableNetworkMode(ctx, dockerClient, inspect, dockerHost)
},
)
if err != nil {
diff --git a/backend/internal/system/children/upgrade/service.go b/backend/internal/system/children/upgrade/service.go
index c252fe2fd..8bcca59ea 100644
--- a/backend/internal/system/children/upgrade/service.go
+++ b/backend/internal/system/children/upgrade/service.go
@@ -24,6 +24,7 @@ import (
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
"github.com/opencontainers/go-digest"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
@@ -33,12 +34,11 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/environment"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
"github.com/getarcaneapp/arcane/backend/v2/internal/version"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
@@ -52,7 +52,7 @@ type Service struct {
upgrading atomic.Bool
updatingAll atomic.Bool
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
versionService *version.VersionService
eventService *event.EventService
settingsService *settings.SettingsService
@@ -69,7 +69,7 @@ type Service struct {
func NewService(
db *database.DB,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
versionService *version.VersionService,
eventService *event.EventService,
settingsService *settings.SettingsService,
@@ -254,7 +254,7 @@ func (s *Service) runPreparedUpgradeInternal(ctx context.Context, prepared *prep
return "", fmt.Errorf("pull upgrader image: %w", err)
}
// Drain and validate the JSON stream to complete the pull.
- if renderJSONMessageStreamErr := dockerutils.RenderJSONMessageStream(pullReader, io.Discard); renderJSONMessageStreamErr != nil {
+ if renderJSONMessageStreamErr := docker.RenderJSONMessageStream(pullReader, io.Discard); renderJSONMessageStreamErr != nil {
_ = pullReader.Close()
return "", fmt.Errorf("failed to complete upgrader image pull: %w", renderJSONMessageStreamErr)
}
@@ -264,7 +264,7 @@ func (s *Service) runPreparedUpgradeInternal(ctx context.Context, prepared *prep
slog.InfoContext(ctx, "Upgrader image pulled successfully", "image", upgraderImage)
// Try to get the /app/data mount from current container so upgrade logs persist.
- appDataMount := dockerutils.MountForDestination(prepared.current.Mounts, libarcane.UpgradeLogDirectory, libarcane.UpgradeLogDirectory)
+ appDataMount := docker.MountForDestination(prepared.current.Mounts, libarcane.UpgradeLogDirectory, libarcane.UpgradeLogDirectory)
if appDataMount == nil {
slog.WarnContext(ctx, "Could not detect /app/data mount; upgrader logs may not persist")
} else {
@@ -284,7 +284,7 @@ func (s *Service) runPreparedUpgradeInternal(ctx context.Context, prepared *prep
return currentContainerIDErr == nil
},
func(ctx context.Context, inspect *container.InspectResponse, dockerHost string) string {
- return dockerutils.SelectDockerHostReachableNetworkMode(ctx, dockerClient, inspect, dockerHost)
+ return docker.SelectDockerHostReachableNetworkMode(ctx, dockerClient, inspect, dockerHost)
},
)
if err != nil {
diff --git a/backend/internal/system/service.go b/backend/internal/system/service.go
index 223700dc9..a1f469a8f 100644
--- a/backend/internal/system/service.go
+++ b/backend/internal/system/service.go
@@ -23,6 +23,7 @@ import (
"github.com/moby/moby/client"
"github.com/samber/hot"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/sys/cgroup"
"go.getarcane.app/updater"
@@ -35,7 +36,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/container"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/imageupdate"
"github.com/getarcaneapp/arcane/backend/v2/internal/network"
@@ -46,7 +47,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/system/children/upgrade"
"github.com/getarcaneapp/arcane/backend/v2/internal/version"
"github.com/getarcaneapp/arcane/backend/v2/internal/volume"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/vuln"
"github.com/getarcaneapp/arcane/backend/v2/pkg/pagination"
"github.com/getarcaneapp/arcane/backend/v2/pkg/scheduler/runs"
@@ -57,7 +57,7 @@ import (
// and self-upgrade features.
type SystemService struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
containerService *container.ContainerService
settingsService *settings.SettingsService
activityService *activity.ActivityService
@@ -70,7 +70,7 @@ type SystemService struct {
func NewSystemService(
db *database.DB,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
containerService *container.ContainerService,
imageUpdateService *imageupdate.ImageUpdateService,
volumeService *volume.VolumeService,
@@ -435,7 +435,7 @@ func resolveUpgraderRuntimeOptionsInternal(
if scheme != "unix" {
// The upgrader must reach the tcp DOCKER_HOST, so prefer a network the
// daemon proxy is actually on over the plain auto heuristic (#3533).
- networkMode := dockerutils.SelectAutoNetworkMode(currentContainer)
+ networkMode := docker.SelectAutoNetworkMode(currentContainer)
if selectReachableNetwork != nil {
networkMode = selectReachableNetwork(ctx, currentContainer, dockerHost)
}
diff --git a/backend/internal/updater/service.go b/backend/internal/updater/service.go
index e850dd032..3f1c4e4d4 100644
--- a/backend/internal/updater/service.go
+++ b/backend/internal/updater/service.go
@@ -24,6 +24,7 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
@@ -38,7 +39,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/imageupdate"
@@ -49,7 +50,6 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
"github.com/getarcaneapp/arcane/backend/v2/internal/updater/children/execution"
"github.com/getarcaneapp/arcane/backend/v2/internal/updater/children/recovery"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
activitylib "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/activity"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
@@ -81,7 +81,7 @@ type UpdaterService struct {
type updaterDependenciesInternal struct {
DB *database.DB
- Docker *docker.DockerClientService
+ Docker *dockerInternal.DockerClientService
Settings *settings.SettingsService
Projects *projectpkg.ProjectService
ImagePuller *image.ImageService
@@ -105,7 +105,7 @@ type selfUpgradeServiceInternal interface {
func NewUpdaterService(
db *database.DB,
localSettings *settings.SettingsService,
- localDocker *docker.DockerClientService,
+ localDocker *dockerInternal.DockerClientService,
projectService *projectpkg.ProjectService,
imageUpdates *imageupdate.ImageUpdateService,
registries *registry.ContainerRegistryService,
@@ -432,10 +432,10 @@ func (s *UpdaterService) containerIDsForProjectsInternal(ctx context.Context, pr
var ids []string
for _, summary := range containers {
- if dockerutil.ComposeServiceLabel(summary.Labels) == "" {
+ if docker.ComposeServiceLabel(summary.Labels) == "" {
continue
}
- project := strings.ToLower(strings.TrimSpace(dockerutil.ComposeProjectLabel(summary.Labels)))
+ project := strings.ToLower(strings.TrimSpace(docker.ComposeProjectLabel(summary.Labels)))
if project == "" {
continue
}
@@ -1390,7 +1390,7 @@ func (s *UpdaterService) collectUsedImagesFromContainersInternal(ctx context.Con
continue
}
- if dockerutil.ContainerNameExcluded(summary.Names, excludedContainers) {
+ if docker.ContainerNameExcluded(summary.Names, excludedContainers) {
s.loggerInternal().DebugContext(ctx, "collectUsedImagesFromContainers: skipping excluded container", "containerId", summary.ID, "names", summary.Names)
continue
}
@@ -1420,7 +1420,7 @@ func (s *UpdaterService) collectUsedImagesFromContainersInternal(ctx context.Con
func (s *UpdaterService) collectUsedImagesFromComposeContainersInternal(ctx context.Context, composeContainers []container.Summary, activeProjectNames, out map[string]struct{}) {
for _, summary := range composeContainers {
- projectName := dockerutil.ComposeProjectLabel(summary.Labels)
+ projectName := docker.ComposeProjectLabel(summary.Labels)
if projectName == "" {
continue
}
@@ -1465,7 +1465,7 @@ func (s *UpdaterService) buildExcludedContainerSetInternal(ctx context.Context)
if s.deps.Settings == nil {
return nil
}
- return dockerutil.ExcludedContainerNameSet(s.deps.Settings.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
+ return docker.ExcludedContainerNameSet(s.deps.Settings.GetStringSetting(ctx, "autoUpdateExcludedContainers", ""))
}
func (s *UpdaterService) collectUsedImagesFromProjectsInternal(ctx context.Context, out map[string]struct{}) error {
diff --git a/backend/internal/volume/children/backup/helpers.go b/backend/internal/volume/children/backup/helpers.go
index 66ba1d9e9..1fbb97a39 100644
--- a/backend/internal/volume/children/backup/helpers.go
+++ b/backend/internal/volume/children/backup/helpers.go
@@ -16,10 +16,10 @@ import (
"github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"github.com/getarcaneapp/arcane/backend/v2/internal/backup"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
"github.com/getarcaneapp/arcane/backend/v2/pkg/projects"
diff --git a/backend/internal/volume/children/workspace/service.go b/backend/internal/volume/children/workspace/service.go
index f3971a5e7..063051788 100644
--- a/backend/internal/volume/children/workspace/service.go
+++ b/backend/internal/volume/children/workspace/service.go
@@ -29,14 +29,14 @@ import (
"github.com/moby/moby/client"
"go.getarcane.app/acfs"
"go.getarcane.app/acfs/types"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
"github.com/getarcaneapp/arcane/backend/v2/internal/common"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
@@ -46,7 +46,7 @@ import (
// Dependencies are the helper-container, lock, and backup operations the workspace runs through.
type Dependencies struct {
- Docker *docker.DockerClientService
+ Docker *dockerInternal.DockerClientService
Events *event.EventService
Locks *utils.KeyedMutex
AcquireHelper func(ctx context.Context, volumeName string) (string, func(), error)
@@ -151,7 +151,7 @@ func (s *Service) readVolumeWorkspaceFromContainerInternal(ctx context.Context,
"acfs", "walk", "--root", "/volume", "--path", "/",
"--max-depth", strconv.Itoa(maxDepth), "--max-entries", strconv.Itoa(maxEntries),
}
- exitCode, execErr := dockerutil.ExecInContainer(workCtx, dockerClient, containerID, client.ExecCreateOptions{
+ exitCode, execErr := docker.ExecInContainer(workCtx, dockerClient, containerID, client.ExecCreateOptions{
AttachStdout: true,
AttachStderr: true,
Cmd: cmd,
@@ -352,7 +352,7 @@ func (s *Service) startVolumeWorkspaceReadInternal(ctx context.Context, containe
}
go func() {
var stderr bytes.Buffer
- exitCode, execErr := dockerutil.ExecInContainer(workCtx, dockerClient, containerID, client.ExecCreateOptions{
+ exitCode, execErr := docker.ExecInContainer(workCtx, dockerClient, containerID, client.ExecCreateOptions{
AttachStdout: true,
AttachStderr: true,
Cmd: cmd,
@@ -407,7 +407,10 @@ func (s *Service) validateVolumeHelperSupportInternal(ctx context.Context, volum
if err != nil {
return fmt.Errorf("failed to inspect volume: %w", err)
}
- return dockerutil.ValidateVolumeWorkspaceHelperSupport(volumeName, result.Volume.Options)
+ if options := result.Volume.Options; options["type"] == "none" || strings.Contains(options["o"], "bind") {
+ return fmt.Errorf("volume %q uses a custom mount configuration and cannot be accessed through the workspace helper", volumeName)
+ }
+ return nil
}
func (s *Service) validateVolumeWorkspacePathInternal(ctx context.Context, containerID, relativePath string, allowMissing bool) error {
@@ -659,7 +662,7 @@ func volumeWorkspaceWriteIdentityFromConfigUserInternal(configUser string) volum
}
func (s *Service) resolveVolumeWorkspaceWriteIdentityInternal(ctx context.Context, dockerClient *client.Client, containerID, volumeName string) volumeWorkspaceWriteIdentityInternal {
- consumerIDs, err := dockerutil.GetContainersUsingVolume(ctx, dockerClient, volumeName)
+ consumerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, volumeName)
if err != nil {
slog.WarnContext(ctx, "could not list containers for volume workspace write identity", "volume", volumeName, "error", err.Error())
}
diff --git a/backend/internal/volume/children/workspace/service_test.go b/backend/internal/volume/children/workspace/service_test.go
index 08759e155..d23b048a3 100644
--- a/backend/internal/volume/children/workspace/service_test.go
+++ b/backend/internal/volume/children/workspace/service_test.go
@@ -43,8 +43,9 @@ func newVolumeWorkspaceTestDockerClientInternal(t *testing.T, server *httptest.S
return dockerClient
}
-func TestValidateVolumeHelperSupportInternalOnlyInspectsVolume(t *testing.T) {
+func TestValidateVolumeHelperSupportInternal(t *testing.T) {
var requests []string
+ var options map[string]string
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requests = append(requests, r.Method+" "+r.URL.Path)
if r.Method != http.MethodGet || !strings.HasSuffix(r.URL.Path, "/volumes/workspace-volume") {
@@ -52,7 +53,7 @@ func TestValidateVolumeHelperSupportInternalOnlyInspectsVolume(t *testing.T) {
return
}
w.Header().Set("Content-Type", "application/json")
- if err := json.NewEncoder(w).Encode(volume.Volume{Name: "workspace-volume", Driver: "local"}); err != nil {
+ if err := json.NewEncoder(w).Encode(volume.Volume{Name: "workspace-volume", Driver: "local", Options: options}); err != nil {
t.Errorf("encode volume inspect response: %v", err)
}
}))
@@ -63,6 +64,13 @@ func TestValidateVolumeHelperSupportInternalOnlyInspectsVolume(t *testing.T) {
require.NoError(t, service.validateVolumeHelperSupportInternal(t.Context(), "workspace-volume"))
require.Equal(t, []string{"GET /v1.41/volumes/workspace-volume"}, requests)
+
+ options = map[string]string{"type": "nfs"}
+ require.NoError(t, service.validateVolumeHelperSupportInternal(t.Context(), "workspace-volume"))
+ options = map[string]string{"type": "none"}
+ require.Error(t, service.validateVolumeHelperSupportInternal(t.Context(), "workspace-volume"))
+ options = map[string]string{"o": "bind,rw"}
+ require.Error(t, service.validateVolumeHelperSupportInternal(t.Context(), "workspace-volume"))
}
func TestUpdateVolumeWorkspaceValidationFailureReturnsNoWorkspace(t *testing.T) {
diff --git a/backend/internal/volume/helpers.go b/backend/internal/volume/helpers.go
index 4d45586f9..b6b77dea1 100644
--- a/backend/internal/volume/helpers.go
+++ b/backend/internal/volume/helpers.go
@@ -18,10 +18,10 @@ import (
"github.com/moby/moby/client"
"github.com/samber/mo"
"go.getarcane.app/acfs/types"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
"go.getarcane.app/kit/pkg"
- "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
diff --git a/backend/internal/volume/service.go b/backend/internal/volume/service.go
index 800674b8e..096467dfd 100644
--- a/backend/internal/volume/service.go
+++ b/backend/internal/volume/service.go
@@ -21,6 +21,7 @@ import (
"github.com/moby/moby/api/types/volume"
"github.com/moby/moby/client"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"golang.org/x/sync/singleflight"
"gorm.io/gorm"
@@ -31,14 +32,13 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
containerdomain "github.com/getarcaneapp/arcane/backend/v2/internal/container"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/image"
"github.com/getarcaneapp/arcane/backend/v2/internal/s3"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
volumebackup "github.com/getarcaneapp/arcane/backend/v2/internal/volume/children/backup"
"github.com/getarcaneapp/arcane/backend/v2/internal/volume/children/workspace"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumes"
@@ -50,7 +50,7 @@ import (
type VolumeService struct {
db *database.DB
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
eventService *event.EventService
settingsService *settings.SettingsService
imageService *image.ImageService
@@ -73,7 +73,7 @@ const internalVolumePruneFilterValue = libarcane.InternalResourceLabel + "=true"
func NewVolumeService(
db *database.DB,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
eventService *event.EventService,
activityService *activity.ActivityService,
settingsService *settings.SettingsService,
@@ -370,7 +370,7 @@ func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volu
localSettings := s.settingsService.GetSettingsConfig()
usageCtx, usageCancel := context.WithTimeout(ctx, timeouts.GetDuration(localSettings.DockerAPITimeout.AsInt(), timeouts.DefaultDockerAPI))
defer usageCancel()
- if usageVolumes, ok := dockerutil.GetVolumeUsageDataStaleWhileRevalidate(usageCtx, dockerClient).Get(); ok {
+ if usageVolumes, ok := docker.GetVolumeUsageDataStaleWhileRevalidate(usageCtx, dockerClient).Get(); ok {
for _, uv := range usageVolumes {
if uv.Name == vol.Name && uv.UsageData != nil {
vol.UsageData = uv.UsageData
@@ -382,7 +382,7 @@ func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volu
v := volumetypes.NewSummary(vol)
- containerIDs, err := dockerutil.GetContainersUsingVolume(ctx, dockerClient, name)
+ containerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, name)
if err != nil {
slog.WarnContext(ctx, "failed to get containers using volume", "volume", name, "error", err.Error())
} else {
@@ -441,7 +441,7 @@ func (s *VolumeService) CreateVolume(ctx context.Context, options client.VolumeC
slog.WarnContext(ctx, "could not log volume creation action", "volume", vol.Volume.Name, "error", logErr.Error())
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
return new(volumetypes.NewSummary(vol.Volume)), nil
}
@@ -478,7 +478,7 @@ func (s *VolumeService) DeleteVolume(ctx context.Context, name string, force boo
s.removeHelperEntry(name)
s.backup.RemovePolicies(ctx, name)
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
return nil
}
@@ -518,7 +518,7 @@ func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (
s.backup.RemovePolicies(ctx, volumeName)
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
return &volumetypes.PruneReport{
VolumesDeleted: volumePruneResult.Report.VolumesDeleted,
@@ -554,7 +554,7 @@ func (s *VolumeService) GetVolumeUsage(ctx context.Context, name string) (bool,
return false, nil, fmt.Errorf("volume not found: %w", err)
}
- containerIDs, err := dockerutil.GetContainersUsingVolume(ctx, dockerClient, vol.Volume.Name)
+ containerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, vol.Volume.Name)
if err != nil {
return false, nil, fmt.Errorf("failed to get containers using volume: %w", err)
}
@@ -582,7 +582,7 @@ func (s *VolumeService) GetVolumeSizes(ctx context.Context) (map[string]VolumeSi
return nil, fmt.Errorf("failed to connect to Docker: %w", err)
}
- usageVolumes, err := dockerutil.GetVolumeUsageData(apiCtx, dockerClient)
+ usageVolumes, err := docker.GetVolumeUsageData(apiCtx, dockerClient)
if err != nil {
return nil, fmt.Errorf("failed to get volume usage data: %w", err)
}
@@ -928,7 +928,7 @@ func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params paginat
// background so this list request never waits for Docker's DiskUsage call.
var usageVolumes []volume.Volume
if params.Sort == "size" {
- if uv, found := dockerutil.GetVolumeUsageDataStaleWhileRevalidate(apiCtx, dockerClient).Get(); found && (len(uv) > 0 || len(volResult.volumes) == 0) {
+ if uv, found := docker.GetVolumeUsageDataStaleWhileRevalidate(apiCtx, dockerClient).Get(); found && (len(uv) > 0 || len(volResult.volumes) == 0) {
usageVolumes = uv
usageCacheSnapshot = "available"
} else {
@@ -1056,7 +1056,7 @@ func (s *VolumeService) RenameVolume(ctx context.Context, oldName, newName strin
}
s.removeHelperEntry(oldName)
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
renamed, err := s.GetVolumeByName(ctx, newName)
if err != nil {
diff --git a/backend/internal/vulnerability/children/scan/children/trivy/service.go b/backend/internal/vulnerability/children/scan/children/trivy/service.go
index 1bf4edfcd..6436e27a2 100644
--- a/backend/internal/vulnerability/children/scan/children/trivy/service.go
+++ b/backend/internal/vulnerability/children/scan/children/trivy/service.go
@@ -20,14 +20,14 @@ import (
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/client"
"github.com/samber/mo"
+ "go.getarcane.app/docker"
"go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/kv"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
@@ -49,7 +49,7 @@ const (
// Service runs Trivy scanner containers with bounded, per-image-locked scan slots.
type Service struct {
config *config.Config
- dockerService *docker.DockerClientService
+ dockerService *dockerInternal.DockerClientService
settingsService *settings.SettingsService
kvService *kv.KVService
registryAuthConfigs func(ctx context.Context) (map[string]registry.AuthConfig, error)
@@ -66,7 +66,7 @@ type Service struct {
func NewService(
cfg *config.Config,
- dockerService *docker.DockerClientService,
+ dockerService *dockerInternal.DockerClientService,
settingsService *settings.SettingsService,
kvService *kv.KVService,
registryAuthConfigs func(ctx context.Context) (map[string]registry.AuthConfig, error),
@@ -341,7 +341,7 @@ func (
}
execCmd := append([]string{"trivy"}, s.buildTrivyCommandArgs(imageName, cacheDir, outputPath, files)...)
- exitCode, err := dockerutil.ExecInContainer(ctx, dockerClient, containerID, client.ExecCreateOptions{
+ exitCode, err := docker.ExecInContainer(ctx, dockerClient, containerID, client.ExecCreateOptions{
Cmd: execCmd,
Env: vuln.ServerTokenEnv(serverToken),
AttachStdout: true,
@@ -508,7 +508,7 @@ func (s *Service) Version(ctx context.Context) string {
var closeLogsOnce sync.Once
closeLogs := func() {
closeLogsOnce.Do(func() {
- if closeErr := logs.Close(); closeErr != nil && !dockerutil.IsExpectedStreamEndError(closeErr) {
+ if closeErr := logs.Close(); closeErr != nil && !docker.IsExpectedStreamEndError(closeErr) {
slog.WarnContext(ctx, "failed to close trivy version logs stream", "error", closeErr)
}
})
@@ -527,7 +527,7 @@ func (s *Service) Version(ctx context.Context) string {
}
defer vuln.CleanupLogTempFiles(ctx, stdoutFile, stderrFile)
- logDone := dockerutil.StartStdCopy(logs, stdoutFile, stderrFile)
+ logDone := docker.StartStdCopy(logs, stdoutFile, stderrFile)
waitResult := dockerClient.ContainerWait(ctx, resp.ID, client.ContainerWaitOptions{Condition: container.WaitConditionNotRunning})
var waitResp container.WaitResponse
@@ -541,7 +541,7 @@ func (s *Service) Version(ctx context.Context) string {
closeLogs()
- if waitStdCopyErr := dockerutil.WaitStdCopy(logDone); waitStdCopyErr != nil {
+ if waitStdCopyErr := docker.WaitStdCopy(logDone); waitStdCopyErr != nil {
return ""
}
@@ -605,7 +605,7 @@ func (s *Service) resolveTrivyNetworkModeInternal(ctx context.Context, dockerCli
inspect, err := libarcane.InspectCurrentArcaneContainer(ctx, dockerClient)
if err == nil {
- return dockerutil.SelectAutoNetworkMode(inspect)
+ return docker.SelectAutoNetworkMode(inspect)
}
slog.DebugContext(ctx, "failed to auto-detect Trivy network; falling back to bridge", "error", err)
@@ -717,7 +717,7 @@ func (s *Service) EnsureImage(ctx context.Context) (string, error) {
}
return "", fmt.Errorf("pull scanner image %s: %w", scannerImage, err)
}
- if renderJSONMessageStreamErr := dockerutil.RenderJSONMessageStream(pullReader, io.Discard); renderJSONMessageStreamErr != nil {
+ if renderJSONMessageStreamErr := docker.RenderJSONMessageStream(pullReader, io.Discard); renderJSONMessageStreamErr != nil {
_ = pullReader.Close()
return "", fmt.Errorf("failed to complete scanner image pull: %w", renderJSONMessageStreamErr)
}
@@ -1028,14 +1028,14 @@ func (s *Service) runTrivyContainerInternal(
closeLogs := func() {
closeLogsOnce.Do(func() {
logsCancel()
- if closeErr := logs.Close(); closeErr != nil && !dockerutil.IsExpectedStreamEndError(closeErr) {
+ if closeErr := logs.Close(); closeErr != nil && !docker.IsExpectedStreamEndError(closeErr) {
slog.WarnContext(ctx, "failed to close trivy scan logs stream", "error", closeErr)
}
})
}
defer closeLogs()
- logDone := dockerutil.StartStdCopy(logs, stdoutFile, stderrFile)
+ logDone := docker.StartStdCopy(logs, stdoutFile, stderrFile)
startTime := time.Now()
waitTimeout := vuln.ContainerWaitTimeout(s.getTrivyScanTimeoutArg())
@@ -1045,7 +1045,7 @@ func (s *Service) runTrivyContainerInternal(
statusCode, err := s.waitForTrivyContainer(waitCtx, dockerClient, containerID)
if err != nil {
closeLogs()
- if logErr := dockerutil.WaitStdCopy(logDone); logErr != nil {
+ if logErr := docker.WaitStdCopy(logDone); logErr != nil {
slog.DebugContext(ctx, "trivy log stream ended with error while handling wait failure", "error", logErr)
}
return trivyContainerResultInternal{}, err
@@ -1067,14 +1067,14 @@ func (s *Service) runTrivyContainerInternal(
select {
case logErr := <-logDone:
closeLogs() // clean up context / connection
- if logErr != nil && !dockerutil.IsExpectedStreamEndError(logErr) {
+ if logErr != nil && !docker.IsExpectedStreamEndError(logErr) {
return trivyContainerResultInternal{}, fmt.Errorf("failed to read trivy logs: %w", logErr)
}
case <-logDrainTimer.C:
// Stream did not close on its own; force-close so the goroutine exits.
slog.DebugContext(ctx, "trivy log stream did not close after container exit; force-closing", "containerId", containerID)
closeLogs()
- if logErr := dockerutil.WaitStdCopy(logDone); logErr != nil {
+ if logErr := docker.WaitStdCopy(logDone); logErr != nil {
return trivyContainerResultInternal{}, fmt.Errorf("failed to read trivy logs: %w", logErr)
}
}
diff --git a/backend/pkg/dockerutil/compose_labels.go b/backend/pkg/dockerutil/compose_labels.go
deleted file mode 100644
index 92b1c0796..000000000
--- a/backend/pkg/dockerutil/compose_labels.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package docker
-
-import "strings"
-
-// Docker Compose attaches these labels to every container it manages. They
-// identify the owning project and the service within that project.
-const (
- ComposeProjectLabelKey = "com.docker.compose.project"
- ComposeServiceLabelKey = "com.docker.compose.service"
-)
-
-// ComposeProjectLabel returns the trimmed Docker Compose project name from a
-// container's labels, or "" when unset.
-func ComposeProjectLabel(labels map[string]string) string {
- return strings.TrimSpace(labels[ComposeProjectLabelKey])
-}
-
-// ComposeServiceLabel returns the trimmed Docker Compose service name from a
-// container's labels, or "" when unset.
-func ComposeServiceLabel(labels map[string]string) string {
- return strings.TrimSpace(labels[ComposeServiceLabelKey])
-}
diff --git a/backend/pkg/dockerutil/compose_labels_test.go b/backend/pkg/dockerutil/compose_labels_test.go
deleted file mode 100644
index 0ae08727e..000000000
--- a/backend/pkg/dockerutil/compose_labels_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package docker
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestComposeLabels(t *testing.T) {
- labels := map[string]string{
- ComposeProjectLabelKey: " myproj ",
- ComposeServiceLabelKey: "web",
- }
- {
-
- got := ComposeProjectLabel(labels)
- assert.Equal(t, "myproj", got,
- "ComposeProjectLabel() = %q, want %q", got, "myproj")
- }
- {
-
- got := ComposeServiceLabel(labels)
- assert.Equal(t, "web", got,
- "ComposeServiceLabel() = %q, want %q", got, "web")
- }
- {
-
- got := ComposeProjectLabel(nil)
- assert.Empty(t, got,
- "ComposeProjectLabel(nil) = %q, want %q", got, "")
- }
- {
-
- got := ComposeServiceLabel(map[string]string{})
- assert.Empty(t, got,
- "ComposeServiceLabel(empty) = %q, want %q", got, "")
- }
-}
diff --git a/backend/pkg/dockerutil/container_names.go b/backend/pkg/dockerutil/container_names.go
deleted file mode 100644
index f6aab1cb9..000000000
--- a/backend/pkg/dockerutil/container_names.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package docker
-
-import (
- "strings"
-
- kit "go.getarcane.app/kit/pkg"
-)
-
-// ContainerNameFromNames returns Docker's first container name without the
-// leading slash Docker stores in container summaries.
-func ContainerNameFromNames(names []string) string {
- if len(names) == 0 {
- return ""
- }
-
- return strings.TrimPrefix(names[0], "/")
-}
-
-// ExcludedContainerNameSet parses a comma-separated exclusion setting into a
-// name lookup. Returns nil when the setting names no containers.
-func ExcludedContainerNameSet(raw string) map[string]bool {
- names := kit.Unique(kit.TrimNonEmpty(strings.Split(raw, ",")))
- if len(names) == 0 {
- return nil
- }
- excluded := make(map[string]bool, len(names))
- for _, name := range names {
- excluded[name] = true
- }
- return excluded
-}
-
-// ContainerNameExcluded reports whether any of Docker's container names,
-// stripped of the leading slash, appears in the exclusion lookup.
-func ContainerNameExcluded(names []string, excluded map[string]bool) bool {
- if len(excluded) == 0 {
- return false
- }
- for _, name := range names {
- if excluded[strings.TrimPrefix(name, "/")] {
- return true
- }
- }
- return false
-}
diff --git a/backend/pkg/dockerutil/container_names_test.go b/backend/pkg/dockerutil/container_names_test.go
deleted file mode 100644
index a235ec618..000000000
--- a/backend/pkg/dockerutil/container_names_test.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package docker
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestContainerNameFromNames(t *testing.T) {
- tests := []struct {
- name string
- names []string
- want string
- }{
- {
- name: "single name with slash",
- names: []string{"/myapp"},
- want: "myapp",
- },
- {
- name: "single name without slash",
- names: []string{"myapp"},
- want: "myapp",
- },
- {
- name: "multiple names uses first",
- names: []string{"/myapp", "/myapp-alias"},
- want: "myapp",
- },
- {
- name: "no names",
- names: []string{},
- want: "",
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- {
- got := ContainerNameFromNames(tt.names)
- assert.Equal(t, tt.want, got,
- "ContainerNameFromNames() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestExcludedContainerNames(t *testing.T) {
- assert.Nil(t, ExcludedContainerNameSet(" , "))
-
- excluded := ExcludedContainerNameSet(" app ,db,,app")
- assert.Equal(t, map[string]bool{"app": true, "db": true}, excluded)
- assert.True(t, ContainerNameExcluded([]string{"/other", "/db"}, excluded))
- assert.False(t, ContainerNameExcluded([]string{"/other"}, excluded))
- assert.False(t, ContainerNameExcluded([]string{"/app"}, nil))
-}
diff --git a/backend/pkg/dockerutil/exec.go b/backend/pkg/dockerutil/exec.go
deleted file mode 100644
index 50e525a52..000000000
--- a/backend/pkg/dockerutil/exec.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package docker
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "net"
- "strings"
-
- "github.com/moby/moby/api/pkg/stdcopy"
- "github.com/moby/moby/client"
- kit "go.getarcane.app/kit/pkg"
-)
-
-// IsExpectedStreamEndError reports whether err is the ordinary way a Docker
-// attach/log stream ends rather than a real failure.
-func IsExpectedStreamEndError(err error) bool {
- if err == nil {
- return false
- }
-
- if errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed) || errors.Is(err, context.Canceled) {
- return true
- }
-
- errMsg := strings.ToLower(err.Error())
- return strings.Contains(errMsg, "use of closed network connection") ||
- strings.Contains(errMsg, "context canceled") ||
- strings.Contains(errMsg, "broken pipe") ||
- strings.Contains(errMsg, "connection reset by peer")
-}
-
-// StartStdCopy demultiplexes a Docker stream into stdout/stderr on a goroutine
-// and reports the copy result on the returned channel. Pair with WaitStdCopy.
-func StartStdCopy(stream io.Reader, stdout, stderr io.Writer) <-chan error {
- done := make(chan error, 1)
- go func() {
- _, err := stdcopy.StdCopy(stdout, stderr, stream)
- done <- err
- }()
- return done
-}
-
-// WaitStdCopy waits for a StartStdCopy goroutine, treating an ordinary stream
-// end as success.
-func WaitStdCopy(done <-chan error) error {
- err := <-done
- return kit.Ternary(err == nil || IsExpectedStreamEndError(err), nil, err)
-}
-
-// ExecInContainer runs an exec in containerID, demultiplexing its output into
-// stdout and stderr, and returns the exec's exit code. A non-zero exit code is
-// not an error — callers decide how to report it.
-func ExecInContainer(ctx context.Context, dockerClient *client.Client, containerID string, opts client.ExecCreateOptions, stdout, stderr io.Writer) (int, error) {
- execResp, err := dockerClient.ExecCreate(ctx, containerID, opts)
- if err != nil {
- return 0, fmt.Errorf("failed to create exec: %w", err)
- }
-
- attachResp, err := dockerClient.ExecAttach(ctx, execResp.ID, client.ExecAttachOptions{})
- if err != nil {
- return 0, fmt.Errorf("failed to attach to exec: %w", err)
- }
- defer attachResp.Close()
- stopClose := context.AfterFunc(ctx, attachResp.Close)
- defer stopClose()
-
- copyErr := WaitStdCopy(StartStdCopy(attachResp.Reader, stdout, stderr))
- if errErr := ctx.Err(); errErr != nil {
- return 0, fmt.Errorf("failed to read exec output: %w", errErr)
- }
- if copyErr != nil {
- return 0, fmt.Errorf("failed to read exec output: %w", copyErr)
- }
-
- inspect, err := dockerClient.ExecInspect(ctx, execResp.ID, client.ExecInspectOptions{})
- if err != nil {
- return 0, fmt.Errorf("failed to inspect exec: %w", err)
- }
-
- return inspect.ExitCode, nil
-}
diff --git a/backend/pkg/dockerutil/exec_test.go b/backend/pkg/dockerutil/exec_test.go
deleted file mode 100644
index 77e937f49..000000000
--- a/backend/pkg/dockerutil/exec_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package docker
-
-import (
- "errors"
- "fmt"
- "io"
- "net"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestIsExpectedStreamEndError(t *testing.T) {
- tests := []struct {
- name string
- err error
- want bool
- }{
- {name: "nil", err: nil, want: false},
- {name: "eof", err: io.EOF, want: true},
- {name: "wrapped eof", err: fmt.Errorf("wrapped: %w", io.EOF), want: true},
- {name: "net err closed", err: net.ErrClosed, want: true},
- {name: "closed network connection", err: errors.New("read tcp 127.0.0.1:1234->127.0.0.1:5678: use of closed network connection"), want: true},
- {name: "broken pipe", err: errors.New("write: broken pipe"), want: true},
- {name: "connection reset by peer", err: errors.New("read: connection reset by peer"), want: true},
- {name: "unexpected", err: errors.New("some other error"), want: false},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- require.Equal(t, tt.want, IsExpectedStreamEndError(tt.err))
- })
- }
-}
diff --git a/backend/pkg/dockerutil/log_stream.go b/backend/pkg/dockerutil/log_stream.go
deleted file mode 100644
index a8c4c2fee..000000000
--- a/backend/pkg/dockerutil/log_stream.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package docker
-
-import (
- "bufio"
- "context"
- "errors"
- "fmt"
- "io"
- "log/slog"
- "strings"
- "sync"
-
- "github.com/moby/moby/api/pkg/stdcopy"
- kit "go.getarcane.app/kit/pkg"
-)
-
-// StreamContainerLogs streams Docker container logs, handling TTY raw streams
-// and non-TTY multiplexed stdout/stderr streams.
-func StreamContainerLogs(ctx context.Context, logs io.ReadCloser, logsChan chan<- string, follow, isTTY bool) error {
- if isTTY {
- return readLogLinesInternal(ctx, logs, logsChan, "")
- }
- if follow {
- return StreamMultiplexedLogs(ctx, logs, logsChan)
- }
- return ReadAllLogs(ctx, logs, logsChan)
-}
-
-// StreamMultiplexedLogs demultiplexes a Docker stdout/stderr log stream and
-// sends non-empty lines to logsChan.
-func StreamMultiplexedLogs(ctx context.Context, logs io.Reader, logsChan chan<- string) error {
- stdoutReader, stdoutWriter := io.Pipe()
- stderrReader, stderrWriter := io.Pipe()
-
- var closeOnce sync.Once
- closeInputs := func() {
- closeOnce.Do(func() {
- err := ctx.Err()
- if err == nil {
- err = io.ErrClosedPipe
- }
- _ = stdoutReader.CloseWithError(err)
- _ = stderrReader.CloseWithError(err)
- if closer, ok := logs.(io.Closer); ok {
- _ = closer.Close()
- }
- })
- }
-
- copyDone := make(chan struct{})
- go func() {
- defer close(copyDone)
- defer func() { _ = stdoutWriter.Close() }()
- defer func() { _ = stderrWriter.Close() }()
- _, err := stdcopy.StdCopy(stdoutWriter, stderrWriter, logs)
- if err != nil && !errors.Is(err, io.EOF) && ctx.Err() == nil {
- slog.ErrorContext(ctx, "error demultiplexing logs", "error", err)
- }
- }()
-
- go func() {
- select {
- case <-ctx.Done():
- closeInputs()
- case <-copyDone:
- }
- }()
-
- done := make(chan error, 2)
-
- go func() {
- done <- readLogLinesInternal(ctx, stdoutReader, logsChan, "")
- }()
-
- go func() {
- done <- readLogLinesInternal(ctx, stderrReader, logsChan, "[STDERR] ")
- }()
-
- select {
- case <-ctx.Done():
- closeInputs()
- return ctx.Err()
- case err := <-done:
- if err != nil && !errors.Is(err, io.EOF) {
- closeInputs()
- return err
- }
- select {
- case <-ctx.Done():
- closeInputs()
- return ctx.Err()
- case <-done:
- return nil
- }
- }
-}
-
-// ReadAllLogs reads a non-follow Docker multiplexed log stream and sends
-// non-empty stdout/stderr lines to logsChan.
-func ReadAllLogs(ctx context.Context, logs io.ReadCloser, logsChan chan<- string) error {
- stdoutBuf := &strings.Builder{}
- stderrBuf := &strings.Builder{}
- stdCopyDone := make(chan struct{})
- defer close(stdCopyDone)
-
- go func() {
- select {
- case <-ctx.Done():
- _ = logs.Close()
- case <-stdCopyDone:
- }
- }()
-
- _, err := stdcopy.StdCopy(stdoutBuf, stderrBuf, logs)
- if err != nil && !errors.Is(err, io.EOF) {
- if ctxErr := ctx.Err(); ctxErr != nil {
- return ctxErr
- }
- return fmt.Errorf("failed to demultiplex logs: %w", err)
- }
- if ctxErr := ctx.Err(); ctxErr != nil {
- return ctxErr
- }
-
- if stdoutBuf.Len() > 0 {
- if readLogLinesErr := readLogLinesInternal(ctx, strings.NewReader(stdoutBuf.String()), logsChan, ""); readLogLinesErr != nil {
- return readLogLinesErr
- }
- }
-
- if stderrBuf.Len() > 0 {
- if readLogLinesErr2 := readLogLinesInternal(ctx, strings.NewReader(stderrBuf.String()), logsChan, "[STDERR] "); readLogLinesErr2 != nil {
- return readLogLinesErr2
- }
- }
-
- return nil
-}
-
-func readLogLinesInternal(ctx context.Context, reader io.Reader, logsChan chan<- string, prefix string) error {
- bufferedReader := bufio.NewReader(reader)
-
- for {
- if err := ctx.Err(); err != nil {
- return err
- }
-
- line, err := bufferedReader.ReadString('\n')
- if line != "" {
- trimmed := strings.TrimRight(line, "\r\n")
- if trimmed != "" {
- if prefix != "" {
- trimmed = prefix + trimmed
- }
-
- select {
- case logsChan <- trimmed:
- case <-ctx.Done():
- return ctx.Err()
- }
- }
- }
-
- if err != nil {
- return kit.Ternary(errors.Is(err, io.EOF), nil, err)
- }
- }
-}
diff --git a/backend/pkg/dockerutil/log_stream_test.go b/backend/pkg/dockerutil/log_stream_test.go
deleted file mode 100644
index fd7837e2c..000000000
--- a/backend/pkg/dockerutil/log_stream_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package docker
-
-import (
- "bytes"
- "context"
- "encoding/binary"
- "io"
- "strings"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestStreamContainerLogsNonTTYFollowDemultiplexesStdoutAndStderr(t *testing.T) {
- var stream bytes.Buffer
- writeDockerLogFrameInternal(t, &stream, 1, "stdout line\n")
- writeDockerLogFrameInternal(t, &stream, 2, "stderr line\n")
-
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(t.Context(), io.NopCloser(bytes.NewReader(stream.Bytes())), logsChan, true, false)
- require.NoError(t, err)
-
- require.ElementsMatch(t, []string{"stdout line", "[STDERR] stderr line"}, drainLogLinesInternal(logsChan))
-}
-
-func TestStreamContainerLogsTTYFollowStreamsRawOutput(t *testing.T) {
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(t.Context(), io.NopCloser(strings.NewReader("first line\nsecond line")), logsChan, true, true)
- require.NoError(t, err)
-
- require.Equal(t, []string{"first line", "second line"}, drainLogLinesInternal(logsChan))
-}
-
-func TestStreamContainerLogsNonTTYSnapshotDemultiplexesStdoutAndStderr(t *testing.T) {
- var stream bytes.Buffer
- writeDockerLogFrameInternal(t, &stream, 1, "stdout snapshot\n")
- writeDockerLogFrameInternal(t, &stream, 2, "stderr snapshot\n")
-
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(t.Context(), io.NopCloser(bytes.NewReader(stream.Bytes())), logsChan, false, false)
- require.NoError(t, err)
-
- require.Equal(t, []string{"stdout snapshot", "[STDERR] stderr snapshot"}, drainLogLinesInternal(logsChan))
-}
-
-func TestStreamContainerLogsTTYSnapshotStreamsRawOutput(t *testing.T) {
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(t.Context(), io.NopCloser(strings.NewReader("snapshot line\ntrailing line")), logsChan, false, true)
- require.NoError(t, err)
-
- require.Equal(t, []string{"snapshot line", "trailing line"}, drainLogLinesInternal(logsChan))
-}
-
-func TestStreamContainerLogsTTYHandlesLongLinesAndPartialEOF(t *testing.T) {
- longLine := strings.Repeat("a", 70*1024)
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(t.Context(), io.NopCloser(strings.NewReader(longLine+"\npartial tail")), logsChan, true, true)
- require.NoError(t, err)
-
- require.Equal(t, []string{longLine, "partial tail"}, drainLogLinesInternal(logsChan))
-}
-
-func TestStreamContainerLogsTTYPythonLikeFollowDoesNotReturnEmptyLogs(t *testing.T) {
- logsChan := make(chan string, 4)
-
- err := StreamContainerLogs(
- t.Context(),
- io.NopCloser(strings.NewReader("2026-03-22 10:15:00 - INFO - Starting miner\n2026-03-22 10:15:01 - INFO - Connected")),
- logsChan,
- true,
- true,
- )
- require.NoError(t, err)
-
- lines := drainLogLinesInternal(logsChan)
- require.NotEmpty(t, lines)
- require.Equal(t, []string{
- "2026-03-22 10:15:00 - INFO - Starting miner",
- "2026-03-22 10:15:01 - INFO - Connected",
- }, lines)
-}
-
-func TestStreamMultiplexedLogsContextCancelDoesNotDeadlock(t *testing.T) {
- var stream bytes.Buffer
- writeDockerLogFrameInternal(t, &stream, 1, "line 1\n")
- writeDockerLogFrameInternal(t, &stream, 1, "line 2\n")
- writeDockerLogFrameInternal(t, &stream, 1, "line 3\n")
-
- logsChan := make(chan string, 1)
- ctx, cancel := context.WithCancel(t.Context())
- defer cancel()
-
- done := make(chan error, 1)
- go func() {
- done <- StreamMultiplexedLogs(ctx, bytes.NewReader(stream.Bytes()), logsChan)
- }()
-
- require.Eventually(t, func() bool {
- return len(logsChan) == 1
- }, time.Second, 10*time.Millisecond)
-
- cancel()
-
- select {
- case err := <-done:
- require.ErrorIs(t, err, context.Canceled)
- case <-time.After(time.Second):
- require.FailNow(t, "StreamMultiplexedLogs did not exit after cancellation")
- }
-}
-
-func TestReadAllLogsContextCancelClosesReader(t *testing.T) {
- logsChan := make(chan string, 1)
- ctx, cancel := context.WithCancel(t.Context())
- defer cancel()
-
- reader := &blockingReadCloserInternal{readStarted: make(chan struct{}), closeCalled: make(chan struct{})}
- done := make(chan error, 1)
- go func() {
- done <- ReadAllLogs(ctx, reader, logsChan)
- }()
-
- select {
- case <-reader.readStarted:
- case <-time.After(time.Second):
- require.FailNow(t, "ReadAllLogs did not start reading")
- }
-
- cancel()
-
- select {
- case err := <-done:
- require.ErrorIs(t, err, context.Canceled)
- case <-time.After(time.Second):
- require.FailNow(t, "ReadAllLogs did not exit after cancellation")
- }
-
- select {
- case <-reader.closeCalled:
- case <-time.After(time.Second):
- require.FailNow(t, "ReadAllLogs did not close the reader on cancellation")
- }
-}
-
-func drainLogLinesInternal(logsChan chan string) []string {
- close(logsChan)
-
- lines := make([]string, 0, len(logsChan))
- for line := range logsChan {
- lines = append(lines, line)
- }
-
- return lines
-}
-
-func writeDockerLogFrameInternal(t *testing.T, buffer *bytes.Buffer, streamType byte, payload string) {
- t.Helper()
-
- header := make([]byte, 8)
- header[0] = streamType
- binary.BigEndian.PutUint32(header[4:], uint32(len(payload)))
-
- _, err := buffer.Write(header)
- require.NoError(t, err)
- _, err = buffer.WriteString(payload)
- require.NoError(t, err)
-}
-
-type blockingReadCloserInternal struct {
- readStarted chan struct{}
- closeCalled chan struct{}
-}
-
-func (r *blockingReadCloserInternal) Read(_ []byte) (int, error) {
- select {
- case <-r.readStarted:
- default:
- close(r.readStarted)
- }
-
- <-r.closeCalled
- return 0, io.EOF
-}
-
-func (r *blockingReadCloserInternal) Close() error {
- select {
- case <-r.closeCalled:
- default:
- close(r.closeCalled)
- }
- return nil
-}
diff --git a/backend/pkg/dockerutil/mount_utils.go b/backend/pkg/dockerutil/mount_utils.go
deleted file mode 100644
index 33a3f2495..000000000
--- a/backend/pkg/dockerutil/mount_utils.go
+++ /dev/null
@@ -1,270 +0,0 @@
-package docker
-
-import (
- "context"
- "fmt"
- "log/slog"
- "path"
- "slices"
- "strings"
-
- "github.com/moby/moby/api/types/container"
- "github.com/moby/moby/api/types/mount"
- "github.com/moby/moby/client"
-
- "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
-)
-
-// MountForCurrentContainerSubpath inspects the current container, finds the
-// existing mount whose destination covers containerPath, and returns a Mount
-// suitable for use in another container creation that exposes the same data
-// at target. Returns nil + no error when no suitable mount is found, and an
-// error when the current container can't be detected — callers can fall back
-// to a plain bind on containerPath in either case.
-func MountForCurrentContainerSubpath(ctx context.Context, dockerCli *client.Client, containerPath, target string) (*mount.Mount, error) {
- if dockerCli == nil {
- return nil, nil
- }
- inspect, err := libarcane.InspectCurrentArcaneContainer(ctx, dockerCli)
- if err != nil {
- return nil, err
- }
- return MountForSubpath(inspect.Mounts, containerPath, target), nil
-}
-
-// MountForSubpath returns a Mount that exposes a subpath of one of the
-// current container's existing mounts at the requested target. It's a
-// generalisation of MountForDestination for the case where the caller
-// wants a sub-tree below an existing mount destination (e.g.
-// "/app/data/projects/X" when "/app/data" is what the container has
-// mounted).
-//
-// The function picks the most-specific mount whose Destination is a
-// prefix of containerPath, then constructs the Mount based on the
-// backing type:
-//
-// - TypeBind: Source = mount.Source joined with the relative subpath.
-// Works because bind sources are real host paths the daemon
-// can address directly.
-// - TypeVolume: Source = mount.Name (the volume name), and the relative
-// subpath is set on VolumeOptions.Subpath. This lets the
-// daemon mount the named volume directly without needing a
-// host-side path translation — important for setups where
-// the underlying volume storage is opaque (Docker Desktop
-// on WSL2, Docker-in-Docker, etc.).
-//
-// Returns nil if no mount destination is a prefix of containerPath or if
-// the matching mount is of an unsupported type.
-func MountForSubpath(mounts []container.MountPoint, containerPath, target string) *mount.Mount {
- if strings.TrimSpace(containerPath) == "" {
- return nil
- }
- if strings.TrimSpace(target) == "" {
- target = containerPath
- }
-
- var best *container.MountPoint
- for i := range mounts {
- m := &mounts[i]
- if m.Destination == "" {
- continue
- }
- if !pathHasPrefixInternal(containerPath, m.Destination) {
- continue
- }
- if best == nil || len(m.Destination) > len(best.Destination) {
- best = m
- }
- }
- if best == nil {
- return nil
- }
-
- relative := strings.TrimPrefix(strings.TrimPrefix(containerPath, best.Destination), "/")
- readOnly := !best.RW
-
- switch best.Type { //nolint:exhaustive // only bind and volume mounts are translatable; the default returns nil for the rest
- case mount.TypeBind:
- if strings.TrimSpace(best.Source) == "" {
- return nil
- }
- source := best.Source
- if relative != "" {
- source = strings.TrimRight(source, "/") + "/" + relative
- }
- return &mount.Mount{Type: mount.TypeBind, Source: source, Target: target, ReadOnly: readOnly}
- case mount.TypeVolume:
- if strings.TrimSpace(best.Name) == "" {
- return nil
- }
- m := &mount.Mount{Type: mount.TypeVolume, Source: best.Name, Target: target, ReadOnly: readOnly}
- if relative != "" {
- m.VolumeOptions = &mount.VolumeOptions{Subpath: relative}
- }
- return m
- default:
- return nil
- }
-}
-
-// MountForEnclosingPath returns the most-specific mount covering containerPath
-// mounted whole at target, plus containerPath's path relative to that mount.
-// Unlike MountForSubpath the subpath need not exist yet, so restores can create
-// it. Returns nil when no bind or volume mount covers containerPath.
-func MountForEnclosingPath(mounts []container.MountPoint, containerPath, target string) (*mount.Mount, string) {
- if strings.TrimSpace(containerPath) == "" {
- return nil, ""
- }
- var best *container.MountPoint
- for i := range mounts {
- m := &mounts[i]
- if m.Destination == "" || !pathHasPrefixInternal(containerPath, m.Destination) {
- continue
- }
- if best == nil || len(m.Destination) > len(best.Destination) {
- best = m
- }
- }
- if best == nil {
- return nil, ""
- }
- enclosing := MountForDestination(mounts, best.Destination, target)
- if enclosing == nil {
- return nil, ""
- }
- return enclosing, strings.TrimPrefix(strings.TrimPrefix(containerPath, best.Destination), "/")
-}
-
-// NestedMounts mirrors every bind or volume mount whose destination lies
-// strictly below containerPath, re-targeted beneath target, so a helper
-// container sees the same tree the current container does. Parents precede
-// their children; unsupported mount types are skipped.
-func NestedMounts(mounts []container.MountPoint, containerPath, target string) []mount.Mount {
- containerPath = strings.TrimRight(containerPath, "/")
- if containerPath == "" {
- return nil
- }
- var nested []mount.Mount
- for _, m := range mounts {
- if m.Destination == containerPath || !pathHasPrefixInternal(m.Destination, containerPath) {
- continue
- }
- relative := strings.TrimPrefix(strings.TrimPrefix(m.Destination, containerPath), "/")
- if mirrored := MountForDestination(mounts, m.Destination, path.Join(target, relative)); mirrored != nil {
- nested = append(nested, *mirrored)
- }
- }
- slices.SortStableFunc(nested, func(a, b mount.Mount) int { return len(a.Target) - len(b.Target) })
- return nested
-}
-
-// pathHasPrefixInternal reports whether containerPath is at or under prefix,
-// treating both as POSIX-style paths. Avoids false positives like
-// "/app/datax" matching "/app/data".
-func pathHasPrefixInternal(containerPath, prefix string) bool {
- if containerPath == prefix {
- return true
- }
- p := strings.TrimRight(prefix, "/") + "/"
- return strings.HasPrefix(containerPath, p)
-}
-
-// MountForDestination returns a Mount suitable for container creation that mirrors an
-// existing container mount at the given destination.
-//
-// It currently supports bind and named volume mounts. If target is empty, destination
-// is used as the target.
-func MountForDestination(mounts []container.MountPoint, destination, target string) *mount.Mount {
- if strings.TrimSpace(destination) == "" {
- return nil
- }
- if strings.TrimSpace(target) == "" {
- target = destination
- }
-
- for _, m := range mounts {
- if m.Destination != destination {
- continue
- }
-
- readOnly := !m.RW
-
- switch m.Type {
- case mount.TypeVolume:
- if strings.TrimSpace(m.Name) == "" {
- return nil
- }
- return &mount.Mount{Type: mount.TypeVolume, Source: m.Name, Target: target, ReadOnly: readOnly}
- case mount.TypeBind:
- if strings.TrimSpace(m.Source) == "" {
- return nil
- }
- return &mount.Mount{Type: mount.TypeBind, Source: m.Source, Target: target, ReadOnly: readOnly}
- case mount.TypeTmpfs:
- return nil
- case mount.TypeNamedPipe:
- return nil
- case mount.TypeCluster:
- return nil
- case mount.TypeImage:
- return nil
- default:
- return nil
- }
- }
-
- return nil
-}
-
-// PreserveVolumeMounts returns cloned binds and mounts with every inspected
-// volume pinned to its name, so a recreate reuses it instead of a new anonymous one.
-func PreserveVolumeMounts(ctx context.Context, binds []string, mounts []mount.Mount, mountPoints []container.MountPoint) ([]string, []mount.Mount, error) {
- binds = slices.Clone(binds)
- mounts = slices.Clone(mounts)
-
- for _, mp := range mountPoints {
- if mp.Type != mount.TypeVolume {
- continue
- }
- destination := path.Clean(mp.Destination)
- volumeName := strings.TrimSpace(mp.Name)
- if volumeName == "" {
- return nil, nil, fmt.Errorf("volume mounted at %s has no volume name", destination)
- }
-
- mountIndex := slices.IndexFunc(mounts, func(m mount.Mount) bool {
- return path.Clean(m.Target) == destination
- })
- if mountIndex >= 0 {
- if mounts[mountIndex].Type == mount.TypeVolume {
- mounts[mountIndex].Source = volumeName
- }
- slog.InfoContext(ctx, "Preserving volume via mount", "destination", destination, "volume", volumeName)
- continue
- }
-
- // Short syntax is "/dest" for anonymous volumes or "src:/dest[:opts]".
- bindIndex := slices.IndexFunc(binds, func(bind string) bool {
- parts := strings.SplitN(bind, ":", 3)
- if len(parts) == 1 {
- return path.Clean(parts[0]) == destination
- }
- return path.Clean(parts[1]) == destination
- })
- if bindIndex >= 0 {
- if !strings.Contains(binds[bindIndex], ":") {
- binds[bindIndex] = volumeName + ":" + binds[bindIndex]
- }
- slog.InfoContext(ctx, "Preserving volume via bind", "destination", destination, "volume", volumeName)
- continue
- }
-
- explicit := MountForDestination(mountPoints, mp.Destination, mp.Destination)
- if explicit == nil {
- return nil, nil, fmt.Errorf("cannot build explicit mount for volume %s at %s", volumeName, destination)
- }
- mounts = append(mounts, *explicit)
- slog.InfoContext(ctx, "Preserving image-declared volume", "destination", destination, "volume", volumeName)
- }
- return binds, mounts, nil
-}
diff --git a/backend/pkg/dockerutil/mount_utils_test.go b/backend/pkg/dockerutil/mount_utils_test.go
deleted file mode 100644
index c699fd0e8..000000000
--- a/backend/pkg/dockerutil/mount_utils_test.go
+++ /dev/null
@@ -1,282 +0,0 @@
-package docker
-
-import (
- "testing"
-
- containertypes "github.com/moby/moby/api/types/container"
- mounttypes "github.com/moby/moby/api/types/mount"
- "github.com/stretchr/testify/require"
-)
-
-func TestMountForDestination(t *testing.T) {
- tests := []struct {
- name string
- mounts []containertypes.MountPoint
- dest string
- target string
- wantNil bool
- wantType mounttypes.Type
- wantSource string
- wantTarget string
- wantRO bool
- }{
- {
- name: "returns bind mount",
- mounts: []containertypes.MountPoint{
- {Type: mounttypes.TypeBind, Source: "/host/backups", Destination: "/backups", RW: true},
- },
- dest: "/backups",
- target: "/volume",
- wantType: mounttypes.TypeBind,
- wantSource: "/host/backups",
- wantTarget: "/volume",
- wantRO: false,
- },
- {
- name: "returns named volume mount",
- mounts: []containertypes.MountPoint{
- {Type: mounttypes.TypeVolume, Name: "arcane-backups", Destination: "/backups", RW: false},
- },
- dest: "/backups",
- target: "/restores",
- wantType: mounttypes.TypeVolume,
- wantSource: "arcane-backups",
- wantTarget: "/restores",
- wantRO: true,
- },
- {
- name: "defaults target to destination",
- mounts: []containertypes.MountPoint{
- {Type: mounttypes.TypeBind, Source: "/host/backups", Destination: "/backups", RW: true},
- },
- dest: "/backups",
- wantType: mounttypes.TypeBind,
- wantSource: "/host/backups",
- wantTarget: "/backups",
- wantRO: false,
- },
- {
- name: "ignores unsupported mount types",
- mounts: []containertypes.MountPoint{
- {Type: mounttypes.TypeTmpfs, Destination: "/backups"},
- },
- dest: "/backups",
- wantNil: true,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got := MountForDestination(tt.mounts, tt.dest, tt.target)
- if tt.wantNil {
- require.Nil(t, got)
- return
- }
-
- require.NotNil(t, got)
- require.Equal(t, tt.wantType, got.Type)
- require.Equal(t, tt.wantSource, got.Source)
- require.Equal(t, tt.wantTarget, got.Target)
- require.Equal(t, tt.wantRO, got.ReadOnly)
- })
- }
-}
-
-func TestMountForSubpath(t *testing.T) {
- hostBind := containertypes.MountPoint{Type: mounttypes.TypeBind, Source: "/host/projects-root", Destination: "/app/data", RW: true}
- namedVolume := containertypes.MountPoint{Type: mounttypes.TypeVolume, Name: "arcane-dev-data", Destination: "/app/data", RW: true}
- nestedBind := containertypes.MountPoint{Type: mounttypes.TypeBind, Source: "/host/projects-only", Destination: "/app/data/projects", RW: true}
- readOnlyVolume := containertypes.MountPoint{Type: mounttypes.TypeVolume, Name: "ro-vol", Destination: "/app/data", RW: false}
- tmpfsMount := containertypes.MountPoint{Type: mounttypes.TypeTmpfs, Destination: "/app/data"}
-
- t.Run("bind mount with subpath joins host source", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{hostBind}, "/app/data/projects/foo", "/workspace")
- require.NotNil(t, got)
- require.Equal(t, mounttypes.TypeBind, got.Type)
- require.Equal(t, "/host/projects-root/projects/foo", got.Source)
- require.Equal(t, "/workspace", got.Target)
- require.False(t, got.ReadOnly)
- require.Nil(t, got.VolumeOptions)
- })
-
- t.Run("named volume with subpath uses VolumeOptions.Subpath", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{namedVolume}, "/app/data/projects/foo", "/workspace")
- require.NotNil(t, got)
- require.Equal(t, mounttypes.TypeVolume, got.Type)
- require.Equal(t, "arcane-dev-data", got.Source)
- require.Equal(t, "/workspace", got.Target)
- require.NotNil(t, got.VolumeOptions)
- require.Equal(t, "projects/foo", got.VolumeOptions.Subpath)
- })
-
- t.Run("picks the most-specific matching mount", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{hostBind, nestedBind}, "/app/data/projects/foo", "/workspace")
- require.NotNil(t, got)
- // nestedBind's destination is more specific, so the relative subpath is "foo"
- require.Equal(t, "/host/projects-only/foo", got.Source)
- })
-
- t.Run("exact-destination match has no subpath", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{namedVolume}, "/app/data", "/workspace")
- require.NotNil(t, got)
- require.Equal(t, mounttypes.TypeVolume, got.Type)
- require.Equal(t, "arcane-dev-data", got.Source)
- require.Nil(t, got.VolumeOptions, "exact destination match shouldn't add VolumeOptions")
- })
-
- t.Run("preserves read-only", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{readOnlyVolume}, "/app/data/projects/foo", "/workspace")
- require.NotNil(t, got)
- require.True(t, got.ReadOnly)
- })
-
- t.Run("defaults target to containerPath", func(t *testing.T) {
- got := MountForSubpath([]containertypes.MountPoint{hostBind}, "/app/data/projects/foo", "")
- require.NotNil(t, got)
- require.Equal(t, "/app/data/projects/foo", got.Target)
- })
-
- t.Run("rejects unsupported mount types", func(t *testing.T) {
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{tmpfsMount}, "/app/data/projects/foo", "/workspace"))
- })
-
- t.Run("returns nil when no mount destination is a prefix", func(t *testing.T) {
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{hostBind}, "/elsewhere/foo", "/workspace"))
- })
-
- t.Run("does not match similar-looking destinations", func(t *testing.T) {
- // "/app/datax" must not match "/app/data".
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{hostBind}, "/app/datax/foo", "/workspace"))
- })
-
- t.Run("rejects empty containerPath", func(t *testing.T) {
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{hostBind}, "", "/workspace"))
- })
-
- t.Run("rejects bind mount with empty source", func(t *testing.T) {
- bad := containertypes.MountPoint{Type: mounttypes.TypeBind, Destination: "/app/data"}
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{bad}, "/app/data/projects/foo", "/workspace"))
- })
-
- t.Run("rejects named volume with empty name", func(t *testing.T) {
- bad := containertypes.MountPoint{Type: mounttypes.TypeVolume, Destination: "/app/data"}
- require.Nil(t, MountForSubpath([]containertypes.MountPoint{bad}, "/app/data/projects/foo", "/workspace"))
- })
-}
-
-func TestPreserveVolumeMounts(t *testing.T) {
- anon := "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
- mountPoints := []containertypes.MountPoint{
- {Type: mounttypes.TypeVolume, Name: anon, Destination: "/app/data", RW: true},
- {Type: mounttypes.TypeVolume, Name: "named", Destination: "/data", RW: true},
- {Type: mounttypes.TypeVolume, Name: "ro", Destination: "/ro", RW: false},
- {Type: mounttypes.TypeBind, Source: "/host", Destination: "/bind", RW: true},
- }
-
- tests := []struct {
- name string
- binds []string
- mounts []mounttypes.Mount
- points []containertypes.MountPoint
- wantBinds []string
- wantMounts []mounttypes.Mount
- wantErr bool
- }{
- {
- name: "image-declared volume gains explicit mount",
- points: mountPoints[:1],
- wantMounts: []mounttypes.Mount{
- {Type: mounttypes.TypeVolume, Source: anon, Target: "/app/data"},
- },
- },
- {
- name: "anonymous bind gains volume name, explicit binds preserved",
- binds: []string{"/app/data", "named:/data", "/host:/bind:ro"},
- points: mountPoints,
- wantBinds: []string{anon + ":/app/data", "named:/data", "/host:/bind:ro"},
- wantMounts: []mounttypes.Mount{
- {Type: mounttypes.TypeVolume, Source: "ro", Target: "/ro", ReadOnly: true},
- },
- },
- {
- name: "structured mount keeps options and gets source",
- mounts: []mounttypes.Mount{
- {Type: mounttypes.TypeVolume, Target: "/app/data/", VolumeOptions: &mounttypes.VolumeOptions{Subpath: "sub"}},
- {Type: mounttypes.TypeTmpfs, Target: "/tmp"},
- },
- points: mountPoints[:1],
- wantMounts: []mounttypes.Mount{
- {Type: mounttypes.TypeVolume, Source: anon, Target: "/app/data/", VolumeOptions: &mounttypes.VolumeOptions{Subpath: "sub"}},
- {Type: mounttypes.TypeTmpfs, Target: "/tmp"},
- },
- },
- {
- name: "volume without name fails",
- points: []containertypes.MountPoint{{Type: mounttypes.TypeVolume, Destination: "/app/data"}},
- wantErr: true,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- origBinds := append([]string(nil), tt.binds...)
- origMounts := append([]mounttypes.Mount(nil), tt.mounts...)
-
- binds, mounts, err := PreserveVolumeMounts(t.Context(), tt.binds, tt.mounts, tt.points)
- if tt.wantErr {
- require.Error(t, err)
- return
- }
- require.NoError(t, err)
- require.Equal(t, tt.wantBinds, binds)
- require.Equal(t, tt.wantMounts, mounts)
- require.Equal(t, origBinds, tt.binds)
- require.Equal(t, origMounts, tt.mounts)
- })
- }
-}
-
-func TestMountForEnclosingPath(t *testing.T) {
- mounts := []containertypes.MountPoint{
- {Type: mounttypes.TypeVolume, Name: "arcane-data", Destination: "/app/data", RW: true},
- {Type: mounttypes.TypeBind, Source: "/host/projects", Destination: "/app/data/projects", RW: true},
- {Type: mounttypes.TypeTmpfs, Destination: "/app/data/tmp"},
- }
- enclosing, relative := MountForEnclosingPath(mounts, "/app/data/custom/projects", "/restore")
- require.Equal(t, &mounttypes.Mount{Type: mounttypes.TypeVolume, Source: "arcane-data", Target: "/restore"}, enclosing)
- require.Equal(t, "custom/projects", relative)
-
- enclosing, relative = MountForEnclosingPath(mounts, "/app/data/projects/demo", "/restore")
- require.Equal(t, &mounttypes.Mount{Type: mounttypes.TypeBind, Source: "/host/projects", Target: "/restore"}, enclosing)
- require.Equal(t, "demo", relative)
-
- enclosing, relative = MountForEnclosingPath(mounts, "/app/data", "/restore")
- require.Equal(t, "arcane-data", enclosing.Source)
- require.Empty(t, relative)
-
- enclosing, _ = MountForEnclosingPath(mounts, "/app/data/tmp/x", "/restore")
- require.Nil(t, enclosing)
- enclosing, _ = MountForEnclosingPath(mounts, "/srv/projects", "/restore")
- require.Nil(t, enclosing)
- enclosing, _ = MountForEnclosingPath(mounts, "", "/restore")
- require.Nil(t, enclosing)
-}
-
-func TestNestedMounts(t *testing.T) {
- mounts := []containertypes.MountPoint{
- {Type: mounttypes.TypeBind, Source: "/host/deep", Destination: "/app/data/projects/deep", RW: false},
- {Type: mounttypes.TypeVolume, Name: "arcane-data", Destination: "/app/data", RW: true},
- {Type: mounttypes.TypeBind, Source: "/host/projects", Destination: "/app/data/projects", RW: true},
- {Type: mounttypes.TypeTmpfs, Destination: "/app/data/tmp"},
- {Type: mounttypes.TypeBind, Source: "/host/other", Destination: "/app/datasets", RW: true},
- }
- require.Equal(t, []mounttypes.Mount{
- {Type: mounttypes.TypeBind, Source: "/host/projects", Target: "/data/projects"},
- {Type: mounttypes.TypeBind, Source: "/host/deep", Target: "/data/projects/deep", ReadOnly: true},
- }, NestedMounts(mounts, "/app/data", "/data"))
- require.Equal(t, []mounttypes.Mount{
- {Type: mounttypes.TypeBind, Source: "/host/deep", Target: "/projects/deep", ReadOnly: true},
- }, NestedMounts(mounts, "/app/data/projects/", "/projects"))
- require.Empty(t, NestedMounts(mounts, "/app/data/projects/deep", "/x"))
- require.Empty(t, NestedMounts(mounts, "", "/x"))
-}
diff --git a/backend/pkg/dockerutil/network_utils.go b/backend/pkg/dockerutil/network_utils.go
deleted file mode 100644
index 94464ee64..000000000
--- a/backend/pkg/dockerutil/network_utils.go
+++ /dev/null
@@ -1,156 +0,0 @@
-package docker
-
-import (
- "context"
- "log/slog"
- "net/url"
- "slices"
- "sort"
- "strings"
-
- "github.com/moby/moby/api/types/container"
- "github.com/moby/moby/client"
-)
-
-const defaultNetworkModeInternal = "bridge"
-
-func IsDefaultNetwork(name string) bool {
- switch name {
- case "bridge", "host", "none", "ingress":
- return true
- default:
- return false
- }
-}
-
-func SelectAutoNetworkMode(inspect *container.InspectResponse) string {
- if inspect == nil {
- return defaultNetworkModeInternal
- }
-
- if inspect.HostConfig != nil {
- networkMode := strings.TrimSpace(string(inspect.HostConfig.NetworkMode))
- if networkMode != "" && networkMode != "default" && networkMode != defaultNetworkModeInternal &&
- !container.NetworkMode(networkMode).IsContainer() {
- return networkMode
- }
- }
-
- if inspect.NetworkSettings != nil && len(inspect.NetworkSettings.Networks) > 0 {
- networkNames := make([]string, 0, len(inspect.NetworkSettings.Networks))
- for networkName := range inspect.NetworkSettings.Networks {
- networkName = strings.TrimSpace(networkName)
- if networkName != "" {
- networkNames = append(networkNames, networkName)
- }
- }
- sort.Strings(networkNames)
-
- for _, networkName := range networkNames {
- if !IsDefaultNetwork(networkName) {
- return networkName
- }
- }
-
- for _, networkName := range networkNames {
- if container.NetworkMode(networkName).IsContainer() {
- continue
- }
- if networkName == "host" || networkName == "none" || networkName == defaultNetworkModeInternal {
- return networkName
- }
- }
- }
-
- if inspect.HostConfig != nil {
- networkMode := strings.TrimSpace(string(inspect.HostConfig.NetworkMode))
- if networkMode != "" && networkMode != "default" && !container.NetworkMode(networkMode).IsContainer() {
- return networkMode
- }
- }
-
- return defaultNetworkModeInternal
-}
-
-// SelectDockerHostReachableNetworkMode picks the network for a helper container
-// that must reach a tcp DOCKER_HOST (e.g. a docker-socket-proxy). When the
-// DOCKER_HOST hostname matches a running container — by name, compose service,
-// or DNS alias — that shares a network with the current container, that shared
-// network wins. SelectAutoNetworkMode's alphabetical heuristic routinely lands
-// on an unrelated external network on multi-network setups, leaving the helper
-// unable to reach the daemon (#3533).
-func SelectDockerHostReachableNetworkMode(ctx context.Context, dockerClient *client.Client, inspect *container.InspectResponse, dockerHost string) string {
- fallback := SelectAutoNetworkMode(inspect)
-
- host := ""
- if parsed, err := url.Parse(strings.TrimSpace(dockerHost)); err == nil {
- host = parsed.Hostname()
- }
- if host == "" || dockerClient == nil || inspect == nil || inspect.NetworkSettings == nil || len(inspect.NetworkSettings.Networks) == 0 {
- return fallback
- }
-
- list, err := dockerClient.ContainerList(ctx, client.ContainerListOptions{})
- if err != nil {
- slog.DebugContext(ctx, "select docker-host network: list failed", "error", err)
- return fallback
- }
-
- shared := make([]string, 0, 2)
- for _, c := range list.Items {
- if c.NetworkSettings == nil || !containerAnswersToHostnameInternal(&c, host) {
- continue
- }
- for networkName := range c.NetworkSettings.Networks {
- if _, ok := inspect.NetworkSettings.Networks[networkName]; ok {
- shared = append(shared, networkName)
- }
- }
- }
- if len(shared) == 0 {
- return fallback
- }
- sort.Strings(shared)
- return shared[0]
-}
-
-// containerAnswersToHostnameInternal reports whether the container is
-// addressable as host on some network: by container name, compose service
-// name, or an endpoint DNS name/alias.
-func containerAnswersToHostnameInternal(c *container.Summary, host string) bool {
- for _, name := range c.Names {
- if strings.TrimPrefix(name, "/") == host {
- return true
- }
- }
- if c.Labels["com.docker.compose.service"] == host {
- return true
- }
- for _, endpoint := range c.NetworkSettings.Networks {
- if endpoint == nil {
- continue
- }
- if slices.Contains(endpoint.DNSNames, host) || slices.Contains(endpoint.Aliases, host) {
- return true
- }
- }
- return false
-}
-
-// BuildNetworkUsageMaps indexes container network attachments by ID and name.
-func BuildNetworkUsageMaps(containers []container.Summary) (map[string]bool, map[string]bool) {
- inUseByID := make(map[string]bool)
- inUseByName := make(map[string]bool)
- for _, c := range containers {
- if c.NetworkSettings == nil || c.NetworkSettings.Networks == nil {
- continue
- }
- for netName, es := range c.NetworkSettings.Networks {
- if es.NetworkID != "" {
- inUseByID[es.NetworkID] = true
- }
- inUseByName[netName] = true
- }
- }
- return inUseByID, inUseByName
-}
diff --git a/backend/pkg/dockerutil/network_utils_test.go b/backend/pkg/dockerutil/network_utils_test.go
deleted file mode 100644
index 8fe689120..000000000
--- a/backend/pkg/dockerutil/network_utils_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package docker
-
-import (
- "net/http"
- "net/http/httptest"
- "strings"
- "testing"
-
- containertypes "github.com/moby/moby/api/types/container"
- networktypes "github.com/moby/moby/api/types/network"
- "github.com/moby/moby/client"
- "github.com/stretchr/testify/require"
-)
-
-func TestSelectAutoNetworkMode(t *testing.T) {
- t.Run("prefers explicit host network mode", func(t *testing.T) {
- mode := SelectAutoNetworkMode(&containertypes.InspectResponse{
- HostConfig: &containertypes.HostConfig{NetworkMode: "host"},
- })
-
- require.Equal(t, "host", mode)
- })
-
- t.Run("prefers attached custom network over bridge", func(t *testing.T) {
- mode := SelectAutoNetworkMode(&containertypes.InspectResponse{
- HostConfig: &containertypes.HostConfig{NetworkMode: "bridge"},
- NetworkSettings: &containertypes.NetworkSettings{
- Networks: map[string]*networktypes.EndpointSettings{
- "bridge": {},
- "arcane-internal": {},
- },
- },
- })
-
- require.Equal(t, "arcane-internal", mode)
- })
-
- t.Run("falls back to bridge when no custom network is attached", func(t *testing.T) {
- mode := SelectAutoNetworkMode(&containertypes.InspectResponse{
- HostConfig: &containertypes.HostConfig{NetworkMode: "bridge"},
- NetworkSettings: &containertypes.NetworkSettings{
- Networks: map[string]*networktypes.EndpointSettings{
- "bridge": {},
- },
- },
- })
-
- require.Equal(t, "bridge", mode)
- })
-}
-
-func TestSelectDockerHostReachableNetworkMode(t *testing.T) {
- // Server container on an external tunnel network plus a compose-prefixed
- // socket-proxy network. Plain alphabetical selection picks the tunnel (#3533).
- inspect := &containertypes.InspectResponse{
- NetworkSettings: &containertypes.NetworkSettings{
- Networks: map[string]*networktypes.EndpointSettings{
- "cloudflare-tunnel": {},
- "myproj_socket-proxy-net": {},
- },
- },
- }
-
- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- if strings.HasSuffix(r.URL.Path, "/containers/json") {
- _, _ = w.Write([]byte("[{\"Id\":\"proxy1\",\"Names\":[\"/myproj-socket-proxy-1\"],\"Labels\":{\"com.docker.compose.service\":\"socket-pr" +
- "oxy\"},\"State\":\"running\",\"NetworkSettings\":{\"Networks\":{\"myproj_socket-proxy-net\":{\"Aliases\":[\"socket" +
- "-proxy\"]}}}}]"))
- return
- }
- w.WriteHeader(http.StatusOK)
- }))
- defer server.Close()
- dockerClient, err := client.New(
- client.WithHost("tcp://"+strings.TrimPrefix(server.URL, "http://")),
- client.WithAPIVersion("1.41"),
- )
- require.NoError(t, err)
- defer func() { _ = dockerClient.Close() }()
-
- t.Run("prefers shared network with the DOCKER_HOST container", func(t *testing.T) {
- got := SelectDockerHostReachableNetworkMode(t.Context(), dockerClient, inspect, "tcp://socket-proxy:2375")
- require.Equal(t, "myproj_socket-proxy-net", got)
- })
-
- t.Run("falls back to auto heuristic when nothing matches", func(t *testing.T) {
- got := SelectDockerHostReachableNetworkMode(t.Context(), dockerClient, inspect, "tcp://unknown-host:2375")
- require.Equal(t, "cloudflare-tunnel", got)
- })
-}
diff --git a/backend/pkg/dockerutil/progress.go b/backend/pkg/dockerutil/progress.go
deleted file mode 100644
index 0111de06f..000000000
--- a/backend/pkg/dockerutil/progress.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package docker
-
-import (
- "bytes"
- "encoding/json/v2"
- "io"
- "strings"
- "sync"
-
- "github.com/moby/moby/client/pkg/jsonmessage"
-)
-
-// ProgressWriterKey can be set on a context to stream operation output to the
-// client. The value must be an io.Writer (typically an activity writer wrapping
-// the HTTP response writer).
-type ProgressWriterKey struct{}
-
-type flusher interface{ Flush() }
-
-// NewLogLineWriter returns a writer that splits everything written to it on
-// newlines and emits each line as a {"log":"<line>"} NDJSON frame to dst,
-// flushing after each frame when dst supports it. Close flushes any trailing
-// partial line as a final frame. Writers such as compose's plain progress
-// renderer and jsonmessage.DisplayJSONMessagesStream write raw CLI text into
-// this to put docker-CLI-parity output on the wire.
-func NewLogLineWriter(dst io.Writer) io.WriteCloser {
- if dst == nil || dst == io.Discard {
- return nopWriteCloser{io.Discard}
- }
- return &logLineWriter{dst: dst}
-}
-
-type nopWriteCloser struct{ io.Writer }
-
-func (nopWriteCloser) Close() error { return nil }
-
-type logLineWriter struct {
- dst io.Writer
-
- // Writers such as compose's plain progress renderer write from multiple
- // goroutines concurrently; the line buffer must be guarded.
- mu sync.Mutex
- buffer []byte
-}
-
-func (w *logLineWriter) Write(p []byte) (int, error) {
- w.mu.Lock()
- defer w.mu.Unlock()
-
- w.buffer = append(w.buffer, p...)
- for {
- idx := bytes.IndexByte(w.buffer, '\n')
- if idx < 0 {
- break
- }
- line := string(w.buffer[:idx])
- w.buffer = w.buffer[idx+1:]
- w.emitLine(line)
- }
- return len(p), nil
-}
-
-func (w *logLineWriter) Close() error {
- w.mu.Lock()
- defer w.mu.Unlock()
-
- if len(w.buffer) > 0 {
- w.emitLine(string(w.buffer))
- w.buffer = nil
- }
- return nil
-}
-
-func (w *logLineWriter) emitLine(line string) {
- line = strings.TrimSuffix(line, "\r")
- frame, err := json.Marshal(map[string]string{"log": line})
- if err != nil {
- return
- }
- _, _ = w.dst.Write(append(frame, '\n'))
- if f, ok := w.dst.(flusher); ok {
- f.Flush()
- }
-}
-
-// RenderJSONMessageStream renders a Docker JSON message stream (image pull,
-// push, build, load) as the raw text the docker CLI prints in non-TTY mode,
-// writing it to out. Any daemon-reported error is returned verbatim.
-func RenderJSONMessageStream(reader io.Reader, out io.Writer) error {
- if out == nil {
- out = io.Discard
- }
- return jsonmessage.DisplayJSONMessagesStream(reader, out, 0, false, nil)
-}
diff --git a/backend/pkg/dockerutil/render_test.go b/backend/pkg/dockerutil/render_test.go
deleted file mode 100644
index 80e6fa997..000000000
--- a/backend/pkg/dockerutil/render_test.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package docker
-
-import (
- "strings"
- "sync"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestRenderJSONMessageStream(t *testing.T) {
- t.Run("renders docker CLI text for pull messages", func(t *testing.T) {
- stream := strings.NewReader("{\"status\":\"Pulling from library/nginx\",\"id\":\"stable-alpine\"}\n{\"status\":\"Pull complete\",\"id\":\"abc123\"" +
- "}\n{\"status\":\"Status: Downloaded newer image for nginx:stable-alpine\"}\n")
- var out strings.Builder
- {
-
- err := RenderJSONMessageStream(stream, &out)
- require.NoError(t, err,
- "expected nil error, got %v", err)
- }
-
- want := "stable-alpine: Pulling from library/nginx\nabc123: Pull complete\nStatus: Downloaded newer image for nginx:stable-alpine\n"
-
- require.Equal(t, want, out.String(),
- "expected CLI-parity output %q, got %q", want, out.String())
- })
-
- t.Run("returns daemon errorDetail verbatim", func(t *testing.T) {
- stream := strings.NewReader("{\"errorDetail\":{\"code\":401,\"message\":\"unauthorized\"}}\n")
- err := RenderJSONMessageStream(stream, nil)
-
- require.False(t, err == nil || !strings.Contains(err.Error(), "unauthorized"),
- "expected unauthorized error, got %v", err)
- })
-}
-
-// Compose's plain progress renderer writes from multiple goroutines; the
-// writer must tolerate concurrent writes without corrupting its buffer.
-func TestLogLineWriterConcurrentWrites(t *testing.T) {
- var out syncBuffer
- w := NewLogLineWriter(&out)
-
- var wg sync.WaitGroup
- for range 8 {
- wg.Go(func() {
- for range 200 {
- _, _ = w.Write([]byte("Container test Created\n"))
- }
- })
- }
- wg.Wait()
- _ = w.Close()
-
- lines := strings.Split(strings.TrimSpace(out.String()), "\n")
- if len(lines) != 8*200 {
- require.Len(t, lines, 8*200,
- "expected %d frames, got %d", 8*200, len(lines))
- }
-}
-
-type syncBuffer struct {
- mu sync.Mutex
- buf strings.Builder
-}
-
-func (b *syncBuffer) Write(p []byte) (int, error) {
- b.mu.Lock()
- defer b.mu.Unlock()
- return b.buf.Write(p)
-}
-
-func (b *syncBuffer) String() string {
- b.mu.Lock()
- defer b.mu.Unlock()
- return b.buf.String()
-}
-
-func TestLogLineWriter(t *testing.T) {
- var out strings.Builder
- w := NewLogLineWriter(&out)
-
- _, _ = w.Write([]byte("Container arcane-test Creating\nContainer arcane"))
- _, _ = w.Write([]byte("-test Created\npartial"))
- _ = w.Close()
-
- want := "{\"log\":\"Container arcane-test Creating\"}\n{\"log\":\"Container arcane-test Created\"}\n{\"log\":\"partial\"}\n"
-
- require.Equal(t, want, out.String(),
- "expected framed lines %q, got %q", want, out.String())
-}
diff --git a/backend/pkg/dockerutil/volume_utils.go b/backend/pkg/dockerutil/volume_utils.go
deleted file mode 100644
index d3d8cbce1..000000000
--- a/backend/pkg/dockerutil/volume_utils.go
+++ /dev/null
@@ -1,210 +0,0 @@
-package docker
-
-import (
- "context"
- "errors"
- "fmt"
- "log/slog"
- "strings"
- "time"
-
- "github.com/moby/moby/api/types/container"
- "github.com/moby/moby/api/types/mount"
- "github.com/moby/moby/api/types/volume"
- "github.com/moby/moby/client"
- "github.com/samber/hot"
- "github.com/samber/mo"
- kit "go.getarcane.app/kit/pkg"
-)
-
-var volumeUsageCache = hot.NewHotCache[string, []volume.Volume](hot.LRU, 16).
- WithTTL(volumeUsageCacheTTL).
- WithCopyOnRead(cloneVolumeUsageInternal).
- WithCopyOnWrite(cloneVolumeUsageInternal).
- Build()
-
-const (
- volumeUsageCacheTTL = 30 * time.Second
- volumeUsageRefreshFallbackTimeout = 30 * time.Second
-)
-
-// GetVolumeUsageData returns current volume usage data, sharing an in-flight
-// refresh with concurrent callers while allowing each caller to honor its own context.
-func GetVolumeUsageData(ctx context.Context, dockerClient *client.Client) ([]volume.Volume, error) {
- if dockerClient == nil {
- return nil, errors.New("failed to get disk usage: Docker client is nil")
- }
-
- key := volumeUsageCacheKeyInternal(dockerClient)
- stale, staleFound := volumeUsageCache.Peek(key)
- if cached, found, _ := volumeUsageCache.Get(key); found {
- slog.DebugContext(ctx, "returning cached volume usage data", "volumeCount", len(cached), "dockerHost", key)
- return cached, nil
- }
-
- type refreshResult struct {
- volumes []volume.Volume
- found bool
- err error
- }
- result := make(chan refreshResult, 1)
- refreshCtx, cancel := volumeUsageRefreshContextInternal(ctx)
- go func() {
- defer cancel()
- volumes, found, err := volumeUsageCache.GetWithLoaders(key, func(_ []string) (map[string][]volume.Volume, error) {
- loaded, loadErr := fetchVolumeUsageDataInternal(refreshCtx, dockerClient)
- if loadErr != nil {
- return nil, loadErr
- }
- return map[string][]volume.Volume{key: loaded}, nil
- })
- result <- refreshResult{volumes: volumes, found: found, err: err}
- }()
-
- select {
- case <-ctx.Done():
- if staleFound {
- slog.WarnContext(ctx, "volume usage refresh timed out; returning stale cache", "error", ctx.Err(), "volumeCount", len(stale), "dockerHost", key)
- return stale, nil
- }
- return nil, ctx.Err()
- case refreshed := <-result:
- if refreshed.err != nil {
- if staleFound {
- slog.WarnContext(ctx, "volume usage refresh failed; returning stale cache", "error", refreshed.err, "volumeCount", len(stale), "dockerHost", key)
- return stale, nil
- }
- return nil, refreshed.err
- }
- if !refreshed.found {
- return nil, errors.New("volume usage cache loader returned no data")
- }
- return refreshed.volumes, nil
- }
-}
-
-// GetVolumeUsageDataStaleWhileRevalidate returns immediately with any cached
-// snapshot and starts a bounded refresh when the snapshot is stale or missing.
-func GetVolumeUsageDataStaleWhileRevalidate(ctx context.Context, dockerClient *client.Client) mo.Option[[]volume.Volume] {
- if dockerClient == nil {
- return mo.None[[]volume.Volume]()
- }
-
- key := volumeUsageCacheKeyInternal(dockerClient)
- cached, found := volumeUsageCache.Peek(key)
- if fresh, freshFound, _ := volumeUsageCache.Get(key); freshFound {
- slog.DebugContext(ctx, "volume usage cache lookup",
- "dockerHost", key,
- "cacheState", "fresh",
- "volumeCount", len(fresh),
- "refreshRequested", false,
- )
- return mo.Some(fresh)
- }
- cacheState := kit.Ternary(found, "stale", "miss")
- slog.DebugContext(ctx, "volume usage cache lookup",
- "dockerHost", key,
- "cacheState", cacheState,
- "volumeCount", len(cached),
- "refreshRequested", true,
- )
- refreshCtx, cancel := volumeUsageRefreshContextInternal(ctx)
- go func() {
- defer cancel()
- _, _, err := volumeUsageCache.GetWithLoaders(key, func(_ []string) (map[string][]volume.Volume, error) {
- loaded, loadErr := fetchVolumeUsageDataInternal(refreshCtx, dockerClient)
- if loadErr != nil {
- return nil, loadErr
- }
- return map[string][]volume.Volume{key: loaded}, nil
- })
- if err != nil {
- slog.WarnContext(refreshCtx, "failed to refresh volume usage cache", "error", err, "dockerHost", key)
- }
- }()
- if !found {
- return mo.None[[]volume.Volume]()
- }
- return mo.Some(cached)
-}
-
-// InvalidateVolumeUsageCache invalidates usage data for the Docker daemon used by dockerClient.
-func InvalidateVolumeUsageCache(dockerClient *client.Client) {
- if dockerClient == nil {
- return
- }
-
- key := volumeUsageCacheKeyInternal(dockerClient)
- volumeUsageCache.Delete(key)
-}
-
-func volumeUsageCacheKeyInternal(dockerClient *client.Client) string {
- host := dockerClient.DaemonHost()
- if host != "" {
- return host
- }
- return fmt.Sprintf("client:%p", dockerClient)
-}
-
-func volumeUsageRefreshContextInternal(ctx context.Context) (context.Context, context.CancelFunc) {
- detached := context.WithoutCancel(ctx)
- if deadline, ok := ctx.Deadline(); ok {
- return context.WithDeadline(detached, deadline)
- }
- return context.WithTimeout(detached, volumeUsageRefreshFallbackTimeout)
-}
-
-func cloneVolumeUsageInternal(volumes []volume.Volume) []volume.Volume {
- return append([]volume.Volume(nil), volumes...)
-}
-
-func fetchVolumeUsageDataInternal(ctx context.Context, dockerClient *client.Client) ([]volume.Volume, error) {
- diskUsage, err := dockerClient.DiskUsage(ctx, client.DiskUsageOptions{
- Volumes: true,
- Verbose: true,
- })
- if err != nil {
- return nil, fmt.Errorf("failed to get disk usage: %w", err)
- }
-
- slog.DebugContext(ctx, "disk usage returned volumes", "volumeCount", len(diskUsage.Volumes.Items))
- return append([]volume.Volume{}, diskUsage.Volumes.Items...), nil
-}
-
-// FilterContainersUsingVolume returns the IDs of containers in the provided slice that mount the named volume.
-// Use this when checking many volumes in a row — list containers once and reuse the slice.
-func FilterContainersUsingVolume(containers []container.Summary, volumeName string) []string {
- containerIDs := make([]string, 0)
- for _, c := range containers {
- for _, m := range c.Mounts {
- if m.Type == mount.TypeVolume && m.Name == volumeName {
- containerIDs = append(containerIDs, c.ID)
- break
- }
- }
- }
- return containerIDs
-}
-
-// GetContainersUsingVolume lists all containers and returns IDs that mount the named volume.
-// For batch checks (multiple volumes), prefer listing containers once via dockerClient.ContainerList
-// and calling FilterContainersUsingVolume per volume.
-func GetContainersUsingVolume(ctx context.Context, dockerClient *client.Client, volumeName string) ([]string, error) {
- containerList, err := dockerClient.ContainerList(ctx, client.ContainerListOptions{All: true})
- if err != nil {
- return nil, fmt.Errorf("failed to list containers: %w", err)
- }
-
- containerIDs := FilterContainersUsingVolume(containerList.Items, volumeName)
- slog.DebugContext(ctx, "found containers using volume", "volume", volumeName, "containerCount", len(containerIDs))
- return containerIDs, nil
-}
-
-// ValidateVolumeWorkspaceHelperSupport rejects Docker volume configurations
-// that cannot be mounted safely inside Arcane's reusable workspace helper.
-func ValidateVolumeWorkspaceHelperSupport(volumeName string, options map[string]string) error {
- if options["type"] == "none" || strings.Contains(options["o"], "bind") {
- return fmt.Errorf("volume %q uses a custom mount configuration and cannot be accessed through the workspace helper", volumeName)
- }
- return nil
-}
diff --git a/backend/pkg/dockerutil/volume_utils_test.go b/backend/pkg/dockerutil/volume_utils_test.go
deleted file mode 100644
index 99b4c31d3..000000000
--- a/backend/pkg/dockerutil/volume_utils_test.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package docker
-
-import (
- "context"
- "fmt"
- "net/http"
- "net/http/httptest"
- "sync"
- "sync/atomic"
- "testing"
- "time"
-
- "github.com/moby/moby/client"
- "github.com/stretchr/testify/require"
-)
-
-func TestVolumeUsageCacheBehaviorInternal(t *testing.T) {
- t.Run("deduplicates refresh and honors waiter context", func(t *testing.T) {
- resetVolumeUsageCacheForTestInternal()
-
- started := make(chan struct{})
- release := make(chan struct{})
- var startedOnce sync.Once
- var requests atomic.Int32
- dockerClient := newVolumeUsageTestClientInternal(t, func(w http.ResponseWriter, r *http.Request) {
- requests.Add(1)
- startedOnce.Do(func() { close(started) })
- select {
- case <-release:
- writeVolumeUsageResponseInternal(t, w, "shared", 42)
- case <-r.Context().Done():
- }
- })
-
- firstResult := make(chan error, 1)
- go func() {
- ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second)
- defer cancel()
- _, err := GetVolumeUsageData(ctx, dockerClient)
- firstResult <- err
- }()
-
- select {
- case <-started:
- case <-time.After(time.Second):
- require.FailNow(t, "volume usage refresh did not start")
- }
-
- waiterCtx, waiterCancel := context.WithTimeout(t.Context(), 20*time.Millisecond)
- defer waiterCancel()
- waiterStartedAt := time.Now()
- _, err := GetVolumeUsageData(waiterCtx, dockerClient)
- require.ErrorIs(t, err, context.DeadlineExceeded)
- require.Less(t, time.Since(waiterStartedAt), 250*time.Millisecond)
-
- close(release)
- require.NoError(t, <-firstResult)
- require.Equal(t, int32(1), requests.Load())
- })
-
- t.Run("serves stale data while one refresh runs", func(t *testing.T) {
- resetVolumeUsageCacheForTestInternal()
-
- secondStarted := make(chan struct{})
- releaseSecond := make(chan struct{})
- var requests atomic.Int32
- dockerClient := newVolumeUsageTestClientInternal(t, func(w http.ResponseWriter, r *http.Request) {
- requestNumber := requests.Add(1)
- if requestNumber == 1 {
- writeVolumeUsageResponseInternal(t, w, "stale", 10)
- return
- }
- if requestNumber == 2 {
- close(secondStarted)
- }
- select {
- case <-releaseSecond:
- writeVolumeUsageResponseInternal(t, w, "fresh", 20)
- case <-r.Context().Done():
- }
- })
-
- ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second)
- defer cancel()
- _, err := GetVolumeUsageData(ctx, dockerClient)
- require.NoError(t, err)
-
- key := volumeUsageCacheKeyInternal(dockerClient)
- cached, found := volumeUsageCache.Peek(key)
- require.True(t, found)
- volumeUsageCache.SetWithTTL(key, cached, time.Nanosecond)
- time.Sleep(time.Millisecond)
-
- startedAt := time.Now()
- stale, found := GetVolumeUsageDataStaleWhileRevalidate(ctx, dockerClient).Get()
- require.True(t, found)
- require.Len(t, stale, 1)
- require.Equal(t, "stale", stale[0].Name)
- require.Less(t, time.Since(startedAt), 250*time.Millisecond)
-
- select {
- case <-secondStarted:
- case <-time.After(time.Second):
- require.FailNow(t, "background volume usage refresh did not start")
- }
- _, _ = GetVolumeUsageDataStaleWhileRevalidate(ctx, dockerClient).Get()
- require.Equal(t, int32(2), requests.Load())
-
- close(releaseSecond)
- fresh, err := GetVolumeUsageData(ctx, dockerClient)
- require.NoError(t, err)
- require.Len(t, fresh, 1)
- require.Equal(t, "fresh", fresh[0].Name)
- })
-
- t.Run("isolates and invalidates by daemon host", func(t *testing.T) {
- resetVolumeUsageCacheForTestInternal()
-
- clientA := newVolumeUsageTestClientInternal(t, func(w http.ResponseWriter, _ *http.Request) {
- writeVolumeUsageResponseInternal(t, w, "host-a", 1)
- })
- clientB := newVolumeUsageTestClientInternal(t, func(w http.ResponseWriter, _ *http.Request) {
- writeVolumeUsageResponseInternal(t, w, "host-b", 2)
- })
-
- ctx, cancel := context.WithTimeout(t.Context(), 2*time.Second)
- defer cancel()
- _, err := GetVolumeUsageData(ctx, clientA)
- require.NoError(t, err)
- _, err = GetVolumeUsageData(ctx, clientB)
- require.NoError(t, err)
-
- cachedA, foundA := volumeUsageCache.Peek(volumeUsageCacheKeyInternal(clientA))
- cachedB, foundB := volumeUsageCache.Peek(volumeUsageCacheKeyInternal(clientB))
- require.True(t, foundA)
- require.True(t, foundB)
- require.Equal(t, "host-a", cachedA[0].Name)
- require.Equal(t, "host-b", cachedB[0].Name)
-
- InvalidateVolumeUsageCache(clientA)
- _, foundA = volumeUsageCache.Peek(volumeUsageCacheKeyInternal(clientA))
- cachedB, foundB = volumeUsageCache.Peek(volumeUsageCacheKeyInternal(clientB))
- require.False(t, foundA)
- require.True(t, foundB)
- require.Equal(t, "host-b", cachedB[0].Name)
- })
-}
-
-func newVolumeUsageTestClientInternal(t *testing.T, handler http.HandlerFunc) *client.Client {
- t.Helper()
-
- server := httptest.NewServer(handler)
- t.Cleanup(server.Close)
-
- dockerClient, err := client.New(
- client.WithHost(server.URL),
- client.WithAPIVersion("1.55"),
- )
- require.NoError(t, err)
- t.Cleanup(func() { require.NoError(t, dockerClient.Close()) })
- return dockerClient
-}
-
-func writeVolumeUsageResponseInternal(t *testing.T, w http.ResponseWriter, name string, size int64) {
- t.Helper()
- w.Header().Set("Content-Type", "application/json")
- _, err := fmt.Fprintf(w, `{"VolumeUsage":{"Items":[{"Name":%q,"UsageData":{"Size":%d,"RefCount":1}}]}}`, name, size)
- require.NoError(t, err)
-}
-
-func resetVolumeUsageCacheForTestInternal() {
- volumeUsageCache.Purge()
-}
diff --git a/backend/pkg/dockerutil/volume_workspace_test.go b/backend/pkg/dockerutil/volume_workspace_test.go
deleted file mode 100644
index 665f14164..000000000
--- a/backend/pkg/dockerutil/volume_workspace_test.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package docker
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestValidateVolumeWorkspaceHelperSupport(t *testing.T) {
- require.NoError(t, ValidateVolumeWorkspaceHelperSupport("data", nil))
- require.NoError(t, ValidateVolumeWorkspaceHelperSupport("data", map[string]string{"type": "nfs"}))
- require.Error(t, ValidateVolumeWorkspaceHelperSupport("data", map[string]string{"type": "none"}))
- require.Error(t, ValidateVolumeWorkspaceHelperSupport("data", map[string]string{"o": "bind,rw"}))
-}
diff --git a/backend/pkg/libarcane/volumes/volume_rename.go b/backend/pkg/libarcane/volumes/volume_rename.go
index 6ffc90dca..4ab679274 100644
--- a/backend/pkg/libarcane/volumes/volume_rename.go
+++ b/backend/pkg/libarcane/volumes/volume_rename.go
@@ -15,9 +15,9 @@ import (
volumetypes "github.com/getarcaneapp/arcane/types/v2/volume"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
kit "go.getarcane.app/kit/pkg"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumehelper"
)
@@ -121,7 +121,7 @@ func (m *dockerProjectVolumeRenameMigrationInternal) Apply(ctx context.Context)
}
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
slog.InfoContext(ctx, "copied project compose volumes for rename", "oldProject", m.oldComposeName, "newProject", m.newComposeName, "count", len(m.entries))
return nil
}
@@ -147,7 +147,7 @@ func (m *dockerProjectVolumeRenameMigrationInternal) Commit(ctx context.Context)
m.removedOld = append(m.removedOld, entry)
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
slog.InfoContext(ctx, "renamed project compose volumes", "oldProject", m.oldComposeName, "newProject", m.newComposeName, "count", len(m.entries))
return nil
}
@@ -230,7 +230,7 @@ func (m *dockerProjectVolumeRenameMigrationInternal) Rollback(ctx context.Contex
rollbackErr = errors.Join(rollbackErr, m.rollbackCreatedTargetsPreservingInternal(ctx, dockerClient, preservedTargets))
if rollbackErr == nil {
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
}
return rollbackErr
}
@@ -274,7 +274,7 @@ func EnsureRenameTargetAbsent(ctx context.Context, dockerClient *client.Client,
}
func EnsureRenameSourceDetached(ctx context.Context, dockerClient *client.Client, oldName string) error {
- containerIDs, err := dockerutil.GetContainersUsingVolume(ctx, dockerClient, oldName)
+ containerIDs, err := docker.GetContainersUsingVolume(ctx, dockerClient, oldName)
if err != nil {
return fmt.Errorf("inspect containers using source volume %s: %w", oldName, err)
}
@@ -503,7 +503,7 @@ func RemoveSourceVolumes(ctx context.Context, dockerClient *client.Client, volum
return NewSourceCleanupError(vol.OldName, err)
}
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
return nil
}
@@ -515,7 +515,7 @@ func RollbackVolumes(ctx context.Context, dockerClient *client.Client, volumes [
}
}
if len(volumes) > 0 {
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
}
return rollbackErr
}
diff --git a/backend/pkg/libarcane/vuln/driver.go b/backend/pkg/libarcane/vuln/driver.go
index 452258eed..274371c2f 100644
--- a/backend/pkg/libarcane/vuln/driver.go
+++ b/backend/pkg/libarcane/vuln/driver.go
@@ -25,9 +25,9 @@ import (
containertypes "github.com/moby/moby/api/types/container"
mounttypes "github.com/moby/moby/api/types/mount"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
kit "go.getarcane.app/kit/pkg"
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
)
@@ -316,7 +316,7 @@ func ReadStartupLogs(ctx context.Context, dockerClient *client.Client, container
var stdoutBuf bytes.Buffer
var stderrBuf bytes.Buffer
- if _, stdCopyErr := stdcopy.StdCopy(&stdoutBuf, &stderrBuf, logs); stdCopyErr != nil && !dockerutils.IsExpectedStreamEndError(stdCopyErr) {
+ if _, stdCopyErr := stdcopy.StdCopy(&stdoutBuf, &stderrBuf, logs); stdCopyErr != nil && !docker.IsExpectedStreamEndError(stdCopyErr) {
slog.DebugContext(ctx, "failed to decode trivy startup logs", "containerId", containerID, "error", stdCopyErr)
}
@@ -496,7 +496,7 @@ func ReadOutputFromContainerFile(ctx context.Context, dockerClient *client.Clien
}
archiveReader := copyResult.Content
defer func() {
- if closeErr := archiveReader.Close(); closeErr != nil && !dockerutils.IsExpectedStreamEndError(closeErr) {
+ if closeErr := archiveReader.Close(); closeErr != nil && !docker.IsExpectedStreamEndError(closeErr) {
slog.WarnContext(ctx,
"failed to close trivy output archive stream",
"containerId", containerID,
diff --git a/backend/pkg/projects/cmds.go b/backend/pkg/projects/cmds.go
index 8c526e14d..f7d8b9ab1 100644
--- a/backend/pkg/projects/cmds.go
+++ b/backend/pkg/projects/cmds.go
@@ -14,9 +14,9 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
kit "go.getarcane.app/kit/pkg"
- docker "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
)
@@ -28,7 +28,7 @@ const defaultComposeTimeout = 30 * time.Minute
// detachFromHTTPContextInternal creates a new context derived from
// context.WithoutCancel(parent) that carries any values from the parent
-// (such as dockerutils.ProgressWriterKey) but is **not** cancelled or
+// (such as types.ProgressWriterKey) but is **not** cancelled or
// deadline-bounded by the parent. This allows compose operations to survive
// HTTP request timeouts and proxy deadline cancellations. A standalone timeout
// is applied so the operation cannot run forever. See #1209.
diff --git a/backend/pkg/projects/compose.go b/backend/pkg/projects/compose.go
index 725bbdec6..44e6f5086 100644
--- a/backend/pkg/projects/compose.go
+++ b/backend/pkg/projects/compose.go
@@ -17,10 +17,10 @@ import (
"github.com/docker/compose/v5/pkg/compose"
"github.com/moby/moby/api/types/registry"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
+ "go.getarcane.app/docker/types"
kit "go.getarcane.app/kit/pkg"
-
- dockerutils "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
)
type Client struct {
@@ -84,8 +84,8 @@ func NewClient(ctx context.Context, dockerHost string, authConfigs map[string]re
// When the caller streams operation output, render compose's own progress
// events exactly as `docker compose --progress=plain` prints them.
var logWriter io.WriteCloser
- if progressWriter, ok := ctx.Value(dockerutils.ProgressWriterKey{}).(io.Writer); ok && progressWriter != nil {
- logWriter = dockerutils.NewLogLineWriter(progressWriter)
+ if progressWriter, ok := ctx.Value(types.ProgressWriterKey{}).(io.Writer); ok && progressWriter != nil {
+ logWriter = docker.NewLogLineWriter(progressWriter)
}
if prompt == nil {
diff --git a/backend/pkg/projects/volume_migration.go b/backend/pkg/projects/volume_migration.go
index 046409032..647da520c 100644
--- a/backend/pkg/projects/volume_migration.go
+++ b/backend/pkg/projects/volume_migration.go
@@ -17,9 +17,9 @@ import (
projecttypes "github.com/getarcaneapp/arcane/types/v2/project"
volumetypes "github.com/getarcaneapp/arcane/types/v2/volume"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.yaml.in/yaml/v4"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/volumes"
)
@@ -419,6 +419,6 @@ func CleanupRenameRollbackTargets(ctx context.Context, cleanup *projecttypes.Ren
return cleanupRollbackTargetVolumesErr
}
- dockerutil.InvalidateVolumeUsageCache(dockerClient)
+ docker.InvalidateVolumeUsageCache(dockerClient)
return operations.ClearRollbackCleanup(ctx, cleanup.ProjectID)
}
diff --git a/backend/pkg/scheduler/auto_heal_job.go b/backend/pkg/scheduler/auto_heal_job.go
index 5b4d8812f..1ee282ad5 100644
--- a/backend/pkg/scheduler/auto_heal_job.go
+++ b/backend/pkg/scheduler/auto_heal_job.go
@@ -14,17 +14,17 @@ import (
schedulertypes "github.com/getarcaneapp/arcane/types/v2/scheduler"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
+ "go.getarcane.app/docker"
"go.getarcane.app/docker/compat"
kit "go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/cgroup"
"golang.org/x/sync/errgroup"
"github.com/getarcaneapp/arcane/backend/v2/internal/database"
- "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
+ dockerInternal "github.com/getarcaneapp/arcane/backend/v2/internal/docker"
"github.com/getarcaneapp/arcane/backend/v2/internal/event"
"github.com/getarcaneapp/arcane/backend/v2/internal/notification"
"github.com/getarcaneapp/arcane/backend/v2/internal/settings"
- dockerutil "github.com/getarcaneapp/arcane/backend/v2/pkg/dockerutil"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/scheduler/jobcontext"
"github.com/getarcaneapp/arcane/backend/v2/pkg/scheduler/runs"
@@ -56,7 +56,7 @@ type restartRecord struct {
}
type AutoHealJob struct {
- dockerClientService *docker.DockerClientService
+ dockerClientService *dockerInternal.DockerClientService
settingsService *settings.SettingsService
eventService *event.EventService
notificationService *notification.NotificationService
@@ -76,7 +76,7 @@ type AutoHealJob struct {
}
func NewAutoHealJob(
- dockerClientService *docker.DockerClientService,
+ dockerClientService *dockerInternal.DockerClientService,
settingsService *settings.SettingsService,
eventService *event.EventService,
notificationService *notification.NotificationService,
@@ -223,7 +223,7 @@ func (j *AutoHealJob) filterCandidatesInternal(containers []container.Summary, e
continue
}
- containerName := dockerutil.ContainerNameFromNames(c.Names)
+ containerName := docker.ContainerNameFromNames(c.Names)
if j.isExcluded(containerName, excludedContainers) {
continue
}
@@ -251,7 +251,7 @@ func (j *AutoHealJob) processCandidateInternal(
}
}
}
- containerName := dockerutil.ContainerNameFromNames(candidate.Names)
+ containerName := docker.ContainerNameFromNames(candidate.Names)
// The daemon-side health filter already selected unhealthy containers; the
// inspect re-confirms right before restarting so a container that recovered
diff --git a/cli/go.mod b/cli/go.mod
index fac04f6ca..ac60720d7 100644
--- a/cli/go.mod
+++ b/cli/go.mod
@@ -21,8 +21,8 @@ require (
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.12.1
go.getarcane.app/acfs v0.6.2
- go.getarcane.app/kit v0.3.2
- go.getarcane.app/sys/bytes v0.2.1
+ go.getarcane.app/kit v0.4.0
+ go.getarcane.app/sys/bytes v0.3.0
go.yaml.in/yaml/v4 v4.0.0-rc.6
)
@@ -74,7 +74,7 @@ require (
github.com/sirupsen/logrus v1.10.2 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
- go.getarcane.app/builds v0.4.3 // indirect
+ go.getarcane.app/builds v0.4.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 // indirect
go.opentelemetry.io/otel v1.46.0 // indirect
diff --git a/cli/go.sum b/cli/go.sum
index b09d5aa82..961707f3c 100644
--- a/cli/go.sum
+++ b/cli/go.sum
@@ -137,12 +137,12 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
go.getarcane.app/acfs v0.6.2 h1:5cO8uWPz16lg+aP/iQe+k5IIDTToccCqoakwoDfUOOE=
go.getarcane.app/acfs v0.6.2/go.mod h1:Z+0Gs4LGNjvGMLq+TKv/oGKh29FRbAH6mcVPwY5KhFI=
-go.getarcane.app/builds v0.4.3 h1:GCxkZlPzpWk5OwCxAqqI4XII0MMowBSjfEYZWtEiH9I=
-go.getarcane.app/builds v0.4.3/go.mod h1:Mzxkcl7S3zb9c206K+IDrU0vpjati4D+6i2k9RvwoqE=
-go.getarcane.app/kit v0.3.2 h1:L7CAvGawDg70K/vVxDeM2xZBCHqwuthc9B5OwQwL0Hc=
-go.getarcane.app/kit v0.3.2/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
-go.getarcane.app/sys/bytes v0.2.1 h1:Mm/VV1FAde3bVvzmSBxB7HVGkj7ZUw2Gbl1DPcUhlEo=
-go.getarcane.app/sys/bytes v0.2.1/go.mod h1:fcMYM7dknLk+KDXYAg6XOfRF22POYxcTnQeypFEjDbE=
+go.getarcane.app/builds v0.4.4 h1:r9e97gmG2vic6kZB1UfTp9vSpqb1nPYA6CBlbaCvH64=
+go.getarcane.app/builds v0.4.4/go.mod h1:8B6z4dKZqE36Y+Rpudx7AIL3BXeIoqsMgrJQepRKeds=
+go.getarcane.app/kit v0.4.0 h1:3PqyAmBfp07ZOK1ztCwS6vuOzQKFtXeMbk+P0oxhIK4=
+go.getarcane.app/kit v0.4.0/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
+go.getarcane.app/sys/bytes v0.3.0 h1:hkei6a52Gz/SdezCj7jj14Hc90Tkw4g1dNVZdpYWhMs=
+go.getarcane.app/sys/bytes v0.3.0/go.mod h1:fcMYM7dknLk+KDXYAg6XOfRF22POYxcTnQeypFEjDbE=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 h1:3g7B90UzBltIDKq1/5mrTGxTnOFDV0ICOhLoxiZ8jlg=
diff --git a/go.work.sum b/go.work.sum
index 16ad445e6..ccc2035fb 100644
--- a/go.work.sum
+++ b/go.work.sum
@@ -540,6 +540,7 @@ github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cq
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
+github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d h1:hi6J4K6DKrR4/ljxn6SF6nURyu785wKMuQcjt7H3VCQ=
github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
@@ -827,7 +828,6 @@ github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4p
github.com/aws/smithy-go v1.27.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/aws/smithy-go v1.27.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/aws/smithy-go v1.27.4/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
-github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E=
github.com/aymanbagabas/go-udiff v0.4.0/go.mod h1:0L9PGwj20lrtmEMeyw4WKJ/TMyDtvAoK9bf2u/mNo3w=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
@@ -1338,6 +1338,7 @@ github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyM
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo=
github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
+github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433 h1:vymEbVwYFP/L05h5TKQxvkXoKxNvTpjxYKdF1Nlwuao=
github.com/go-json-experiment/json v0.0.0-20260214004413-d219187c3433/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
@@ -1352,6 +1353,7 @@ github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg=
+github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-openapi/analysis v0.25.5 h1:xPYEvTb90o1y0epuiOPAoG4QqahjP3cdp5xNlHeKJRI=
github.com/go-openapi/analysis v0.25.5/go.mod h1:d3UGtQC5uq5Kqqqis2VH09Km/v3vwsWrYkbp4gdm+Rc=
github.com/go-openapi/errors v0.22.8 h1:oP7sW7TWc3wFFjrzzj0nI83H2qMBkNjNfSd+XRejk/I=
@@ -1859,7 +1861,8 @@ github.com/klauspost/compress v1.18.7/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl
github.com/klauspost/compress v1.19.0/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
-github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
+github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
+github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=
@@ -2141,7 +2144,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8=
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
@@ -2371,7 +2373,6 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
-github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 h1:V7x0hCAgL8lNGezuex1RW1sh7VXXCqfw8nXZti66iFg=
github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
@@ -2402,7 +2403,6 @@ github.com/samber/slog-echo/v2 v2.0.0/go.mod h1:62kVIOBLr3qx9dIcUMlS+zu7e5YN3aKX
github.com/samber/slog-gin v1.21.1/go.mod h1:7R4VMQGENllRLLnwGyoB5nUSB+qzxThpGe5G02xla6o=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
-github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU=
@@ -2804,6 +2804,7 @@ go.getarcane.app/builds v0.3.1 h1:jymgkbcJ98o+XM9P0Ympn7m3WowWhG3vbiVwxIhhwns=
go.getarcane.app/builds v0.3.1/go.mod h1:MJXC3VNSspckX6NBu+l7kBaCckuNsXIw4B8WAuxXo94=
go.getarcane.app/builds v0.4.0 h1:i6qHFy1/xuGkKYYXPeNtS7Y/pyNb9ITVr4rnP04a2Kg=
go.getarcane.app/builds v0.4.0/go.mod h1:E+t7XCQo0b2lK1yMGMlKEgTIyd4c9IMvVx8tPX6AYBo=
+go.getarcane.app/builds v0.4.3/go.mod h1:Mzxkcl7S3zb9c206K+IDrU0vpjati4D+6i2k9RvwoqE=
go.getarcane.app/docker/convert v0.1.0 h1:prlIOs6dMx6CdnetsJFZ6ak0vcistM3DcH5lrZiFHBU=
go.getarcane.app/docker/convert v0.1.0/go.mod h1:o9y4z/vah8HiHFtI+jJVFHbs8nLrkARYt88OaUlvGig=
go.getarcane.app/docker/convert v0.2.0 h1:Mj72F0SkgPxrlDujjHZTnSdzqwyx7PqZwskiIwm1qts=
@@ -2814,6 +2815,8 @@ go.getarcane.app/kit v0.1.0 h1:82oO/i1fS4xbzAG4Xc8ALOWOwW4kwQYDdBpVHE19QkI=
go.getarcane.app/kit v0.1.0/go.mod h1:oiH4hLowxfQYFtmldyk/y79XYBHYfzgd86MrSQS9UEg=
go.getarcane.app/kit v0.2.0 h1:3PPHo5nHuns1vjqmCMFPFdnmbH/qQOserONCba/gBi4=
go.getarcane.app/kit v0.2.0/go.mod h1:TGqQCbAJs3ldzkFncXZ93wTVSDhAMQlqyNdVO2CNjIk=
+go.getarcane.app/kit v0.3.2/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
+go.getarcane.app/kit v0.3.3/go.mod h1:KTjbXTEeC3i9e1QxZowDJWjFyABlD6UF3ISVtoIZs10=
go.getarcane.app/streams v0.4.0 h1:MtBX1SVgt3nrcRNr5SYAvckGp9a5qeSjMTw/LAGwlzk=
go.getarcane.app/streams v0.4.0/go.mod h1:LHMKblQvsL1nqKh/Y+KgQbwFSMI2I7bs9u8ZwZqzjnQ=
go.getarcane.app/streams v0.4.2 h1:+xrRHiOt25cLbFTDpPLzv7eFkk7biwDz5YjBXkbWUPw=
@@ -2843,8 +2846,6 @@ go.getarcane.app/updater v0.8.0 h1:8R79Pxj9jiH9NBRwvGJAeiG1DFcdwATKM8MN/V6Sz2Q=
go.getarcane.app/updater v0.8.0/go.mod h1:Hci6Hziz1tublccxm48pKvhxmmg0n3GC6tPMu4bYl3c=
go.getarcane.app/updater v0.9.1 h1:kQsBIKRAEsCv1xgt7BMClStuNDj8JB2TrjY4djhgTa4=
go.getarcane.app/updater v0.9.1/go.mod h1:rMRAzw2KX5S8Ptjs4HAoN7inIHqxdSFsCHcrQWWK+vw=
-go.getarcane.app/updater v0.11.2 h1:W3zvb2LZ1QgYeKrK6vbFK4MqfUQHgD4Pe2s1aLO9JNM=
-go.getarcane.app/updater v0.11.2/go.mod h1:hCzKPVcZvPkkIgC568RagIB/DRytQLbhC1Q06uVzJx8=
go.lsp.dev/jsonrpc2 v0.10.0 h1:Pr/YcXJoEOTMc/b6OTmcR1DPJ3mSWl/SWiU1Cct6VmI=
go.lsp.dev/jsonrpc2 v0.10.0/go.mod h1:fmEzIdXPi/rf6d4uFcayi8HpFP1nBF99ERP1htC72Ac=
go.lsp.dev/pkg v0.0.0-20210717090340-384b27a52fb2 h1:hCzQgh6UcwbKgNSRurYWSqh8MufqRRPODRBblutn4TE=
@@ -3034,6 +3035,7 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
+golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
@@ -3047,7 +3049,6 @@ golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGb
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
-golang.org/x/crypto v0.56.0/go.mod h1:OMW5y6CY9l38uPLmxU6l6pwcXp1obtLo3e6gT7gQR2I=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
@@ -3127,13 +3128,11 @@ golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ=
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
-golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo=
golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
-golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/perf v0.0.0-20250813145418-2f7363a06fe1/go.mod h1:rjfRjhHXb3XNVh/9i5Jr2tXoTd0vOlZN5rzsM8cQE6k=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -3147,6 +3146,7 @@ golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
@@ -3245,11 +3245,13 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
+golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=
golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk=
golang.org/x/term v0.44.0/go.mod h1:7ze4MdzUzLXpSAoFP1H0bOI9aXDqveSvatT5vKcFh2Y=
+golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
@@ -3277,7 +3279,6 @@ golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
-golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
@@ -3428,7 +3429,6 @@ google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zN
google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
-google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 h1:/WILD1UcXj/ujCxgoL/DvRgt2CP3txG8+FwkUbb9110=
@@ -3599,6 +3599,7 @@ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y=
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
+k8s.io/utils v0.0.0-20260626114624-be93311217bd/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk=
kernel.org/pub/linux/libs/security/libcap/cap v1.2.76 h1:mrdLPj8ujM6eIKGtd1PkkuCIodpFFDM42Cfm0YODkIM=
kernel.org/pub/linux/libs/security/libcap/cap v1.2.76/go.mod h1:7V2BQeHnVAQwhCnCPJ977giCeGDiywVewWF+8vkpPlc=
kernel.org/pub/linux/libs/security/libcap/cap v1.2.77 h1:iQtQTjFUOcTT19fI8sTCzYXsjeVs56et3D8AbKS2Uks=
diff --git a/types/go.mod b/types/go.mod
index 673a7e668..d2fc1ccf1 100644
--- a/types/go.mod
+++ b/types/go.mod
@@ -8,7 +8,7 @@ require (
github.com/moby/moby/api v1.56.1
github.com/moby/moby/client v0.6.1
github.com/stretchr/testify v1.12.1
- go.getarcane.app/builds v0.4.3
+ go.getarcane.app/builds v0.4.4
)
require (
diff --git a/types/go.sum b/types/go.sum
index e044c9a29..dd76d05e0 100644
--- a/types/go.sum
+++ b/types/go.sum
@@ -45,8 +45,8 @@ github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWD
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
-go.getarcane.app/builds v0.4.3 h1:GCxkZlPzpWk5OwCxAqqI4XII0MMowBSjfEYZWtEiH9I=
-go.getarcane.app/builds v0.4.3/go.mod h1:Mzxkcl7S3zb9c206K+IDrU0vpjati4D+6i2k9RvwoqE=
+go.getarcane.app/builds v0.4.4 h1:r9e97gmG2vic6kZB1UfTp9vSpqb1nPYA6CBlbaCvH64=
+go.getarcane.app/builds v0.4.4/go.mod h1:8B6z4dKZqE36Y+Rpudx7AIL3BXeIoqsMgrJQepRKeds=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 h1:3g7B90UzBltIDKq1/5mrTGxTnOFDV0ICOhLoxiZ8jlg=