From bc748e2b479f48c11cc59792a04704a595680472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Va=C5=A1ek?= Date: Mon, 13 Apr 2026 13:38:21 +0200 Subject: [PATCH] feat: do not use login step for ocp internal registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When generating GH WF and we using internal OCP registry we do not employ the docker login step since the func CLI gets the credentials from kubeconfig. The password/token for the internal registry is the same as for the OCP cluster. Signed-off-by: Matej VaĊĦek Co-Authored-By: Claude Opus 4.6 --- backend/main.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/main.go b/backend/main.go index 8c935c0..f122c74 100644 --- a/backend/main.go +++ b/backend/main.go @@ -13,6 +13,7 @@ import ( "os" "path/filepath" "regexp" + "strings" "sync" "github.com/ory/viper" @@ -163,7 +164,7 @@ func handleFuncCreate(w http.ResponseWriter, r *http.Request) { return } - if err := generateCIWorkflow(root, cfg.Branch); err != nil { + if err := generateCIWorkflow(root, cfg.Branch, cfg.Registry); err != nil { http.Error(w, "failed to generate CI workflow: "+err.Error(), http.StatusInternalServerError) return } @@ -214,10 +215,14 @@ func handleFuncCreate(w http.ResponseWriter, r *http.Request) { } } -func generateCIWorkflow(root, branch string) error { +const ocpInternalRegistry = "image-registry.openshift-image-registry.svc:5000/" + +func generateCIWorkflow(root, branch, registry string) error { ciMu.Lock() defer ciMu.Unlock() + useRegistryLogin := !strings.HasPrefix(registry, ocpInternalRegistry) + viper.Set(ci.PlatformFlag, ci.DefaultPlatform) viper.Set(ci.PathFlag, root) viper.Set(ci.BranchFlag, branch) @@ -227,7 +232,7 @@ func generateCIWorkflow(root, branch string) error { viper.Set(ci.RegistryUserVariableNameFlag, ci.DefaultRegistryUserVariableName) viper.Set(ci.RegistryPassSecretNameFlag, ci.DefaultRegistryPassSecretName) viper.Set(ci.RegistryUrlVariableNameFlag, ci.DefaultRegistryUrlVariableName) - viper.Set(ci.UseRegistryLoginFlag, ci.DefaultUseRegistryLogin) + viper.Set(ci.UseRegistryLoginFlag, useRegistryLogin) viper.Set(ci.WorkflowDispatchFlag, ci.DefaultWorkflowDispatch) viper.Set(ci.UseRemoteBuildFlag, ci.DefaultUseRemoteBuild) viper.Set(ci.UseSelfHostedRunnerFlag, ci.DefaultUseSelfHostedRunner)