Skip to content

Commit

Permalink
Build weeklies with debug information (#3415)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonswine authored Jul 15, 2024
1 parent 59d8af6 commit e464466
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/weekly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
run: echo "GORELEASER_CURRENT_TAG=v0.0.0-$(./tools/image-tag)" >> $GITHUB_ENV
- name: Set WEEKLY_IMAGE_TAG
run: echo "WEEKLY_IMAGE_TAG=$(./tools/image-tag)" >> $GITHUB_ENV
- name: Set GORELEASER_STRIP_DEBUG_INFO=false, so binaries are not stripped of debug info
run: echo "GORELEASER_STRIP_DEBUG_INFO=false" >> $GITHUB_ENV
# Forces goreleaser to use the correct previous tag for the changelog
- name: Set GORELEASER_PREVIOUS_TAG
run: echo "GORELEASER_PREVIOUS_TAG=$(git tag -l --sort=-version:refname | grep -E '^weekly-.*' | head -n 2 | tail -1)" >> $GITHUB_ENV
Expand Down
9 changes: 6 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ version: 2
before:
hooks:
# This hook ensures that goreleaser uses the correct go version for a Pyroscope release
- sh -euc "go version | grep "go version go1.21.11 " || { echo "Unexpected go version"; exit 1; }"
- sh -euc 'go version | grep "go version go1.21.11 " || { echo "Unexpected go version"; exit 1; }'
env:
# Strip debug information from the binary by default, weekly builds will have debug information
- GORELEASER_DEBUG_INFO_FLAGS={{ if and (index .Env "GORELEASER_STRIP_DEBUG_INFO") (eq .Env.GORELEASER_STRIP_DEBUG_INFO "false") }}{{ else }}-s -w{{ end }}
builds:
- env:
- CGO_ENABLED=0
Expand All @@ -26,7 +29,7 @@ builds:
- embedassets
ldflags:
- >
-extldflags "-static" -s -w
-extldflags "-static" {{ .Env.GORELEASER_DEBUG_INFO_FLAGS }}
-X "github.com/grafana/pyroscope/pkg/util/build.Branch={{ .Branch }}"
-X "github.com/grafana/pyroscope/pkg/util/build.Version={{ .Version }}"
-X "github.com/grafana/pyroscope/pkg/util/build.Revision={{ .ShortCommit }}"
Expand All @@ -38,7 +41,7 @@ builds:
- netgo
ldflags:
- >
-extldflags "-static" -s -w
-extldflags "-static" {{ .Env.GORELEASER_DEBUG_INFO_FLAGS }}
-X "github.com/grafana/pyroscope/pkg/util/build.Branch={{ .Branch }}"
-X "github.com/grafana/pyroscope/pkg/util/build.Version={{ .Version }}"
-X "github.com/grafana/pyroscope/pkg/util/build.Revision={{ .ShortCommit }}"
Expand Down

0 comments on commit e464466

Please sign in to comment.