Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix builder-bumper major version bump #245

Merged
merged 1 commit into from
Feb 14, 2024
Merged
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
19 changes: 10 additions & 9 deletions cmd/builder-bumper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ func shaReplacer(old, new *goVersion) func(string) (string, error) {
}
}

func majorVersionReplacer(old, new *goVersion) func(string) (string, error) {
func majorVersionReplacer(prefix string, old, new *goVersion) func(string) (string, error) {
return func(out string) (string, error) {
return strings.ReplaceAll(out, old.Major(), new.Major()), nil
return strings.ReplaceAll(out, prefix+old.Major(), prefix+new.Major()), nil
}
}

Expand Down Expand Up @@ -241,14 +241,15 @@ func replaceMajor(old, current, next *goVersion) error {
return replace(path,
[]func(string) (string, error){
golangVersionReplacer("GOLANG_VERSION ", old, next),
majorVersionReplacer("quay.io/prometheus/golang-builder:", old, next),
shaReplacer(old, next),
},
)
}
return replace(path,
[]func(string) (string, error){
golangVersionReplacer("", old, next),
majorVersionReplacer(old, next),
majorVersionReplacer("", old, next),
},
)
})
Expand All @@ -262,8 +263,8 @@ func replaceMajor(old, current, next *goVersion) error {
// Update CircleCI.
err = replace(".circleci/config.yml",
[]func(string) (string, error){
majorVersionReplacer(current, next),
majorVersionReplacer(old, current),
majorVersionReplacer("", current, next),
majorVersionReplacer("", old, current),
},
)
if err != nil {
Expand All @@ -273,8 +274,8 @@ func replaceMajor(old, current, next *goVersion) error {
// Update Makefile.
err = replace("Makefile",
[]func(string) (string, error){
majorVersionReplacer(current, next),
majorVersionReplacer(old, current),
majorVersionReplacer("", current, next),
majorVersionReplacer("", old, current),
},
)
if err != nil {
Expand All @@ -285,9 +286,9 @@ func replaceMajor(old, current, next *goVersion) error {
return replace("README.md",
[]func(string) (string, error){
fullVersionReplacer(current, next),
majorVersionReplacer(current, next),
majorVersionReplacer("", current, next),
fullVersionReplacer(old, current),
majorVersionReplacer(old, current),
majorVersionReplacer("", old, current),
},
)
}
Expand Down
Loading