Skip to content

Commit 401de0c

Browse files
authored
Fix goreleaser build of goamd64v2 (#3949)
* Build goamd64 v2 without suffixes This needed some changes in the default naming templates. * Upgrade goreleser to v2.7.0 * Handle nproc correctly, also rm-dist is removed by clean * Address DEPRECATED: archives.format_overrides.format should not be used anymore, check https://goreleaser.com/deprecations#archivesformat_overridesformat for more info * Address DEPRECATED: snapshot.name_template should not be used anymore, check https://goreleaser.com/deprecations#snapshotname_template for more info
1 parent 2652020 commit 401de0c

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- uses: goreleaser/goreleaser-action@v6
5656
with:
5757
# ensure this aligns with the version specified in the /Makefile
58-
version: v2.0.1
58+
version: v2.7.0
5959
args: release --clean --timeout 60m
6060
env:
6161
GITHUB_TOKEN: ${{ steps.app-goreleaser.outputs.token }}

.github/workflows/weekly-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- uses: goreleaser/goreleaser-action@v6
5555
with:
5656
# ensure this aligns with the version specified in the /Makefile
57-
version: v2.0.1
57+
version: v2.7.0
5858
args: release --clean --skip=publish --timeout 60m
5959
env:
6060
GITHUB_TOKEN: ${{ steps.app-releaser.outputs.token }}

.goreleaser.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ dockers:
6666
- use: buildx
6767
goos: linux
6868
goarch: amd64
69+
goamd64: v2
6970
dockerfile: ./cmd/pyroscope/Dockerfile
7071
ids:
7172
- pyroscope
@@ -119,6 +120,7 @@ nfpms:
119120
vendor: Grafana Labs Inc
120121
homepage: https://grafana.com/pyroscope
121122
license: AGPL-3.0
123+
file_name_template: '{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v2") }}{{ .Amd64 }}{{ end }}'
122124
contents:
123125
- src: ./tools/packaging/pyroscope.service
124126
dst: /etc/systemd/system/pyroscope.service
@@ -130,19 +132,20 @@ nfpms:
130132

131133
archives:
132134
- id: pyroscope
135+
name_template: '{{.ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v2") }}{{ .Amd64 }}{{ end }}'
133136
builds:
134137
- pyroscope
135138
- id: profilecli
136-
name_template: 'profilecli_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
139+
name_template: 'profilecli_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v2") }}{{ .Amd64 }}{{ end }}'
137140
builds:
138141
- profilecli
139142
format_overrides:
140143
- goos: windows
141-
format: zip
144+
formats: [zip]
142145
checksum:
143146
name_template: "checksums.txt"
144147
snapshot:
145-
name_template: "{{ incpatch .Version }}-next"
148+
version_template: "{{ incpatch .Version }}-next"
146149
changelog:
147150
sort: asc
148151
filters:

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
2727
GIT_LAST_COMMIT_DATE := $(shell git log -1 --date=iso-strict --format=%cd)
2828
EMBEDASSETS ?= embedassets
2929

30+
UNAME_S := $(shell uname -s)
31+
ifeq ($(UNAME_S),Darwin)
32+
NPROC := $(shell sysctl -n hw.physicalcpu)
33+
else
34+
NPROC := $(shell nproc)
35+
endif
36+
3037
# Build flags
3138
VPREFIX := github.com/grafana/pyroscope/pkg/util/build
3239
GO_LDFLAGS := -X $(VPREFIX).Branch=$(GIT_BRANCH) -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).Revision=$(GIT_REVISION) -X $(VPREFIX).BuildDate=$(GIT_LAST_COMMIT_DATE)
@@ -113,19 +120,19 @@ release/prereq: $(BIN)/goreleaser ## Ensure release pre requesites are met
113120

114121
.PHONY: release
115122
release: release/prereq ## Create a release
116-
$(BIN)/goreleaser release -p=$(shell nproc) --rm-dist
123+
$(BIN)/goreleaser release -p=$(NPROC) --clean
117124

118125
.PHONY: release/prepare
119126
release/prepare: release/prereq ## Prepare a release
120-
$(BIN)/goreleaser release -p=$(shell nproc) --rm-dist --snapshot
127+
$(BIN)/goreleaser release -p=$(NPROC) --clean --snapshot
121128

122129
.PHONY: release/build/all
123130
release/build/all: release/prereq ## Build all release binaries
124-
$(BIN)/goreleaser build -p=$(shell nproc) --rm-dist --snapshot
131+
$(BIN)/goreleaser build -p=$(NPROC) --clean --snapshot
125132

126133
.PHONY: release/build
127134
release/build: release/prereq ## Build current platform release binaries
128-
$(BIN)/goreleaser build -p=$(shell nproc) --rm-dist --snapshot --single-target
135+
$(BIN)/goreleaser build -p=$(NPROC) --clean --snapshot --single-target
129136

130137
.PHONY: go/deps
131138
go/deps:
@@ -400,7 +407,7 @@ $(BIN)/updater: Makefile
400407
# Note: When updating the goreleaser version also update .github/workflow/release.yml and .git/workflow/weekly-release.yaml
401408
$(BIN)/goreleaser: Makefile go.mod
402409
@mkdir -p $(@D)
403-
GOBIN=$(abspath $(@D)) $(GO) install github.com/goreleaser/goreleaser/v2@v2.0.0
410+
GOBIN=$(abspath $(@D)) $(GO) install github.com/goreleaser/goreleaser/v2@v2.7.0
404411

405412
$(BIN)/gotestsum: Makefile go.mod
406413
@mkdir -p $(@D)

0 commit comments

Comments
 (0)