|
| 1 | +# Upgrading Go Version and Dependencies in Kubeflow |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +## Upgrading Go Version |
| 6 | + |
| 7 | +Upgrading the Go version should be done in a separate PR to isolate the changes and make review easier. |
| 8 | + |
| 9 | +> [!IMPORTANT] |
| 10 | +> Images are to be built in the [ubi8/go-toolset](https://catalog.redhat.com/software/containers/ubi8/go-toolset/5ce8713aac3db925c03774d1) container. |
| 11 | +> It contains a customized FIPS-compatible version of Go, that however lags behind the latest upstream Go version. |
| 12 | +> Always use a Go version that has a supporting go-toolset image available. |
| 13 | +
|
| 14 | +1. Begin by reading [Go release notes](https://go.dev/doc/devel/release) to identify potential incompatibilities. |
| 15 | + |
| 16 | +2. Update the Go version in the following files: |
| 17 | + - `components/**` `/` `go.mod`: Update the `go` directive at the top of the file. |
| 18 | + - `components/**` `/` `Dockerfile`: Update the Go version in the base image. |
| 19 | + |
| 20 | +3. Run the following commands to update and verify the build: |
| 21 | + |
| 22 | + ```shell |
| 23 | + go mod tidy |
| 24 | + make test |
| 25 | + ``` |
| 26 | + |
| 27 | +4. Commit these changes and create a pull request for the Go version upgrade. |
| 28 | + |
| 29 | + > [!WARNING] |
| 30 | + > Use the `Manifest List Digest` and not the `Image Digest` when locating sha256 in the Red Hat Image Catalog entry. |
| 31 | + |
| 32 | +5. After merging the Go upgrade PR, update the fork at https://github.com/red-hat-data-services/kubeflow: |
| 33 | + - Locate all `Dockerfile.konflux` files in the repository. |
| 34 | + - Update the Go version in each of these files to match the new version. |
| 35 | + - Refer to the [ubi8/go-toolset](https://catalog.redhat.com/software/containers/ubi8/go-toolset/5ce8713aac3db925c03774d1) in Red Hat image catalog to locate `sha256` hash |
| 36 | + - Create a pull request in the fork repository with these changes. |
| 37 | + |
| 38 | +6. Review CI/CD configuration files (especially openshift/release OCP-CI yamls) that specify a Go version. |
| 39 | + |
| 40 | +## Upgrading Dependencies |
| 41 | + |
| 42 | +Upgrading dependencies can be done separately from the Go version upgrade. However, some dependency upgrades may require a newer Go version. |
| 43 | + |
| 44 | +1. To update all dependencies to their latest minor or patch versions: |
| 45 | + |
| 46 | + ````shell |
| 47 | + go get -u ./... |
| 48 | + ```` |
| 49 | + |
| 50 | + To update to major versions, you'll need to update import paths manually and run `go get` for each updated package. |
| 51 | +
|
| 52 | +2. Run `go mod tidy` to clean up the `go.mod` and `go.sum` files, pay attention to not increasing required Go version, e.g.: |
| 53 | +
|
| 54 | + ````shell |
| 55 | + go mod tidy -go=1.21.9 |
| 56 | + go: go.opentelemetry.io/auto/[email protected] requires [email protected], but 1.21.9 is requested |
| 57 | + ```` |
| 58 | +
|
| 59 | + (The above suggests to either bump the required Go version or to use an older version of dependency.) |
| 60 | +
|
| 61 | +3. Verify that the project still builds and tests pass: |
| 62 | +
|
| 63 | + ````shell |
| 64 | + make test |
| 65 | + ```` |
| 66 | +
|
| 67 | +4. Review the changes in `go.mod` and `go.sum`. Pay special attention to major version upgrades, as they may include breaking changes. |
| 68 | +
|
| 69 | +5. If any dependencies require a newer Go version, you may need to upgrade Go first following the steps in the "Upgrading Go Version" section. |
| 70 | +
|
| 71 | +6. Commit the changes to `go.mod` and `go.sum`, and create a pull request for the dependency upgrades. |
0 commit comments