Skip to content

Modern Docker Management, Designed for Everyone

fix: warn when running deprecated Arcane images (#4585)

Kyle Mendell6d05562c3b51
diff --git a/backend/internal/bootstrap/bootstrap.go b/backend/internal/bootstrap/bootstrap.go
index 79ec3e628..b25ed29de 100644
--- a/backend/internal/bootstrap/bootstrap.go
+++ b/backend/internal/bootstrap/bootstrap.go
@@ -16,6 +16,7 @@ import (
"github.com/labstack/echo/v5"
"github.com/moby/moby/client"
"github.com/subosito/gotenv"
+ kit "go.getarcane.app/kit/pkg"
"go.getarcane.app/sys/crypto"
"go.opentelemetry.io/contrib/bridges/otelslog"
"go.uber.org/fx"
@@ -39,6 +40,7 @@ import (
"github.com/getarcaneapp/arcane/backend/v2/internal/variable"
"github.com/getarcaneapp/arcane/backend/v2/internal/volume"
"github.com/getarcaneapp/arcane/backend/v2/internal/vulnerability"
+ "github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/edge"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/startup"
"github.com/getarcaneapp/arcane/backend/v2/pkg/libarcane/timeouts"
@@ -317,6 +319,15 @@ func initializeStartupState(p initializeStartupStateParams) {
})
return err
})
+ startup.WarnDeprecatedImage(dockerCtx, func(ctx context.Context) (string, error) {
+ return p.Docker.Call(ctx, func(ctx context.Context, dockerClient *client.Client) (string, error) {
+ self, err := libarcane.InspectCurrentArcaneContainer(ctx, dockerClient)
+ if err != nil {
+ return "", err
+ }
+ return kit.FromPtr(self.Config).Image, nil
+ })
+ })
if err := p.Swarm.SyncSwarmEnabledState(dockerCtx); err != nil {
slog.WarnContext(appCtx, "Failed to persist swarm enabled state", "error", err)
}
diff --git a/backend/pkg/libarcane/startup/startup.go b/backend/pkg/libarcane/startup/startup.go
index 4acd8634f..a3c225381 100644
--- a/backend/pkg/libarcane/startup/startup.go
+++ b/backend/pkg/libarcane/startup/startup.go
@@ -6,6 +6,7 @@ import (
"os"
"runtime/debug"
+ "github.com/distribution/reference"
"go.getarcane.app/sys/cgroup"
"github.com/getarcaneapp/arcane/backend/v2/buildables"
@@ -94,6 +95,28 @@ func TestDockerConnection(ctx context.Context, testFunc func(context.Context) er
}
}
+var deprecatedImageReplacements = map[string]string{
+ "ghcr.io/getarcaneapp/arcane": "ghcr.io/getarcaneapp/manager",
+ "ghcr.io/getarcaneapp/arcane-headless": "ghcr.io/getarcaneapp/agent",
+}
+
+func WarnDeprecatedImage(ctx context.Context, imageFunc func(context.Context) (string, error)) {
+ imageRef, err := imageFunc(ctx)
+ if err != nil {
+ slog.DebugContext(ctx, "Could not detect Arcane container image for deprecation check", "error", err)
+ return
+ }
+
+ named, err := reference.ParseNormalizedNamed(imageRef)
+ if err != nil {
+ return
+ }
+
+ if replacement, ok := deprecatedImageReplacements[named.Name()]; ok {
+ slog.WarnContext(ctx, "This Arcane image is deprecated and will be removed in v3; switch to the replacement image", "image", imageRef, "replacement", replacement)
+ }
+}
+
func CleanupOrphanedVolumeHelpers(ctx context.Context, cleanupFunc func(context.Context) (int, error)) {
if cleanupFunc == nil {
return