Skip to content

Commit

Permalink
fix(debug): ensure reproducible builds in debug mode
Browse files Browse the repository at this point in the history
When use `--debug` build flag, a new dlv executable file is built into the image.
However, during the build, some build flags are not specified, resulting in
the binary being different each time, which ultimately causes the digest of
the image to be inconsistent.

This change aims to ensure that, as long as the remote dlv code has not been
updated, the digest remains consistent with each build.
  • Loading branch information
l-qing authored and imjasonh committed Nov 24, 2024
1 parent 8619a31 commit 6dedb1e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/build/gobuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ func getDelve(ctx context.Context, platform v1.Platform) (string, error) {
// install delve to tmp directory
args := []string{
"build",
"-trimpath",
"-ldflags=-s -w",
"-o",
delveBinaryPath,
"./cmd/dlv",
Expand Down

0 comments on commit 6dedb1e

Please sign in to comment.