From d6f367799a2d97d59a72085f3b491449d86d75b2 Mon Sep 17 00:00:00 2001 From: cpanato Date: Wed, 13 Mar 2024 09:57:43 +0100 Subject: [PATCH] set custom org and repo for FF cloudbuild job Signed-off-by: cpanato --- gcb/fast-forward/cloudbuild.yaml | 4 ++++ pkg/fastforward/fastforward.go | 2 ++ pkg/gcp/gcb/gcb.go | 34 +++++++++++++++++++++----------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/gcb/fast-forward/cloudbuild.yaml b/gcb/fast-forward/cloudbuild.yaml index 29ea229ae3d..498830cc414 100644 --- a/gcb/fast-forward/cloudbuild.yaml +++ b/gcb/fast-forward/cloudbuild.yaml @@ -75,6 +75,8 @@ steps: - "fast-forward" - "--log-level=${_LOG_LEVEL}" - "--non-interactive" + - "--github-org=${_K8S_ORG}" + - "--github-repo=${_K8S_REPO}" - "${_NOMOCK}" tags: @@ -84,6 +86,8 @@ tags: - ${_GIT_TAG} - ${_RELEASE_BRANCH} - ${_TYPE_TAG} +- ${_K8S_ORG} +- ${_K8S_REPO} - ${_TYPE} options: diff --git a/pkg/fastforward/fastforward.go b/pkg/fastforward/fastforward.go index a6850a84d2e..50aa18db639 100644 --- a/pkg/fastforward/fastforward.go +++ b/pkg/fastforward/fastforward.go @@ -94,6 +94,8 @@ func (f *FastForward) Run() (err error) { options.Stream = true options.Project = f.options.GCPProjectID options.ScratchBucket = "gs://" + f.options.GCPProjectID + "-gcb" + options.CustomK8SRepo = f.options.GitHubRepo + options.CustomK8sOrg = f.options.GitHubOrg return f.Submit(options) } diff --git a/pkg/gcp/gcb/gcb.go b/pkg/gcp/gcb/gcb.go index cf8c3cfa4e3..0d7dc6461e9 100644 --- a/pkg/gcp/gcb/gcb.go +++ b/pkg/gcp/gcb/gcb.go @@ -95,18 +95,20 @@ type Options struct { // NonInteractive does not ask any questions if set to true. NonInteractive bool - NoMock bool - Stage bool - Release bool - FastForward bool - Stream bool - BuildAtHead bool - Branch string - ReleaseType string - BuildVersion string - GcpUser string - LogLevel string - LastJobs int64 + NoMock bool + Stage bool + Release bool + FastForward bool + Stream bool + BuildAtHead bool + Branch string + ReleaseType string + BuildVersion string + GcpUser string + LogLevel string + CustomK8SRepo string + CustomK8sOrg string + LastJobs int64 // OpenBuildService parameters OBSStage bool @@ -360,7 +362,15 @@ func (g *GCB) SetGCBSubstitutions(toolOrg, toolRepo, toolRef, gcsBucket string) gcbSubs["TOOL_REF"] = toolRef gcbSubs["K8S_ORG"] = release.GetK8sOrg() + if g.options.CustomK8sOrg != "" { + gcbSubs["K8S_ORG"] = g.options.CustomK8sOrg + } + gcbSubs["K8S_REPO"] = release.GetK8sRepo() + if g.options.CustomK8SRepo != "" { + gcbSubs["K8S_REPO"] = g.options.CustomK8SRepo + } + gcbSubs["K8S_REF"] = release.GetK8sRef() gcpUser := g.options.GcpUser