Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Output of `kubectl version`:

Cloud Provider/Platform (AKS, GKE, Minikube etc.):


38 changes: 38 additions & 0 deletions .github/workflows/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -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


builds:
- id: helm
main: ./cmd/helm
binary: helm
goos:
- 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.

- amd64
- arm64
goarm:
- 6
env:
- CGO_ENABLED=0
- GOFLAGS=-trimpath
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?

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 }}"
30 changes: 25 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

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.

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.

with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

- 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)


- name: Set latest version
run: |
Expand Down Expand Up @@ -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]

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.)

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]
Expand Down
19 changes: 8 additions & 11 deletions Makefile
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)

Expand Down Expand Up @@ -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

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)

@if [ -d "${ACCEPTANCE_DIR}" ]; then \
cd ${ACCEPTANCE_DIR} && \
ROBOT_RUN_TESTS=$(ACCEPTANCE_RUN_TESTS) ROBOT_HELM_PATH='$(BINDIR)' make acceptance; \
Expand Down Expand Up @@ -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

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?


.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?


.PHONY: dist
dist:
Expand Down