Skip to content
Closed
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
3 changes: 2 additions & 1 deletion pkg/promotion/promotion.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ func (o *Options) Bind(fs *flag.FlagSet) {
fs.StringVar(&o.Repo, "repo", "", "Limit repos affected to this repo.")
}

var masterBranches = regexp.MustCompile(`^master.*$`)
var threeXBranches = regexp.MustCompile(`^(release|enterprise|openshift)-3\.[0-9]+$`)
var fourXBranches = regexp.MustCompile(`^(release|enterprise|openshift)-(4\.[0-9]+)$`)

func FlavorForBranch(branch string) string {
var flavor string
if branch == "master" {
if masterBranches.MatchString(branch) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The glob he have today is here:

    ci-operator/config/**/*master*.yaml:
      name: ci-operator-master-configs
      additional_namespaces:
      - ci-stg

That would match not-really-master-branch

flavor = "master"
} else if threeXBranches.MatchString(branch) {
flavor = "3.x"
Expand Down
10 changes: 10 additions & 0 deletions pkg/promotion/promotion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ func TestFlavorForBranch(t *testing.T) {
branch: "master",
expected: "master",
},
{
name: "master-fcos branch goes to master configmap",
branch: "master-fcos",
expected: "master",
},
{
name: "branch containing master goes to misc configmap",
branch: "not-really-master-branch",
expected: "misc",
},
{
name: "enterprise 3.6 branch goes to 3.x configmap",
branch: "enterprise-3.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ postsubmits:
valueFrom:
configMapKeyRef:
key: super-duper-master-removed-promotion.yaml
name: ci-operator-misc-configs
name: ci-operator-master-configs
image: ci-operator:latest
imagePullPolicy: Always
name: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ postsubmits:
valueFrom:
configMapKeyRef:
key: super-duper-master-removed-promotion.yaml
name: ci-operator-misc-configs
name: ci-operator-master-configs
image: ci-operator:latest
imagePullPolicy: Always
name: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ presubmits:
valueFrom:
configMapKeyRef:
key: super-duper-master-removed-promotion.yaml
name: ci-operator-misc-configs
name: ci-operator-master-configs
image: ci-operator:latest
imagePullPolicy: Always
name: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ presubmits:
valueFrom:
configMapKeyRef:
key: super-duper-master-removed-promotion.yaml
name: ci-operator-misc-configs
name: ci-operator-master-configs
image: ci-operator:latest
imagePullPolicy: Always
name: ""
Expand Down