From e0486ce9f336dddc6d08d4c5d061058cb53fb740 Mon Sep 17 00:00:00 2001 From: Otavio Rodolfo Piske Date: Mon, 15 Mar 2021 13:03:04 +0100 Subject: [PATCH] fix: only assume secure pull if the main registry and the base image registry are different --- pkg/builder/spectrum/publisher.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/builder/spectrum/publisher.go b/pkg/builder/spectrum/publisher.go index d47f9557c7..315e5489ca 100644 --- a/pkg/builder/spectrum/publisher.go +++ b/pkg/builder/spectrum/publisher.go @@ -23,6 +23,7 @@ import ( "os" "path" "path/filepath" + "strings" "github.com/apache/camel-k/pkg/builder" "github.com/apache/camel-k/pkg/platform" @@ -62,9 +63,15 @@ func publisher(ctx *builder.Context) error { } pullInsecure := pl.Status.Build.Registry.Insecure // incremental build case - if ctx.BaseImage == pl.Status.Build.BaseImage { - // Assuming the base image is always secure (we should add a flag) - pullInsecure = false + + log.Debugf("Registry address: %s", pl.Status.Build.Registry.Address) + log.Debugf("Base image: %s", ctx.BaseImage) + + if !strings.HasPrefix(ctx.BaseImage, pl.Status.Build.Registry.Address) { + if pullInsecure { + log.Info("Assuming secure pull because the registry for the base image and the main registry are different") + pullInsecure = false + } } registryConfigDir := ""