Skip to content
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

goreleaser: Add missing ldflags #1473

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gtirloni
Copy link

goreleaser creates binaries without the required ldflags (binaries built with it and added to archives have incorrect version).

This PR adds the same env vars and ldflags that are used in the Makefile to build standalone binaries.

Simulating a build for v52.0.0:

$ VER=v52.0.0 BUILD_TIMESTAMP=1703006570 COMMIT_HASH=cc9627c884b34fe145dc8a7aeedb18dca8ae19f4 GIT_BRANCH=master goreleaser build --clean --skip=validate --snapshot
  • starting build...
  • loading                                          path=.goreleaser.yml
  • skipping validate...
  • loading environment variables
  • getting and validating git state
    • ignoring errors because this is a snapshot     error=git doesn't contain any tags. Either add a tag or use --snapshot
    • git state                                      commit=965c7d12ce5775e90a44894f8f861b4225e4c8cc branch=fix/1468 current_tag=v0.0.0 previous_tag=<unknown> dirty=false
    • pipe skipped                                   reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
    • DEPRECATED:  brews.tap  should not be used anymore, check https://goreleaser.com/deprecations#brewstap for more info
  • snapshotting
    • building snapshot...                           version=0.0.0-SNAPSHOT-965c7d12
  • checking distribution directory
  • loading go mod information
  • build prerequisites
  • writing effective config file
    • writing                                        config=dist/config.yaml
  • building binaries
    • building                                       binary=dist/default_windows_386/kubeshark.exe
    • building                                       binary=dist/default_linux_amd64_v1/kubeshark
    • building                                       binary=dist/default_linux_arm64/kubeshark
    • building                                       binary=dist/default_linux_386/kubeshark
    • building                                       binary=dist/default_windows_amd64_v1/kubeshark.exe
    • building                                       binary=dist/default_darwin_arm64/kubeshark
    • building                                       binary=dist/default_windows_arm64/kubeshark.exe
    • building                                       binary=dist/default_darwin_amd64_v1/kubeshark
    • took: 3s
  • storing release metadata
    • writing                                        file=dist/artifacts.json
    • writing                                        file=dist/metadata.json
  • you are using deprecated options, check the output above for details
  • build succeeded after 2s
  • thanks for using goreleaser!

$ ./dist/default_linux_amd64_v1/kubeshark version
v52.0.0

Fixes #1468

Fixes kubeshark#1468

Signed-off-by: Giovanni Tirloni <gtirloni@tight-ship.net>
Signed-off-by: Giovanni Tirloni <gtirloni@tight-ship.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubeshark:51.0.39 reports version 0.0.0
1 participant