diff --git a/.konflux/openshift-pipelines/1-15/openshift-pipelines-core/operator/image-operator-1.15.yaml b/.konflux/openshift-pipelines/1-15/openshift-pipelines-core/operator/image-operator-1.15.yaml index 1febb9d6..47b60706 100644 --- a/.konflux/openshift-pipelines/1-15/openshift-pipelines-core/operator/image-operator-1.15.yaml +++ b/.konflux/openshift-pipelines/1-15/openshift-pipelines-core/operator/image-operator-1.15.yaml @@ -19,4 +19,4 @@ spec: url: https://bombino.api.redhat.com/v1/sbom/quay/push event: repo_push method: webhook - title: SBOM-event-to-Bombino + title: SBOM-event-to-Bombino \ No newline at end of file diff --git a/cmd/konflux/main.go b/cmd/konflux/main.go index 73c06e77..1aa6f43e 100644 --- a/cmd/konflux/main.go +++ b/cmd/konflux/main.go @@ -20,10 +20,7 @@ import ( "gopkg.in/yaml.v2" ) -const ( - DefaultImageSuffix = "-rhel9" - DefaultImagePrefix = "pipeline-" -) +const ImageSeparator = "-" func main() { var configFile = flag.String("config", "config/downstream/konflux.yaml", "path to config file") @@ -407,30 +404,29 @@ func UpdateComponent(c *k.Component, repo k.Repository, app k.Application) error c.PrefetchInput = "" } if version.ImageSuffix != "None" && !c.NoImageSuffix { - c.ImageSuffix += version.ImageSuffix - if c.ImageSuffix == "" { - c.ImageSuffix = DefaultImageSuffix - } + c.ImageSuffix = joinNonEmpty(ImageSeparator, c.ImageSuffix, version.ImageSuffix) } // This is the case for git-init where we don't require upstream name because comet created is pipelines-git-init-rhel8 + if c.Name == "operator" { + c.ImagePrefix = version.ImageSuffix + } if !c.NoImagePrefix { - c.ImagePrefix = version.ImagePrefix + c.ImagePrefix + log.Printf("Version Prefix: %s", version.ImagePrefix) + log.Printf("Component Prefix: %s", c.ImagePrefix) + + c.ImagePrefix = joinNonEmpty(ImageSeparator, version.ImagePrefix, c.ImagePrefix) + log.Printf("Component Prefix: %s", c.ImagePrefix) + if !(c.NoPrefixUpstream || repo.NoPrefixUpstream) && repo.Upstream != "" { - c.ImagePrefix += strings.Split(repo.Upstream, "/")[1] + "-" + c.ImagePrefix = joinNonEmpty(ImageSeparator, c.ImagePrefix, strings.Split(repo.Upstream, "/")[1]) } } if c.Image == "" { c.Image = c.Name } - // Version 1.15 uses rhel8: replace all rhel9 occurrences with rhel8 - if version.Version == "1.15" { - c.ImagePrefix = strings.ReplaceAll(c.ImagePrefix, "rhel9", "rhel8") - c.ImageSuffix = strings.ReplaceAll(c.ImageSuffix, "rhel9", "rhel8") - } - - c.Image = fmt.Sprintf("%s%s%s", c.ImagePrefix, c.Image, c.ImageSuffix) + c.Image = joinNonEmpty(ImageSeparator, c.ImagePrefix, c.Image, c.ImageSuffix) log.Printf("Using Image: %s", c.Image) return nil @@ -453,3 +449,13 @@ func readOwners(dir string) (map[string][]string, error) { } return owners, nil } + +func joinNonEmpty(sep string, items ...string) string { + var filtered []string + for _, s := range items { + if s != "" { + filtered = append(filtered, s) + } + } + return strings.Join(filtered, sep) +} diff --git a/config/downstream/konflux.yaml b/config/downstream/konflux.yaml index 17b15d3b..4c782cfd 100644 --- a/config/downstream/konflux.yaml +++ b/config/downstream/konflux.yaml @@ -1,6 +1,6 @@ organization: openshift-pipelines namespace: tekton-ecosystem-tenant -image-prefix: pipelines- +image-prefix: pipelines product: openshift-pipelines rpa-dir: konflux-release-data/config/kflux-prd-rh02.0fk9.p1/product/ReleasePlanAdmission/tekton-ecosystem cdn-product-dir: konflux-release-data/data/external/developer-portal/openshift-pipelines diff --git a/config/downstream/releases/1.15.yaml b/config/downstream/releases/1.15.yaml index cab5e45a..aae1de4f 100644 --- a/config/downstream/releases/1.15.yaml +++ b/config/downstream/releases/1.15.yaml @@ -1,5 +1,5 @@ version: "1.15" -image-suffix: -rhel8 +image-suffix: rhel8 release-tag: 1.15.5 code-freeze: true docker-file-options: diff --git a/config/downstream/releases/1.22.yaml b/config/downstream/releases/1.22.yaml index 31a10231..af98c287 100644 --- a/config/downstream/releases/1.22.yaml +++ b/config/downstream/releases/1.22.yaml @@ -1,6 +1,6 @@ version: 1.22 release-tag: 1.22.5 -image-suffix: "-rhel9" +image-suffix: "rhel9" code-freeze: false branches: git-init: diff --git a/config/downstream/releases/1.23.yaml b/config/downstream/releases/1.23.yaml index 18e666e9..69ee95d9 100644 --- a/config/downstream/releases/1.23.yaml +++ b/config/downstream/releases/1.23.yaml @@ -1,6 +1,6 @@ version: 1.23 release-tag: 1.23.1 -image-suffix: "-rhel9" +image-suffix: "rhel9" code-freeze: false branches: git-init: diff --git a/config/downstream/releases/1.24.yaml b/config/downstream/releases/1.24.yaml index 8c56662d..294089e6 100644 --- a/config/downstream/releases/1.24.yaml +++ b/config/downstream/releases/1.24.yaml @@ -1,5 +1,5 @@ version: "1.24" -image-suffix: -rhel9 +image-suffix: rhel9 release-tag: 1.24.0-RC-1 branches: console-plugin-pf5: diff --git a/config/downstream/repos/console-plugin-pf5.yaml b/config/downstream/repos/console-plugin-pf5.yaml index 55c27303..2b4b0984 100644 --- a/config/downstream/repos/console-plugin-pf5.yaml +++ b/config/downstream/repos/console-plugin-pf5.yaml @@ -4,6 +4,6 @@ no-prefix-upstream: true min-version: 1.21 components: - name: console-plugin - image-suffix: -pf5 + image-suffix: pf5 prefetch-input: |- [{"type": "rpm", "path": ".konflux/rpms"}, {"type": "yarn", "path": "upstream"}, {"type": "npm", "path": ".konflux/npm"}] diff --git a/config/downstream/repos/operator-bundle.yaml b/config/downstream/repos/operator-bundle.yaml index 60eb7ec2..feeed419 100644 --- a/config/downstream/repos/operator-bundle.yaml +++ b/config/downstream/repos/operator-bundle.yaml @@ -2,7 +2,7 @@ name: operator prefetch-input: "NONE" components: - name: bundle - image-prefix: operator- + image-prefix: operator no-image-suffix: true nudges: - operator-{{hyphenize .Version.Version}}-index-4-20 diff --git a/config/downstream/repos/operator.yaml b/config/downstream/repos/operator.yaml index 35a5064a..1dec3744 100644 --- a/config/downstream/repos/operator.yaml +++ b/config/downstream/repos/operator.yaml @@ -3,7 +3,6 @@ upstream: tektoncd/operator prefetch-input: "NONE" components: - name: operator - image-prefix: rhel9- no-prefix-upstream: true no-image-suffix: true - name: webhook diff --git a/internal/konflux/templates/konflux/release-plan-admission-cdn.yaml b/internal/konflux/templates/konflux/release-plan-admission-cdn.yaml index 418144c0..45530388 100644 --- a/internal/konflux/templates/konflux/release-plan-admission-cdn.yaml +++ b/internal/konflux/templates/konflux/release-plan-admission-cdn.yaml @@ -19,7 +19,7 @@ metadata: name: {{.Config.Product}}-{{.Release.Version | hyphenize}}-{{.ShortName}}-cdn-{{.Env}} namespace: rhtap-releng-tenant annotations: - rhel_target: {{.Application.Release.ImageSuffix | trimPrefix "-rh"}} + rhel_target: {{.Application.Release.ImageSuffix | trimPrefix "rh"}} spec: applications: - {{.Name }}-{{.Release.Version | hyphenize}} diff --git a/internal/konflux/templates/konflux/release-plan-admission.yaml b/internal/konflux/templates/konflux/release-plan-admission.yaml index 04d9a071..5efdaa2a 100644 --- a/internal/konflux/templates/konflux/release-plan-admission.yaml +++ b/internal/konflux/templates/konflux/release-plan-admission.yaml @@ -20,7 +20,7 @@ metadata: name: {{.Config.Product}}-{{.Release.Version | hyphenize}}-{{.ShortName}}-{{.Env}} namespace: rhtap-releng-tenant annotations: - rhel_target: {{.Application.Release.ImageSuffix | trimPrefix "-rh"}} + rhel_target: {{.Application.Release.ImageSuffix | trimPrefix "rh"}} spec: applications: - {{.Name }}-{{.Release.Version | hyphenize}}