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

release: Publish main branch images and charts #10540

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

timflannagan
Copy link
Member

Description

This modifies the release.yaml workflow and adds the main branch push trigger to publish main branch images and the latest helm chart to ghcr.io.

Related to #10510.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Copy link
Member Author

@timflannagan timflannagan Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm leaning towards using envsubst and setting the [changelog,release].enabled=false in a single goreleaser config file to avoid drift between the configs, but wanted to get consensus on either approach. See https://github.com/orgs/goreleaser/discussions/3042 for how to do the former.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the envsubst approach would be:

  • keep a single ~.goreleaser.yaml.tmpl file
  • nightly cron will envsubst in false for [changelog,release] -> .goreleaser.yaml
  • kick off the release make target with newly build yaml file

is that accurate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pivoted away from the envsubst approach in favor of publishing a v0.0.0-main tag instead of dynamically setting the changelog and release enabled flags. The prerelease: auto flag treats the v0.0.0-main tag as a prerelease build, so I didn't see a need to maintain two different config files or dynamically render any YAML template files.

Comment on lines +7 to +9
branches:
- main
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative is cron schedule expression that fires daily if we're concerned with the free org limits for ghcr.io. In either case, we can figure out the best approach over time. This PR effectively tests whether the release pipeline is working without publishing a real tag.

Comment on lines +264 to +268
HELM_PACKAGE_ARGS ?= --version $(VERSION)
package-kgateway-chart: ## Package the new kgateway helm chart for testing
mkdir -p $(TEST_ASSET_DIR)
helm package --version $(VERSION) --destination $(TEST_ASSET_DIR) install/helm/kgateway
helm repo index $(TEST_ASSET_DIR)
mkdir -p $(TEST_ASSET_DIR); \
helm package $(HELM_PACKAGE_ARGS) --destination $(TEST_ASSET_DIR) install/helm/kgateway; \
helm repo index $(TEST_ASSET_DIR);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a no-op right now. I was exploring whether I could unset the helm package --version CLI flag, which has validation logic that checks whether --version is a valid semver (i.e. main or latest would fail that versioning), but the issue is that the default Chart.yaml version is hardcoded to v0.0.1 when you package a chart w/o this --version flag set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's ok to have the version be something like 0.0.0-<GIT HASH> given that this is a nightly release

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm - that might mean that the oci storage will grow unbounded

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we'd run into the same unbounded growth with this approach too as we're setting VERSION to be VERSION="${GIT_TAG}-${GIT_SHA}" anytime a new PR merges to main. one option that was discussed was using a third party action to periodically purge ghcr storage (e.g. https://github.com/snok/container-retention-policy).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to clarify too -- we're still planning on mirroring quay's retention policy / auto-pruning images with a label as a follow-up once the release pipeline is fully built out and validated it works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ended up going with the v0.0.0-main tagging convention to appease helm validation. Seems a bit wonky but sufficient for now.

This modifies the release.yaml workflow and adds the
main branch push trigger to publish main branch images
and the latest helm chart to ghcr.io.

Signed-off-by: timflannagan <[email protected]>
@timflannagan timflannagan force-pushed the release/publish-main-images branch from c519493 to eea329f Compare January 29, 2025 18:54
GORELEASER ?= go run github.com/goreleaser/goreleaser/[email protected]
GORELEASER_ARGS ?= --snapshot --clean
GORELEASER_CURRENT_TAG ?= $(VERSION)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed as goreleaser will use the v1.18.x tag by default and we want the v0.0.0-main tag to be used for main branch triggers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -4,6 +4,9 @@ on:
push:
tags:
- 'v*'
- '!v0.0.0-main'
Copy link
Member Author

@timflannagan timflannagan Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skip the v0.0.0-main tag that the main branch trigger will pump out to avoid running the release pipeline twice.

@lgadban lgadban added this pull request to the merge queue Jan 30, 2025
Merged via the queue into kgateway-dev:main with commit 10baa94 Jan 30, 2025
8 checks passed
@timflannagan timflannagan deleted the release/publish-main-images branch January 30, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants