Skip to content

Modern Docker Management, Designed for Everyone

chore(deps): align some backend dependencies to avoid tranisent imports (#3068)

Kyle Mendellb6d2639c0313
diff --git a/backend/go.mod b/backend/go.mod
index 25f8d9686..57da3648c 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -28,7 +28,6 @@ require (
github.com/getarcaneapp/arcane/types/v2 v2.1.0
github.com/glebarez/sqlite v1.11.0
github.com/go-git/go-git/v5 v5.19.1
- github.com/goccy/go-yaml v1.19.2
github.com/gofrs/flock v0.13.0
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/go-containerregistry v0.21.6
@@ -36,7 +35,6 @@ require (
github.com/google/wire v0.7.0
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
github.com/jinzhu/copier v0.4.0
- github.com/joho/godotenv v1.5.1
github.com/klauspost/compress v1.18.6
github.com/labstack/echo/v4 v4.15.4
github.com/lmittmann/tint v1.1.3
@@ -53,9 +51,11 @@ require (
github.com/shirou/gopsutil/v4 v4.26.5
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
+ github.com/subosito/gotenv v1.6.0
github.com/wneessen/go-mail v0.7.3
go.getarcane.app/builds v0.1.0
go.getarcane.app/updater v0.4.0
+ go.yaml.in/yaml/v4 v4.0.0-rc.4
golang.org/x/crypto v0.53.0
golang.org/x/mod v0.37.0
golang.org/x/net v0.56.0
@@ -218,7 +218,6 @@ require (
go.opentelemetry.io/otel/trace v1.44.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
- go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/term v0.44.0 // indirect
golang.org/x/tools v0.45.0 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index a6efd012d..0c26e5172 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -243,8 +243,6 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
-github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
-github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw=
github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0=
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
@@ -312,8 +310,6 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
-github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
-github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I=
github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60=
github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY=
@@ -494,6 +490,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
+github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
+github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/theupdateframework/go-tuf v0.7.0 h1:CqbQFrWo1ae3/I0UCblSbczevCCbS31Qvs5LdxRWqRI=
github.com/theupdateframework/go-tuf/v2 v2.4.2 h1:w7976/W8uTwlsegP5nRymlpjPgrwSh+AXUf85is6nJk=
github.com/theupdateframework/go-tuf/v2 v2.4.2/go.mod h1:JqBrIUnNLAaNq/8GmBcEMFWfAFBbqp/MkJEJseXKbks=
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index 699cad517..ca1e92af9 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -14,8 +14,8 @@ import (
"syscall"
"time"
- "github.com/joho/godotenv"
"github.com/moby/moby/client"
+ "github.com/subosito/gotenv"
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
"github.com/getarcaneapp/arcane/backend/v2/internal/di"
@@ -32,7 +32,9 @@ import (
)
func Bootstrap(ctx context.Context) error {
- _ = godotenv.Load()
+ if err := gotenv.Load(); err != nil && !errors.Is(err, os.ErrNotExist) {
+ return fmt.Errorf("load .env: %w", err)
+ }
cfg := config.Load()
runtimeIdentityCfg := &startup.RuntimeIdentityConfig{
PUID: cfg.PUID,
diff --git a/backend/internal/database/database_test.go b/backend/internal/database/database_test.go
index 89c759b4b..f3d6f717f 100644
--- a/backend/internal/database/database_test.go
+++ b/backend/internal/database/database_test.go
@@ -463,17 +463,17 @@ func TestSQLiteMigrations_DownUpRoundTrip(t *testing.T) {
// '-- +goose Down' marker (the Up section) and the text after it (the Down section).
func gooseUpDownSectionsInternal(content string) (up, down string) {
const downMarker = "-- +goose Down"
- idx := strings.Index(content, downMarker)
- if idx < 0 {
+ before, after, ok := strings.Cut(content, downMarker)
+ if !ok {
return content, ""
}
- return content[:idx], content[idx+len(downMarker):]
+ return before, after
}
// sectionHasSQLInternal reports whether a migration section contains at least one
// non-comment, non-blank line (i.e. an actual statement rather than only comments).
func sectionHasSQLInternal(section string) bool {
- for _, line := range strings.Split(section, "\n") {
+ for line := range strings.SplitSeq(section, "\n") {
trimmed := strings.TrimSpace(line)
if trimmed == "" || strings.HasPrefix(trimmed, "--") {
continue
diff --git a/backend/internal/services/activity_service_test.go b/backend/internal/services/activity_service_test.go
index de7a2ad7e..3cec7f7d7 100644
--- a/backend/internal/services/activity_service_test.go
+++ b/backend/internal/services/activity_service_test.go
@@ -247,7 +247,7 @@ func TestActivityServicePruneHistoryByAgeAndCountInternal(t *testing.T) {
"updated_at": oldTime,
}).Error)
- for i := 0; i < 3; i++ {
+ for i := range 3 {
item, startErr := service.StartActivity(ctx, StartActivityRequest{EnvironmentID: "remote-1", Type: models.ActivityTypeResourceAction})
require.NoError(t, startErr)
_, completeErr := service.CompleteActivity(ctx, item.ID, models.ActivityStatusSuccess, "done", nil)
diff --git a/backend/internal/services/gitops_sync_service_test.go b/backend/internal/services/gitops_sync_service_test.go
index 391b1e5c6..0f33b5602 100644
--- a/backend/internal/services/gitops_sync_service_test.go
+++ b/backend/internal/services/gitops_sync_service_test.go
@@ -910,9 +910,14 @@ func setupLifecycleValidationService(t *testing.T) (*GitOpsSyncService, context.
return svc, ctx
}
-func strPtr(s string) *string { return &s }
-func intPtr(i int) *int { return &i }
-func boolPtr(b bool) *bool { return &b }
+//go:fix inline
+func strPtr(s string) *string { return new(s) }
+
+//go:fix inline
+func intPtr(i int) *int { return new(i) }
+
+//go:fix inline
+func boolPtr(b bool) *bool { return new(b) }
func TestValidateLifecycleConfig_AllNilNoError(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
@@ -924,8 +929,8 @@ func TestValidateLifecycleConfig_RejectsWhenGloballyDisabled(t *testing.T) {
ctx := context.Background()
// lifecycleEnabled defaults to false; do not enable.
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr("scripts/deploy.sh"),
- runnerImage: strPtr("alpine:latest"),
+ scriptPath: new("scripts/deploy.sh"),
+ runnerImage: new("alpine:latest"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "disabled")
@@ -934,8 +939,8 @@ func TestValidateLifecycleConfig_RejectsWhenGloballyDisabled(t *testing.T) {
func TestValidateLifecycleConfig_RejectsAbsoluteScriptPath(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr("/etc/passwd"),
- runnerImage: strPtr("alpine:latest"),
+ scriptPath: new("/etc/passwd"),
+ runnerImage: new("alpine:latest"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "relative")
@@ -944,8 +949,8 @@ func TestValidateLifecycleConfig_RejectsAbsoluteScriptPath(t *testing.T) {
func TestValidateLifecycleConfig_RejectsTraversalScriptPath(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr("../outside.sh"),
- runnerImage: strPtr("alpine:latest"),
+ scriptPath: new("../outside.sh"),
+ runnerImage: new("alpine:latest"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "escape")
@@ -958,8 +963,8 @@ func TestValidateLifecycleConfig_RejectsOverlongScriptPath(t *testing.T) {
long[i] = 'a'
}
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr(string(long)),
- runnerImage: strPtr("alpine:latest"),
+ scriptPath: new(string(long)),
+ runnerImage: new("alpine:latest"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "256")
@@ -969,7 +974,7 @@ func TestValidateLifecycleConfig_RejectsScriptWithoutRunnerImageOnCreate(t *test
svc, ctx := setupLifecycleValidationService(t)
require.NoError(t, svc.settingsService.SetStringSetting(ctx, "lifecycleDefaultRunnerImage", " "))
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr("scripts/deploy.sh"),
+ scriptPath: new("scripts/deploy.sh"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "Runner image is required")
@@ -979,18 +984,18 @@ func TestValidateLifecycleConfig_AcceptsScriptWithDefaultRunnerImageOnCreate(t *
svc, ctx := setupLifecycleValidationService(t)
require.NoError(t, svc.settingsService.SetStringSetting(ctx, "lifecycleDefaultRunnerImage", "alpine:latest"))
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- targetType: strPtr("project"),
- scriptPath: strPtr("scripts/deploy.sh"),
- syncDirectory: boolPtr(true),
+ targetType: new("project"),
+ scriptPath: new("scripts/deploy.sh"),
+ syncDirectory: new(true),
}))
}
func TestValidateLifecycleConfig_AcceptsScriptWithExistingRunnerImageOnUpdate(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
existing := &models.GitOpsSync{SyncDirectory: true}
- existing.PreDeployRunnerImage = strPtr("alpine:latest")
+ existing.PreDeployRunnerImage = new("alpine:latest")
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, existing, lifecycleConfigInputInternal{
- scriptPath: strPtr("scripts/deploy.sh"),
+ scriptPath: new("scripts/deploy.sh"),
}))
}
@@ -998,7 +1003,7 @@ func TestValidateLifecycleConfig_RejectsTimeoutZeroOrNegative(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
for _, v := range []int{0, -1, -3600} {
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- timeoutSec: intPtr(v),
+ timeoutSec: new(v),
})
require.Errorf(t, err, "expected error for timeoutSec=%d", v)
require.Contains(t, err.Error(), "at least 1")
@@ -1009,7 +1014,7 @@ func TestValidateLifecycleConfig_RejectsTimeoutAboveSettingCap(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
require.NoError(t, svc.settingsService.SetStringSetting(ctx, "lifecycleMaxTimeoutSec", "120"))
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- timeoutSec: intPtr(300),
+ timeoutSec: new(300),
})
require.Error(t, err)
require.Contains(t, err.Error(), "exceeds")
@@ -1018,7 +1023,7 @@ func TestValidateLifecycleConfig_RejectsTimeoutAboveSettingCap(t *testing.T) {
func TestValidateLifecycleConfig_RejectsInvalidEnvKey(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- env: strPtr("FOO-BAR=baz"),
+ env: new("FOO-BAR=baz"),
})
require.Error(t, err)
}
@@ -1026,14 +1031,14 @@ func TestValidateLifecycleConfig_RejectsInvalidEnvKey(t *testing.T) {
func TestValidateLifecycleConfig_AcceptsValidEnv(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- env: strPtr("FOO=bar\nBAZ_2=qux"),
+ env: new("FOO=bar\nBAZ_2=qux"),
}))
}
func TestValidateLifecycleConfig_RejectsRelativeMountSource(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- extraMounts: strPtr("relative/path:/in/container"),
+ extraMounts: new("relative/path:/in/container"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "absolute")
@@ -1042,7 +1047,7 @@ func TestValidateLifecycleConfig_RejectsRelativeMountSource(t *testing.T) {
func TestValidateLifecycleConfig_RejectsRelativeMountTarget(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- extraMounts: strPtr("/host/path:relative/target"),
+ extraMounts: new("/host/path:relative/target"),
})
require.Error(t, err)
require.Contains(t, err.Error(), "absolute")
@@ -1051,20 +1056,20 @@ func TestValidateLifecycleConfig_RejectsRelativeMountTarget(t *testing.T) {
func TestValidateLifecycleConfig_AllowsClearingScriptWithoutImage(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
existing := &models.GitOpsSync{}
- existing.PreDeployScriptPath = strPtr("scripts/old.sh")
- existing.PreDeployRunnerImage = strPtr("alpine:latest")
+ existing.PreDeployScriptPath = new("scripts/old.sh")
+ existing.PreDeployRunnerImage = new("alpine:latest")
// User clears the script (empty string in update); image clear is implied not required.
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, existing, lifecycleConfigInputInternal{
- scriptPath: strPtr(""),
+ scriptPath: new(""),
}))
}
func TestValidateLifecycleConfig_RejectsScriptWithoutSyncDirectoryOnCreate(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- scriptPath: strPtr("scripts/deploy.sh"),
- runnerImage: strPtr("alpine:latest"),
- syncDirectory: boolPtr(false),
+ scriptPath: new("scripts/deploy.sh"),
+ runnerImage: new("alpine:latest"),
+ syncDirectory: new(false),
})
require.Error(t, err)
validationErr, ok := errors.AsType[*models.ValidationError](err)
@@ -1075,20 +1080,20 @@ func TestValidateLifecycleConfig_RejectsScriptWithoutSyncDirectoryOnCreate(t *te
func TestValidateLifecycleConfig_AcceptsScriptWithSyncDirectoryOnCreate(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- targetType: strPtr("project"),
- scriptPath: strPtr("scripts/deploy.sh"),
- runnerImage: strPtr("alpine:latest"),
- syncDirectory: boolPtr(true),
+ targetType: new("project"),
+ scriptPath: new("scripts/deploy.sh"),
+ runnerImage: new("alpine:latest"),
+ syncDirectory: new(true),
}))
}
func TestValidateLifecycleConfig_RejectsLifecycleHookForSwarmStack(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
err := svc.validateLifecycleConfigInternal(ctx, nil, lifecycleConfigInputInternal{
- targetType: strPtr("swarm_stack"),
- scriptPath: strPtr("scripts/deploy.sh"),
- runnerImage: strPtr("alpine:latest"),
- syncDirectory: boolPtr(true),
+ targetType: new("swarm_stack"),
+ scriptPath: new("scripts/deploy.sh"),
+ runnerImage: new("alpine:latest"),
+ syncDirectory: new(true),
})
require.Error(t, err)
validationErr, ok := errors.AsType[*models.ValidationError](err)
@@ -1100,10 +1105,10 @@ func TestValidateLifecycleConfig_RejectsLifecycleHookForSwarmStack(t *testing.T)
func TestValidateLifecycleConfig_RejectsSwarmTargetChangeWithExistingLifecycleHook(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
existing := &models.GitOpsSync{TargetType: "project", SyncDirectory: true}
- existing.PreDeployScriptPath = strPtr("scripts/deploy.sh")
- existing.PreDeployRunnerImage = strPtr("alpine:latest")
+ existing.PreDeployScriptPath = new("scripts/deploy.sh")
+ existing.PreDeployRunnerImage = new("alpine:latest")
err := svc.validateLifecycleConfigInternal(ctx, existing, lifecycleConfigInputInternal{
- targetType: strPtr("swarm_stack"),
+ targetType: new("swarm_stack"),
})
require.Error(t, err)
validationErr, ok := errors.AsType[*models.ValidationError](err)
@@ -1116,19 +1121,19 @@ func TestValidateLifecycleConfig_AcceptsScriptWhenExistingSyncHasSyncDirectory(t
svc, ctx := setupLifecycleValidationService(t)
existing := &models.GitOpsSync{SyncDirectory: true}
require.NoError(t, svc.validateLifecycleConfigInternal(ctx, existing, lifecycleConfigInputInternal{
- scriptPath: strPtr("scripts/deploy.sh"),
- runnerImage: strPtr("alpine:latest"),
+ scriptPath: new("scripts/deploy.sh"),
+ runnerImage: new("alpine:latest"),
}))
}
func TestValidateLifecycleConfig_RejectsSyncDirectoryToggleOffWhileScriptStillSet(t *testing.T) {
svc, ctx := setupLifecycleValidationService(t)
existing := &models.GitOpsSync{SyncDirectory: true}
- existing.PreDeployScriptPath = strPtr("scripts/deploy.sh")
- existing.PreDeployRunnerImage = strPtr("alpine:latest")
+ existing.PreDeployScriptPath = new("scripts/deploy.sh")
+ existing.PreDeployRunnerImage = new("alpine:latest")
// Admin toggles syncDirectory off without clearing the script — should be rejected.
err := svc.validateLifecycleConfigInternal(ctx, existing, lifecycleConfigInputInternal{
- syncDirectory: boolPtr(false),
+ syncDirectory: new(false),
})
require.Error(t, err)
validationErr, ok := errors.AsType[*models.ValidationError](err)
diff --git a/backend/internal/services/project_service_test.go b/backend/internal/services/project_service_test.go
index f2c4b1976..daf47fe4c 100644
--- a/backend/internal/services/project_service_test.go
+++ b/backend/internal/services/project_service_test.go
@@ -3949,7 +3949,7 @@ func TestProjectService_ListProjects_WithDerivedStatusFilter_AllowsAllPageSizeSe
projectsRoot := t.TempDir()
require.NoError(t, settingsService.SetStringSetting(ctx, "projectsDirectory", projectsRoot))
- for i := 0; i < 25; i++ {
+ for i := range 25 {
projectPath := createComposeProjectDir(t, projectsRoot, fmt.Sprintf("stopped-%02d", i))
require.NoError(t, db.Create(&models.Project{
BaseModel: models.BaseModel{ID: fmt.Sprintf("project-%02d", i)},
diff --git a/backend/internal/services/system_service.go b/backend/internal/services/system_service.go
index 2c7c6734d..e905b17ed 100644
--- a/backend/internal/services/system_service.go
+++ b/backend/internal/services/system_service.go
@@ -16,10 +16,10 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
containertypes "github.com/getarcaneapp/arcane/types/v2/container"
"github.com/getarcaneapp/arcane/types/v2/system"
- "github.com/goccy/go-yaml"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
libupdater "go.getarcane.app/updater/pkg/labels"
+ "go.yaml.in/yaml/v4"
"golang.org/x/sync/errgroup"
)
diff --git a/backend/internal/services/system_service_test.go b/backend/internal/services/system_service_test.go
new file mode 100644
index 000000000..856ca7523
--- /dev/null
+++ b/backend/internal/services/system_service_test.go
@@ -0,0 +1,67 @@
+package services
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/getarcaneapp/arcane/types/v2/system"
+ "github.com/stretchr/testify/require"
+)
+
+func TestSystemServiceConvertToDockerComposeUsesAlignedYAMLFormat(t *testing.T) {
+ svc := &SystemService{}
+
+ compose, envVars, serviceName, err := svc.ConvertToDockerCompose(&system.DockerRunCommand{
+ Image: "nginx:1.27-alpine",
+ Name: "web",
+ Ports: []string{"8080:80"},
+ Volumes: []string{"data:/data"},
+ Environment: []string{"FOO=bar", "BAZ=qux"},
+ Restart: "unless-stopped",
+ Workdir: "/srv/app",
+ User: "1000:1000",
+ Entrypoint: "/entrypoint.sh",
+ Command: "nginx -g 'daemon off;'",
+ Interactive: true,
+ TTY: true,
+ Privileged: true,
+ Labels: []string{"com.example.role=frontend"},
+ HealthCheck: "curl -f http://localhost || exit 1",
+ MemoryLimit: "512m",
+ CPULimit: "0.5",
+ })
+ require.NoError(t, err)
+
+ require.Equal(t, "web", serviceName)
+ require.Equal(t, "FOO=bar\nBAZ=qux", envVars)
+ require.Equal(t, strings.TrimPrefix(`
+services:
+ web:
+ image: nginx:1.27-alpine
+ container_name: web
+ ports:
+ - 8080:80
+ volumes:
+ - data:/data
+ environment:
+ - FOO=bar
+ - BAZ=qux
+ restart: unless-stopped
+ working_dir: /srv/app
+ user: 1000:1000
+ entrypoint: /entrypoint.sh
+ command: nginx -g 'daemon off;'
+ stdin_open: true
+ tty: true
+ privileged: true
+ labels:
+ - com.example.role=frontend
+ healthcheck:
+ test: curl -f http://localhost || exit 1
+ deploy:
+ resources:
+ limits:
+ memory: 512m
+ cpus: "0.5"
+`, "\n"), compose)
+}
diff --git a/backend/pkg/authz/access_policy_test.go b/backend/pkg/authz/access_policy_test.go
index e6ab9bb9b..3bd185792 100644
--- a/backend/pkg/authz/access_policy_test.go
+++ b/backend/pkg/authz/access_policy_test.go
@@ -179,8 +179,8 @@ func frontendRoutePathInternal(routesRoot, url string) string {
parts[i] = "[" + strings.Trim(part, "{}") + "]"
continue
}
- if strings.HasPrefix(part, ":") {
- parts[i] = "[" + strings.TrimPrefix(part, ":") + "]"
+ if after, ok := strings.CutPrefix(part, ":"); ok {
+ parts[i] = "[" + after + "]"
}
}
return filepath.Join(append([]string{routesRoot}, parts...)...)
diff --git a/backend/pkg/libarcane/volumes/compose.go b/backend/pkg/libarcane/volumes/compose.go
index e812fa702..6f415c8be 100644
--- a/backend/pkg/libarcane/volumes/compose.go
+++ b/backend/pkg/libarcane/volumes/compose.go
@@ -7,7 +7,7 @@ import (
"strings"
composetemplate "github.com/compose-spec/compose-go/v2/template"
- "github.com/goccy/go-yaml"
+ "go.yaml.in/yaml/v4"
)
func composeVolumeKeysWithExplicitNameInternal(composeFiles []string) (map[string]struct{}, error) {
diff --git a/backend/pkg/libarcane/volumes/volume_rename_test_helpers_test.go b/backend/pkg/libarcane/volumes/volume_rename_test_helpers_test.go
index 81d0c9426..76e557891 100644
--- a/backend/pkg/libarcane/volumes/volume_rename_test_helpers_test.go
+++ b/backend/pkg/libarcane/volumes/volume_rename_test_helpers_test.go
@@ -14,7 +14,7 @@ func newTestDockerClient(t *testing.T, server *httptest.Server) *client.Client {
httpClient := server.Client()
cli, err := client.New(
client.WithHost(server.URL),
- client.WithVersion("1.41"),
+ client.WithAPIVersion("1.41"),
client.WithHTTPClient(httpClient),
)
require.NoError(t, err)
diff --git a/backend/pkg/projects/custom_labels.go b/backend/pkg/projects/custom_labels.go
index 0980e6635..9c5852ad5 100644
--- a/backend/pkg/projects/custom_labels.go
+++ b/backend/pkg/projects/custom_labels.go
@@ -13,7 +13,7 @@ import (
composetypes "github.com/compose-spec/compose-go/v2/types"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/getarcaneapp/arcane/backend/v2/pkg/utils/iconcatalog"
- "github.com/goccy/go-yaml"
+ "go.yaml.in/yaml/v4"
)
const (
diff --git a/backend/pkg/projects/fs_util.go b/backend/pkg/projects/fs_util.go
index 3dbc9af49..7aaa6090c 100644
--- a/backend/pkg/projects/fs_util.go
+++ b/backend/pkg/projects/fs_util.go
@@ -14,7 +14,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/config"
pkgutils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
"github.com/getarcaneapp/arcane/types/v2/project"
- "github.com/goccy/go-yaml"
+ "go.yaml.in/yaml/v4"
)
func ResolveConfiguredContainerDirectory(configuredPath, defaultPath string) string {
diff --git a/backend/pkg/projects/includes.go b/backend/pkg/projects/includes.go
index f60bf3053..05ff3e4ba 100644
--- a/backend/pkg/projects/includes.go
+++ b/backend/pkg/projects/includes.go
@@ -8,7 +8,7 @@ import (
"strings"
pkgutils "github.com/getarcaneapp/arcane/backend/v2/pkg/utils"
- "github.com/goccy/go-yaml"
+ "go.yaml.in/yaml/v4"
)
// expandEnvVarsInternal expands ${VAR} and $VAR references in a string using the provided env map.
diff --git a/backend/pkg/projects/name.go b/backend/pkg/projects/name.go
index 18d9b0888..d59e815e4 100644
--- a/backend/pkg/projects/name.go
+++ b/backend/pkg/projects/name.go
@@ -4,7 +4,7 @@ import (
"strings"
"github.com/compose-spec/compose-go/v2/loader"
- "github.com/goccy/go-yaml"
+ "go.yaml.in/yaml/v4"
)
// ComposeContentProjectName returns the normalized top-level `name:` from
diff --git a/go.work.sum b/go.work.sum
index a23d68c7a..b3462cfe0 100644
--- a/go.work.sum
+++ b/go.work.sum
@@ -1072,6 +1072,8 @@ github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PU
github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU=
github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.19.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
+github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
+github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556 h1:N/MD/sr6o61X+iZBAT2qEUF023s4KbA8RWfKzl0L6MQ=
github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
@@ -1342,6 +1344,8 @@ github.com/jmoiron/sqlx v1.3.3 h1:j82X0bf7oQ27XeqxicSZsTU5suPwKElg3oyxNn43iTk=
github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
+github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
+github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/jordanlewis/gcassert v0.0.0-20250430164644-389ef753e22e h1:a+PGEeXb+exwBS3NboqXHyxarD9kaboBbrSp+7GuBuc=
github.com/jordanlewis/gcassert v0.0.0-20250430164644-389ef753e22e/go.mod h1:ZybsQk6DWyN5t7An1MuPm1gtSZ1xDaTXS9ZjIOxvQrk=
github.com/josephspurrier/goversioninfo v1.5.0 h1:9TJtORoyf4YMoWSOo/cXFN9A/lB3PniJ91OxIH6e7Zg=
@@ -1546,7 +1550,6 @@ github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34
github.com/moby/buildkit v0.26.2/go.mod h1:ylDa7IqzVJgLdi/wO7H1qLREFQpmhFbw2fbn4yoTw40=
github.com/moby/buildkit v0.26.3/go.mod h1:4T4wJzQS4kYWIfFRjsbJry4QoxDBjK+UGOEOs1izL7w=
github.com/moby/buildkit v0.27.0/go.mod h1:4STUkNc5t1nf03HS+01UmI2X6FdfOI3XaKt9QNoTsms=
-github.com/moby/buildkit v0.31.1 h1:j3p55abBl4kiXXPZgYX+6zWgB2aefqHXoPown12fIzU=
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
github.com/moby/moby/api v1.52.0/go.mod h1:8mb+ReTlisw4pS6BRzCMts5M49W5M7bKt1cJy/YbAqc=
github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs=
@@ -2075,7 +2078,6 @@ go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA=
go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o=
go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ=
go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo=
-go.getarcane.app/builds v0.1.0/go.mod h1:3g7+969+qWH33EXnA+nu5MKhs72JYDPf9Q/OtYO6CIA=
go.getarcane.app/updater v0.3.6 h1:+BqoycaRsHj+cLVSzcYQuqbHxUKbtmaozMNblz5bVSw=
go.getarcane.app/updater v0.3.6/go.mod h1:2ENitZR/lA5MuBn60OZYR5wvU3ZCE+pAgfrebfOlRDA=
go.getarcane.app/updater v0.3.7 h1:WqHsxudvt8gvCR7iSHdxdzwH0+hM0FAh64bSypBX9Mo=