From e464466e0d6c0b17a94173be38ea7a4f66113d49 Mon Sep 17 00:00:00 2001 From: Christian Simon Date: Mon, 15 Jul 2024 04:26:49 +0100 Subject: [PATCH] Build weeklies with debug information (#3415) --- .github/workflows/weekly-release.yml | 2 ++ .goreleaser.yaml | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly-release.yml b/.github/workflows/weekly-release.yml index 03c3f732ec..7855a042f9 100644 --- a/.github/workflows/weekly-release.yml +++ b/.github/workflows/weekly-release.yml @@ -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 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 867395cfb9..b4ea1c9ea4 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 @@ -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 }}" @@ -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 }}"