-
Notifications
You must be signed in to change notification settings - Fork 1.6k
🌱 (ci) - Add test for release mock #4939
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
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:master
from
camilamacedo86:test-release
Jul 23, 2025
+59
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Test GoReleaser and CLI Version | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'pkg/cmd/**' | ||
- 'build/.goreleaser.yml' | ||
- '.github/workflows/release-version-ci.yml' | ||
pull_request: | ||
paths: | ||
- 'pkg/cmd/**' | ||
- 'build/.goreleaser.yml' | ||
- '.github/workflows/release-version-ci.yml' | ||
|
||
jobs: | ||
mock-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Clean dist directory | ||
run: rm -rf dist || true | ||
|
||
- name: Create temporary git tag | ||
run: | | ||
git tag v4.5.3-rc.1 | ||
|
||
- name: Install Syft to generate SBOMs | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b $HOME/bin | ||
echo "$HOME/bin" >> $GITHUB_PATH | ||
|
||
- name: Run GoReleaser in mock mode using tag | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
version: v2.7.0 | ||
args: release --skip=publish --clean -f ./build/.goreleaser.yml | ||
|
||
- name: Init project using built kubebuilder binary and check cliVersion | ||
run: | | ||
mkdir test-operator && cd test-operator | ||
go mod init test-operator | ||
chmod +x ../dist/kubebuilder_linux_amd64_v1/kubebuilder | ||
../dist/kubebuilder_linux_amd64_v1/kubebuilder init --domain example.com | ||
|
||
echo "PROJECT file content:" | ||
cat PROJECT | ||
|
||
echo "Verifying cliVersion value..." | ||
grep '^cliVersion: 4.5.3-rc.1$' PROJECT | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the
init
subcommand we already have e2e-tests. If it's just to test the generated binary viagoreleaser
, than this might be a simpler approach - WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is nice we have the content in case it fails, so we do not need to take the steps locally to discover the reason. WDYT? Could we proceed as it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, we can proceed as it is.
The following is just a small Feedback from a new contributor PoV:
I totally got your intention and the way you've implemented this, is definitely cool.
But I also love the "defacto standard" in the k8s ecosystem where mostly a
make lint && make test
works out of the box on my machine and I get early feedback - even before i push and raise a PR.And sometimes users have to spend more time in understanding and fixing code/tests which are not covered by a local test setup (which sometimes isn't that easy for sure).
Having this scenario as
ginkgo
based e2e-test would make it more accessible, as at least the.github
folder is something I mostly do not care about.But this also introduces new complexity - and we have to deal with that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use Goreleaser and GitHub Actions for our release process.
This test is specifically validating Goreleaser / Release process
Why do we check the CliVersion?
Because it's only output from the Binary released.
(tag version);Not from the one build with make install.
See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/build/.goreleaser.yml#L35
That’s why this doesn’t quite fit in the standard GoLang e2e test suite—what we really want is to test the release process itself, not just the CLI in isolation.