From 9bb766cf17d19bab4ebf21e1022a583949178a9f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 10 Jan 2026 02:33:59 -0500 Subject: [PATCH] fix: reference app-specific config.json for retrieving registry auths --- plugins/registry/functions.go | 8 ++++++++ plugins/scheduler-k3s/go.mod | 3 +++ plugins/scheduler-k3s/triggers.go | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/registry/functions.go b/plugins/registry/functions.go index 4c421d75d..8ef4d442f 100644 --- a/plugins/registry/functions.go +++ b/plugins/registry/functions.go @@ -25,6 +25,14 @@ func GetAppRegistryConfigPath(appName string) string { return filepath.Join(GetAppRegistryConfigDir(appName), "config.json") } +func GetComputedAppRegistryConfigDir(appName string) string { + if HasAppRegistryAuth(appName) { + return GetAppRegistryConfigDir(appName) + } + + return filepath.Join(os.Getenv("DOKKU_ROOT"), ".docker") +} + // HasAppRegistryAuth checks if an app has registry credentials configured func HasAppRegistryAuth(appName string) bool { configPath := GetAppRegistryConfigPath(appName) diff --git a/plugins/scheduler-k3s/go.mod b/plugins/scheduler-k3s/go.mod index 1ca88658d..a0f5f5870 100644 --- a/plugins/scheduler-k3s/go.mod +++ b/plugins/scheduler-k3s/go.mod @@ -12,6 +12,7 @@ require ( github.com/dokku/dokku/plugins/docker-options v0.0.0-20250618161309-8d0c35f1333c github.com/dokku/dokku/plugins/logs v0.0.0-20250618161309-8d0c35f1333c github.com/dokku/dokku/plugins/nginx-vhosts v0.0.0-20250618161309-8d0c35f1333c + github.com/dokku/dokku/plugins/registry v0.0.0-20250618161309-8d0c35f1333c github.com/fatih/color v1.18.0 github.com/fluxcd/pkg/kustomize v1.24.0 github.com/go-openapi/jsonpointer v0.22.4 @@ -190,6 +191,8 @@ replace github.com/dokku/dokku/plugins/logs => ../logs replace github.com/dokku/dokku/plugins/nginx-vhosts => ../nginx-vhosts +replace github.com/dokku/dokku/plugins/registry => ../registry + replace github.com/joho/godotenv => github.com/joho/godotenv v1.2.0 replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 diff --git a/plugins/scheduler-k3s/triggers.go b/plugins/scheduler-k3s/triggers.go index da6d531a8..9053798bc 100644 --- a/plugins/scheduler-k3s/triggers.go +++ b/plugins/scheduler-k3s/triggers.go @@ -23,6 +23,7 @@ import ( "github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/cron" nginxvhosts "github.com/dokku/dokku/plugins/nginx-vhosts" + "github.com/dokku/dokku/plugins/registry" "github.com/fatih/color" "github.com/gosimple/slug" "github.com/kballard/go-shellquote" @@ -405,7 +406,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e pullSecretBase64 := base64.StdEncoding.EncodeToString([]byte("")) imagePullSecrets := getComputedImagePullSecrets(appName) if imagePullSecrets == "" { - dockerConfigPath := filepath.Join(os.Getenv("DOKKU_ROOT"), ".docker/config.json") + dockerConfigPath := filepath.Join(registry.GetComputedAppRegistryConfigDir(appName), "config.json") if fi, err := os.Stat(dockerConfigPath); err == nil && !fi.IsDir() { b, err := os.ReadFile(dockerConfigPath) if err != nil {