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
6 changes: 4 additions & 2 deletions pkg/dockerfilegen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,11 @@ func builderImageForGoVersion(goVersion, rhelVersion string) string {
case "1.21":
return fmt.Sprintf(builderImageFmt, rhelVersion, goVersion, "4.16")
case "1.22":
return fmt.Sprintf(builderImageFmt, rhelVersion, goVersion, "4.17")
goVersion = "1.24"
fallthrough
case "1.23":
return fmt.Sprintf(builderImageFmt, rhelVersion, goVersion, "4.19")
goVersion = "1.24"
fallthrough
case "1.24":
fallthrough
default:
Expand Down
50 changes: 50 additions & 0 deletions pkg/dockerfilegen/generator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package dockerfilegen

import "testing"

func TestBuilderImageForGoVersion(t *testing.T) {
t.Parallel()
tcs := []builderImageForGoVersionTestCase{{
name: "empty",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang--openshift-4.20",
}, {
name: "go1.21",
goVersion: "1.21",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.21-openshift-4.16",
}, {
name: "go1.22",
goVersion: "1.22",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.20",
}, {
name: "go1.23",
goVersion: "1.23",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.20",
}, {
name: "go1.24",
goVersion: "1.24",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.20",
}, {
name: "go1.25",
goVersion: "1.25",
want: "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.25-openshift-4.20",
}}
for _, tc := range tcs {
tc := tc
t.Run(tc.name, tc.run)
}
}

type builderImageForGoVersionTestCase struct {
name string
goVersion string
rhelVersion string
want string
}

func (tc builderImageForGoVersionTestCase) run(t *testing.T) {
t.Parallel()
got := builderImageForGoVersion(tc.goVersion, tc.rhelVersion)
if got != tc.want {
t.Errorf("builderImageForGoVersion(%q, %q) = %q; want %q", tc.goVersion, tc.rhelVersion, got, tc.want)
}
}
Loading