Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Commit 066fce0

Browse files
matejvasekclaude
authored andcommitted
feat: do not use login step for ocp internal registry
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 <matejvasek@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dd3c0f8 commit 066fce0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

backend/main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os"
1414
"path/filepath"
1515
"regexp"
16+
"strings"
1617
"sync"
1718

1819
"github.com/ory/viper"
@@ -163,7 +164,7 @@ func handleFuncCreate(w http.ResponseWriter, r *http.Request) {
163164
return
164165
}
165166

166-
if err := generateCIWorkflow(root, cfg.Branch); err != nil {
167+
if err := generateCIWorkflow(root, cfg.Branch, cfg.Registry); err != nil {
167168
http.Error(w, "failed to generate CI workflow: "+err.Error(), http.StatusInternalServerError)
168169
return
169170
}
@@ -214,10 +215,14 @@ func handleFuncCreate(w http.ResponseWriter, r *http.Request) {
214215
}
215216
}
216217

217-
func generateCIWorkflow(root, branch string) error {
218+
const ocpInternalRegistry = "image-registry.openshift-image-registry.svc:5000/"
219+
220+
func generateCIWorkflow(root, branch, registry string) error {
218221
ciMu.Lock()
219222
defer ciMu.Unlock()
220223

224+
useRegistryLogin := !strings.HasPrefix(registry, ocpInternalRegistry)
225+
221226
viper.Set(ci.PlatformFlag, ci.DefaultPlatform)
222227
viper.Set(ci.PathFlag, root)
223228
viper.Set(ci.BranchFlag, branch)
@@ -227,7 +232,7 @@ func generateCIWorkflow(root, branch string) error {
227232
viper.Set(ci.RegistryUserVariableNameFlag, ci.DefaultRegistryUserVariableName)
228233
viper.Set(ci.RegistryPassSecretNameFlag, ci.DefaultRegistryPassSecretName)
229234
viper.Set(ci.RegistryUrlVariableNameFlag, ci.DefaultRegistryUrlVariableName)
230-
viper.Set(ci.UseRegistryLoginFlag, ci.DefaultUseRegistryLogin)
235+
viper.Set(ci.UseRegistryLoginFlag, useRegistryLogin)
231236
viper.Set(ci.WorkflowDispatchFlag, ci.DefaultWorkflowDispatch)
232237
viper.Set(ci.UseRemoteBuildFlag, ci.DefaultUseRemoteBuild)
233238
viper.Set(ci.UseSelfHostedRunnerFlag, ci.DefaultUseSelfHostedRunner)

0 commit comments

Comments
 (0)