Repository navigation
Conversation
lgfa29
left a comment
There was a problem hiding this comment.
Neat! I should really work on standardizing our release flows 🙃
| GORELEASER ?= go tool -modfile tools/go.mod goreleaser | ||
| KO ?= go tool -modfile tools/go.mod ko |
There was a problem hiding this comment.
I'm not sure how useful it would be in this case, since we only seem to be using two tools for now, but in Terraform I don this:
https://github.com/oxidecomputer/terraform-provider-oxide/blob/8934dfd92115dadcbdaed5813c5d836c52e0e276/Makefile#L33
|
|
||
| before: | ||
| hooks: | ||
| - make manifests VERSION={{ .Version }} |
There was a problem hiding this comment.
I imagine .Version is the tag, but I'm not sure where it's been set. Is it a "magical" value provided by goreleaser?
There was a problem hiding this comment.
It's magically provided by goreleaser. It's basically the tag without a "v" prefix. Different types of builds can produce a suffix like -SNAPSHOT, but all derived by tag unless overridden. There's a whole list of magical vars you can use for templating with goreleaser: https://goreleaser.com/customization/general/templates/
There was a problem hiding this comment.
This was my question too when reading the code. Ideally, I like the version for projects to have a single source of truth, but it's not always clear what the source should be across the Go binary, GoReleaser, container image tags, and Helm charts. In the Omni infrastructure provider I switched to using the Go module version as the source of truth using -buildvcs, but that only publishes a binary, not a container image or Helm chart.
I'm trying not to go back to a VERSION file, but I see how its simplicity wins out many times.
I was happy to see that a make build uses the tag and commit for a non-release version though:
> make build> make build
Building container image: ghcr.io/oxidecomputer/oxide-cloud-controller-manager:0.8.0-18-gb3c0460
There was a problem hiding this comment.
It's possible we have a make version that is the single source of truth version that is derived from the goreleaser version today and pass it back into goreleaser so its explicit. Then, we could swap out the version in the future. I mainly don't like the VERSION file because it requires either a pre-release or a post-release step.
I have snapshot releases as a follow-up to this PR (already implemented in karpenter and CAPOx) that will publish all assets as a draft snapshot release.
sudomateo
left a comment
There was a problem hiding this comment.
Nice! This is much better than what I originally implemented. I tested the build locally and it looks good to me. Thanks for doing this.
Description:
This PR changes the release process to use
kofor container image building andgoreleaserto manage building and releasing assets to github releases.koremoves the release dependency on a container runtime since it can build images without a runtime. I kept the build helper to load into whatever runtime you are using for local dev. This makes the release process similar to CAPOx and Karpenter.A lot of the changes shift responsibility from shell commands in the workflows to rely on
goreleaserto do those things with the.goreleaser.yamlconfig.A few differences:
VERSIONfile and instead we just use the tag. This reduces the steps to trigger a release to 1 tag push.gcr.io/distroless/static-debian12:nonrootto 13 since 12 is deprecated.argsinstead of a command path.koplaces the binary in/ko-app/, which is also in thePATH, and sets theentrypointto/ko-app/oxide-cloud-controller-manager. This means that old helm charts will not work after this PR merged with new images, but old images will work with new charts since the old image has anentrypointofoxide-cloud-controller-manager. This is mostly a non-issue since most users will take helm + image as the full release asset.Testing:
I tested the release process in a separate repo. You can see the release here: https://github.com/bwagner5/oxccm/releases/tag/v0.0.4
Tested release on a real cluster to ensure functionality
make buildworks locally with a docker runtime