This guide outlines the steps to upgrade the Go version and dependencies in the Kubeflow project, including the necessary changes in the red-hat-data-services/kubeflow fork.
Upgrading the Go version should be done in a separate PR to isolate the changes and make review easier.
Important
Images are to be built in the ubi8/go-toolset container. It contains a customized FIPS-compatible version of Go, that however lags behind the latest upstream Go version. Always use a Go version that has a supporting go-toolset image available.
-
Begin by reading Go release notes to identify potential incompatibilities.
-
Update the Go version in the following files:
components/**/go.mod: Update thegodirective at the top of the file.components/**/Dockerfile: Update the Go version in the base image.
-
Run the following commands to update and verify the build:
go mod tidy make test -
Commit these changes and create a pull request for the Go version upgrade.
[!WARNING]
Use theManifest List Digestand not theImage Digestwhen locating sha256 in the Red Hat Image Catalog entry. -
After merging the Go upgrade PR, update the fork at https://github.com/red-hat-data-services/kubeflow:
- Locate all
Dockerfile.konfluxfiles in the repository. - Update the Go version in each of these files to match the new version.
- Refer to the ubi8/go-toolset in Red Hat image catalog to locate
sha256hash - Create a pull request in the fork repository with these changes.
- Locate all
-
Review CI/CD configuration files (especially openshift/release OCP-CI yamls) that specify a Go version.
Upgrading dependencies can be done separately from the Go version upgrade. However, some dependency upgrades may require a newer Go version.
-
To update all dependencies to their latest minor or patch versions:
go get -u ./...
To update to major versions, you'll need to update import paths manually and run
go getfor each updated package. -
Run
go mod tidyto clean up thego.modandgo.sumfiles, pay attention to not increasing required Go version, e.g.:go mod tidy -go=1.21.9 go: go.opentelemetry.io/auto/sdk@v1.1.0 requires go@1.22.0, but 1.21.9 is requested
(The above suggests to either bump the required Go version or to use an older version of dependency.)
-
Verify that the project still builds and tests pass:
make test -
Review the changes in
go.modandgo.sum. Pay special attention to major version upgrades, as they may include breaking changes. -
If any dependencies require a newer Go version, you may need to upgrade Go first following the steps in the "Upgrading Go Version" section.
-
Commit the changes to
go.modandgo.sum, and create a pull request for the dependency upgrades.