Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 23 additions & 17 deletions cmd/konflux/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
2 changes: 1 addition & 1 deletion config/downstream/konflux.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/downstream/releases/1.15.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: "1.15"
image-suffix: -rhel8
image-suffix: rhel8
release-tag: 1.15.5
code-freeze: true
docker-file-options:
Expand Down
2 changes: 1 addition & 1 deletion config/downstream/releases/1.22.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 1.22
release-tag: 1.22.5
image-suffix: "-rhel9"
image-suffix: "rhel9"
code-freeze: false
branches:
git-init:
Expand Down
2 changes: 1 addition & 1 deletion config/downstream/releases/1.23.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 1.23
release-tag: 1.23.1
image-suffix: "-rhel9"
image-suffix: "rhel9"
code-freeze: false
branches:
git-init:
Expand Down
2 changes: 1 addition & 1 deletion config/downstream/releases/1.24.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: "1.24"
image-suffix: -rhel9
image-suffix: rhel9
release-tag: 1.24.0-RC-1
branches:
console-plugin-pf5:
Expand Down
2 changes: 1 addition & 1 deletion config/downstream/repos/console-plugin-pf5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}]
2 changes: 1 addition & 1 deletion config/downstream/repos/operator-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/downstream/repos/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Loading