Skip to content

Added goreleaser instead of gox #30896#30913

Closed
Bhargavkonidena wants to merge 14 commits into
helm:mainfrom
Bhargavkonidena:fix_goreleaser
Closed

Added goreleaser instead of gox #30896#30913
Bhargavkonidena wants to merge 14 commits into
helm:mainfrom
Bhargavkonidena:fix_goreleaser

Conversation

@Bhargavkonidena

Copy link
Copy Markdown
Contributor

Resolves #30896

Special notes for your reviewer:

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
@Bhargavkonidena Bhargavkonidena changed the title Fix goreleaser Added goreleaser instead of gox #30896 May 26, 2025

@gjenkins8 gjenkins8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! I took an initial pass, I still need to review some of the specifics. But some initial comments:

  • Please don't remove .github/issue_template.md. That should be done in a separate and specific PR.
  • can we update the build-cross target in Makefile to also use goreleaser, and any related/then unused functionality e.g. TARGETS, TARGET_OBJS, GOX (and download), etc
    • the test-acceptance target will need to be updated somehow. currently this only requires a build of linux/amd64. ideally we could emulate this logic

plus the comments inline on the PR. Thanks!

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 29, 2025
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
Signed-off-by: Bhargavkonidena <Bhargavkonidena@users.noreply.github.com>
@Bhargavkonidena

Copy link
Copy Markdown
Contributor Author

Thanks for the PR! I took an initial pass, I still need to review some of the specifics. But some initial comments:

  • Please don't remove .github/issue_template.md. That should be done in a separate and specific PR.

  • can we update the build-cross target in Makefile to also use goreleaser, and any related/then unused functionality e.g. TARGETS, TARGET_OBJS, GOX (and download), etc

    • the test-acceptance target will need to be updated somehow. currently this only requires a build of linux/amd64. ideally we could emulate this logic

plus the comments inline on the PR. Thanks!

I am done with incorporating these review comments. Please check.

@Bhargavkonidena

Copy link
Copy Markdown
Contributor Author

@gjenkins8 can you please review this PR

@robertsirc robertsirc added the v4.x Issues and Pull Requests related to the major version v4 label Jun 3, 2025
@robertsirc

Copy link
Copy Markdown
Member

@mattfarina and I can review this on the next Helmternoon.

robertsirc
robertsirc previously approved these changes Jun 6, 2025

@robertsirc robertsirc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@robertsirc robertsirc added the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Jun 6, 2025

@gjenkins8 gjenkins8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there are quite a few things to fix up here. once these are fixed, it is needed to test this change (as much as possible) locally. Then we can consider how to validate in github actions.

Comment thread Makefile
GOFLAGS="-trimpath" CGO_ENABLED=0 $(GOX) -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/$(BINNAME)" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./cmd/helm
build-cross:
@echo "==> Building cross-platform binaries using GoReleaser"
goreleaser build --clean --skip-validate --single-target

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--skip-validate is deprecated -- see: https://goreleaser.com/deprecations/

don't you want/need to refer to the config file? And why is --single-target being passed here?

Comment thread Makefile

.PHONY: build-linux-amd64
build-linux-amd64:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(GOFLAGS) -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o '$(BINDIR)/$(BINNAME)' ./cmd/helm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be better to use (for consistency) goreleaser w/ --single-target?

- linux
- darwin
- windows
goarch:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for GOARCH we previously had:

darwin/amd64 darwin/arm64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x linux/riscv64 windows/amd64 windows/arm64

ie. linux/386, linux/arm, linux/ppc64le, linux/s390x linux/riscv64 need to continue to be built, but are missing here.

make build-cross VERSION="${{ github.ref_name }}"
make dist checksum VERSION="${{ github.ref_name }}"
- name: Run Go Release
uses: goreleaser/goreleaser-action@v6.3.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to pin to a specific release via hash (see other uses:). Please also include the semver version as a comment.


- name: Build Helm Binaries
- name: Run Go Release
uses: goreleaser/goreleaser-action@v6.3.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as above (we need to pin to a specific release via hash (see other uses:). Please also include the semver version as a comment.)

Comment thread Makefile
.PHONY: test-acceptance
test-acceptance: TARGETS = linux/amd64
test-acceptance: build build-cross
test-acceptance: build build-linux-amd64

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

test-acceptance previously built current arch + all architectures. Now it is building current + linux/amd64.

If I'm not mistaken, we previously did this to:

  • build all architectures to ensure all architectures build
  • build current arch, to run acceptable tests

We need to continue the above behavior here (rather than building current + linux/amd64 only; runners are most likely to be linux/amd64, which makes this redundant too)

make dist checksum VERSION="${{ github.ref_name }}"
- name: Run Go Release
uses: goreleaser/goreleaser-action@v6.3.0
if: success() && startsWith(github.ref, 'refs/tags/')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@@ -0,0 +1,38 @@
project_name: helm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How are you testing this change? A superficial run fails with:

$ goreleaser build --clean --skip validate -f .github/workflows/.goreleaser.yaml 
  • only  version: 2  configuration files are supported, yours is  version: 0 , please update your configuration
  ⨯ build failed after 0s                    error=only  version: 2  configuration files are supported, yours is  version: 0 , please update your configuration


- name: Verify checksum
run: |
make dist checksum VERSION="${{ github.ref_name }}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unless I'm mistaken, make dist is recreating the release archives. Which .goreleaser.yaml is also configured to do:
https://github.com/helm/helm/pull/30913/files#diff-413d66267886290506ba7e2df00c65cb65341ec7347cd34568117ff435f63623R25

please use one or the other (preference would be to use goreleaser, rather than makefile logic I think)

ldflags:
- -s -w -extldflags "-static"
flags:
- -tags=netgo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where did this "netgo" tag come from?

@Bhargavkonidena Bhargavkonidena dismissed robertsirc’s stale review June 17, 2025 19:19

The merge-base changed after approval.

@scottrigby scottrigby added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 5, 2025
@gjenkins8 gjenkins8 removed v4.x Issues and Pull Requests related to the major version v4 Has One Approval This PR has one approval. It still needs a second approval to be merged. labels Oct 3, 2025
@github-actions

github-actions Bot commented Jan 2, 2026

Copy link
Copy Markdown

This pull request has been marked as stale because it has been open for 90 days with no activity. This pull request will be automatically closed in 30 days if no further activity occurs.

@github-actions github-actions Bot added the Stale label Jan 2, 2026
@github-actions github-actions Bot closed this Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace github.com/mitchellh/gox

4 participants