cleanup(ci): move to using goreleaser - #24
Conversation
Signed-off-by: Calum Murray <cmurray@redhat.com>
📝 WalkthroughWalkthroughThe pull request refactors the release workflow infrastructure by introducing GoReleaser as the primary release orchestration tool. GitHub workflows transition from multi-step jobs handling versioning, changelog extraction, and manual release creation to streamlined two-job patterns that delegate build, sign, and publish operations to GoReleaser. Makefile release targets are removed to avoid duplication. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.goreleaser.yaml (1)
3-22: Binary naming may cause redundant paths in archives.The binary name includes OS/Arch (Line 5:
kubernetes-extension-{{ .Os }}-{{ .Arch }}), and the archive uses the same template (Line 22). This results in archives likekubernetes-extension-linux-amd64.zipcontaining a binary namedkubernetes-extension-linux-amd64(or.exeon Windows), which is redundant.Consider using a fixed binary name and letting only the archive name distinguish platforms:
♻️ Suggested fix
builds: - main: ./cmd - binary: "kubernetes-extension-{{ .Os }}-{{ .Arch }}" + binary: "kubernetes-extension" flags: - -trimpath🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.goreleaser.yaml around lines 3 - 22, The archive currently duplicates platform info by embedding {{ .Os }}-{{ .Arch }} in both the binary name (binary: "kubernetes-extension-{{ .Os }}-{{ .Arch }}") and the archive name_template; change the binary to a fixed name (e.g., binary: "kubernetes-extension") and keep name_template: "kubernetes-extension-{{ .Os }}-{{ .Arch }}" so each ZIP is platform-specific but contains a consistently named executable (Goreleaser will still add .exe on Windows automatically)..github/workflows/prerelease.yaml (1)
36-42: Consider running tests before prerelease.The release workflow (
.github/workflows/release.yaml) includes amake teststep before running GoReleaser, but this prerelease workflow does not. Prereleases can still reach users, so running tests would help catch issues early.♻️ Suggested addition
- name: Set up Go uses: actions/setup-go@v6 with: go-version-file: 'go.mod' + - name: Run tests + run: make test + - name: Install cosign uses: sigstore/cosign-installer@v4.0.0🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/prerelease.yaml around lines 36 - 42, The workflow lacks a test step before performing prerelease actions; add a step named like "Run tests" that executes the project's test target (e.g., run "make test" or "go test ./...") after the "Set up Go" step and before the "Install cosign" (or any release/prerelease steps) so prerelease builds run the same tests as the release workflow; update the job in .github/workflows/prerelease.yaml to include this test step using the existing runner/context and ensure it fails the job on non-zero exit so broken changes are caught early.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/nightly.yaml:
- Around line 27-36: The current git tag filter uses grep -v 'prerelease' which
won't match typical prerelease tags like v1.0.0-rc.1; update the LATEST_RELEASE
tag selection (the pipeline that assigns LATEST_RELEASE) to only include strict
semver release tags by replacing the grep filter with a regex that matches
^v[0-9]+\.[0-9]+\.[0-9]+$ so prereleases (e.g., v1.2.3-rc.1) and nightly tags
are excluded; keep the existing --sort and the later logic that computes
COMMITS_SINCE_RELEASE unchanged.
---
Nitpick comments:
In @.github/workflows/prerelease.yaml:
- Around line 36-42: The workflow lacks a test step before performing prerelease
actions; add a step named like "Run tests" that executes the project's test
target (e.g., run "make test" or "go test ./...") after the "Set up Go" step and
before the "Install cosign" (or any release/prerelease steps) so prerelease
builds run the same tests as the release workflow; update the job in
.github/workflows/prerelease.yaml to include this test step using the existing
runner/context and ensure it fails the job on non-zero exit so broken changes
are caught early.
In @.goreleaser.yaml:
- Around line 3-22: The archive currently duplicates platform info by embedding
{{ .Os }}-{{ .Arch }} in both the binary name (binary: "kubernetes-extension-{{
.Os }}-{{ .Arch }}") and the archive name_template; change the binary to a fixed
name (e.g., binary: "kubernetes-extension") and keep name_template:
"kubernetes-extension-{{ .Os }}-{{ .Arch }}" so each ZIP is platform-specific
but contains a consistently named executable (Goreleaser will still add .exe on
Windows automatically).
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/nightly.yaml.github/workflows/prerelease.yaml.github/workflows/release.yaml.goreleaser.yamlMakefile
💤 Files with no reviewable changes (1)
- Makefile
| # Find the latest release tag (any x.y.z release) | ||
| LATEST_RELEASE=$(git tag -l 'v*.*.*' --sort=-version:refname | grep -v 'prerelease' | grep -v '^nightly' | head -n1) | ||
|
|
||
| if [ -z "$LATEST_RELEASE" ]; then | ||
| echo "No existing releases found, creating first nightly" | ||
| COMMITS_SINCE_RELEASE=$(git rev-list HEAD --count) | ||
| LATEST_RELEASE_COMMIT="" | ||
| else | ||
| echo "Latest release: $LATEST_RELEASE" | ||
| COMMITS_SINCE_RELEASE=$(git rev-list ${LATEST_RELEASE}..HEAD --count) | ||
| LATEST_RELEASE_COMMIT="$LATEST_RELEASE" | ||
| fi |
There was a problem hiding this comment.
The grep -v 'prerelease' filter may not match actual prerelease tags.
Prerelease tags typically follow the pattern v1.0.0-rc.1 or v1.0.0-alpha.1, not containing the literal string "prerelease". This filter likely has no effect. You probably want to exclude tags containing a hyphen after the version:
🐛 Suggested fix
# Find the latest release tag (any x.y.z release)
- LATEST_RELEASE=$(git tag -l 'v*.*.*' --sort=-version:refname | grep -v 'prerelease' | grep -v '^nightly' | head -n1)
+ LATEST_RELEASE=$(git tag -l 'v*.*.*' --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1)The regex ^v[0-9]+\.[0-9]+\.[0-9]+$ matches only strict semver release tags (e.g., v1.2.3) and excludes prereleases (v1.2.3-rc.1) and nightly tags.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/nightly.yaml around lines 27 - 36, The current git tag
filter uses grep -v 'prerelease' which won't match typical prerelease tags like
v1.0.0-rc.1; update the LATEST_RELEASE tag selection (the pipeline that assigns
LATEST_RELEASE) to only include strict semver release tags by replacing the grep
filter with a regex that matches ^v[0-9]+\.[0-9]+\.[0-9]+$ so prereleases (e.g.,
v1.2.3-rc.1) and nightly tags are excluded; keep the existing --sort and the
later logic that computes COMMITS_SINCE_RELEASE unchanged.
This simplifies our CI to have much less bash in the release process and align on tools used in mcpchecker core
Summary by CodeRabbit