-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Added goreleaser instead of gox #30896 #30913
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
Changes from all commits
ab5084e
61e3139
fcef313
03d8e1e
ca89ae2
9431874
1fe6dad
ebce578
97edeb8
2790d8c
9582e56
5fe7958
8ac1459
3af395c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,3 @@ Output of `kubectl version`: | |
|
|
||
| Cloud Provider/Platform (AKS, GKE, Minikube etc.): | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| project_name: helm | ||
|
|
||
| builds: | ||
| - id: helm | ||
| main: ./cmd/helm | ||
| binary: helm | ||
| goos: | ||
| - linux | ||
| - darwin | ||
| - windows | ||
| goarch: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for ie. |
||
| - amd64 | ||
| - arm64 | ||
| goarm: | ||
| - 6 | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| - GOFLAGS=-trimpath | ||
| ldflags: | ||
| - -s -w -extldflags "-static" | ||
| flags: | ||
| - -tags=netgo | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where did this "netgo" tag come from? |
||
| output: _dist/{{ .Os }}-{{ .Arch }}/helm | ||
|
|
||
| archives: | ||
| - id: default | ||
| name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
| format: tar.gz | ||
| files: | ||
| - LICENSE | ||
| - README.md | ||
| - _dist/{{ .Os }}-{{ .Arch }}/helm | ||
|
|
||
| checksum: | ||
| name_template: checksums.txt | ||
|
|
||
| snapshot: | ||
| name_template: "{{ .Commit }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,14 +31,26 @@ jobs: | |
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # [email protected] | ||
| with: | ||
| go-version: '${{ env.GOLANG_VERSION }}' | ||
|
|
||
| - name: Run unit tests | ||
| run: make test-coverage | ||
|
|
||
| - name: Build Helm Binaries | ||
| run: | | ||
| set -eu -o pipefail | ||
|
|
||
| make build-cross VERSION="${{ github.ref_name }}" | ||
| make dist checksum VERSION="${{ github.ref_name }}" | ||
| - name: Run Go Release | ||
| uses: goreleaser/[email protected] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to pin to a specific release via hash (see other |
||
| if: success() && startsWith(github.ref, 'refs/tags/') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| with: | ||
| version: latest | ||
| args: release --rm-dist | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
|
|
||
| - name: Verify checksum | ||
| run: | | ||
| make dist checksum VERSION="${{ github.ref_name }}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unless I'm mistaken, please use one or the other (preference would be to use goreleaser, rather than makefile logic I think) |
||
|
|
||
| - name: Set latest version | ||
| run: | | ||
|
|
@@ -93,10 +105,18 @@ jobs: | |
| - name: Run unit tests | ||
| run: make test-coverage | ||
|
|
||
| - name: Build Helm Binaries | ||
| - name: Run Go Release | ||
| uses: goreleaser/[email protected] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.) |
||
| if: success() && startsWith(github.ref, 'refs/tags/') | ||
| with: | ||
| version: latest | ||
| args: release --rm-dist | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
|
|
||
| - name: Verify checksum | ||
| run: | | ||
| make build-cross | ||
| make dist checksum VERSION="canary" | ||
| make dist checksum VERSION="canary" | ||
|
|
||
| - name: Upload Binaries | ||
| uses: bacongobbler/azure-blob-storage-upload@50f7d898b7697e864130ea04c303ca38b5751c50 # [email protected] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,12 @@ | ||
| BINDIR := $(CURDIR)/bin | ||
| INSTALL_PATH ?= /usr/local/bin | ||
| DIST_DIRS := find * -type d -exec | ||
| TARGETS := darwin/amd64 darwin/arm64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x linux/riscv64 windows/amd64 windows/arm64 | ||
| TARGET_OBJS ?= darwin-amd64.tar.gz darwin-amd64.tar.gz.sha256 darwin-amd64.tar.gz.sha256sum darwin-arm64.tar.gz darwin-arm64.tar.gz.sha256 darwin-arm64.tar.gz.sha256sum linux-amd64.tar.gz linux-amd64.tar.gz.sha256 linux-amd64.tar.gz.sha256sum linux-386.tar.gz linux-386.tar.gz.sha256 linux-386.tar.gz.sha256sum linux-arm.tar.gz linux-arm.tar.gz.sha256 linux-arm.tar.gz.sha256sum linux-arm64.tar.gz linux-arm64.tar.gz.sha256 linux-arm64.tar.gz.sha256sum linux-ppc64le.tar.gz linux-ppc64le.tar.gz.sha256 linux-ppc64le.tar.gz.sha256sum linux-s390x.tar.gz linux-s390x.tar.gz.sha256 linux-s390x.tar.gz.sha256sum linux-riscv64.tar.gz linux-riscv64.tar.gz.sha256 linux-riscv64.tar.gz.sha256sum windows-amd64.zip windows-amd64.zip.sha256 windows-amd64.zip.sha256sum windows-arm64.zip windows-arm64.zip.sha256 windows-arm64.zip.sha256sum | ||
| BINNAME ?= helm | ||
|
|
||
| GOBIN = $(shell go env GOBIN) | ||
| ifeq ($(GOBIN),) | ||
| GOBIN = $(shell go env GOPATH)/bin | ||
| endif | ||
| GOX = $(GOBIN)/gox | ||
| GOIMPORTS = $(GOBIN)/goimports | ||
| ARCH = $(shell go env GOARCH) | ||
|
|
||
|
|
@@ -131,8 +128,7 @@ test-source-headers: | |
| @scripts/validate-license.sh | ||
|
|
||
| .PHONY: test-acceptance | ||
| test-acceptance: TARGETS = linux/amd64 | ||
| test-acceptance: build build-cross | ||
| test-acceptance: build build-linux-amd64 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, we previously did this to:
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) |
||
| @if [ -d "${ACCEPTANCE_DIR}" ]; then \ | ||
| cd ${ACCEPTANCE_DIR} && \ | ||
| ROBOT_RUN_TESTS=$(ACCEPTANCE_RUN_TESTS) ROBOT_HELM_PATH='$(BINDIR)' make acceptance; \ | ||
|
|
@@ -167,19 +163,20 @@ gen-test-golden: test-unit | |
| # dependencies to the go.mod file. To avoid that we change to a directory | ||
| # without a go.mod file when downloading the following dependencies | ||
|
|
||
| $(GOX): | ||
| (cd /; go install github.com/mitchellh/[email protected]) | ||
|
|
||
| $(GOIMPORTS): | ||
| (cd /; go install golang.org/x/tools/cmd/goimports@latest) | ||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # release | ||
|
|
||
| .PHONY: build-cross | ||
| build-cross: LDFLAGS += -extldflags "-static" | ||
| build-cross: $(GOX) | ||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
don't you want/need to refer to the config file? And why is |
||
|
|
||
| .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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to use (for consistency) |
||
|
|
||
| .PHONY: dist | ||
| dist: | ||
|
|
||
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.
How are you testing this change? A superficial run fails with: