Skip to content

Commit 67bd71f

Browse files
authored
build: optimize binary builds with -trimpath and -buildid= (#422)
- Add -trimpath flag to remove absolute paths for reproducible builds - Add -buildid= to strip build ID for consistent binary hashes
1 parent c7ca0da commit 67bd71f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

goreleaser.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ builds:
44
- id: "pipeleek"
55
main: ./cmd/pipeleek
66
binary: pipeleek
7+
flags:
8+
- -trimpath
79
goos:
810
- linux
911
- windows
@@ -13,6 +15,7 @@ builds:
1315
- arm64
1416
ldflags:
1517
- -s -w
18+
- -buildid=
1619
- -X github.com/CompassSecurity/pipeleek/internal/cmd.Version={{.Version}}
1720
- -X github.com/CompassSecurity/pipeleek/internal/cmd.Commit={{.Commit}}
1821
- -X github.com/CompassSecurity/pipeleek/internal/cmd.Date={{.Date}}
@@ -21,6 +24,8 @@ builds:
2124
skip: "{{ .IsSnapshot }}"
2225
main: ./cmd/pipeleek-gitlab
2326
binary: pipeleek-gitlab
27+
flags:
28+
- -trimpath
2429
goos:
2530
- linux
2631
- windows
@@ -30,13 +35,16 @@ builds:
3035
- arm64
3136
ldflags:
3237
- -s -w
38+
- -buildid=
3339
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Version={{.Version}}
3440
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Commit={{.Commit}}
3541
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}}
3642
- id: "pipeleek-github"
3743
skip: "{{ .IsSnapshot }}"
3844
main: ./cmd/pipeleek-github
3945
binary: pipeleek-github
46+
flags:
47+
- -trimpath
4048
goos:
4149
- linux
4250
- windows
@@ -46,13 +54,16 @@ builds:
4654
- arm64
4755
ldflags:
4856
- -s -w
57+
- -buildid=
4958
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Version={{.Version}}
5059
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Commit={{.Commit}}
5160
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}}
5261
- id: "pipeleek-bitbucket"
5362
skip: "{{ .IsSnapshot }}"
5463
main: ./cmd/pipeleek-bitbucket
5564
binary: pipeleek-bitbucket
65+
flags:
66+
- -trimpath
5667
goos:
5768
- linux
5869
- windows
@@ -62,13 +73,16 @@ builds:
6273
- arm64
6374
ldflags:
6475
- -s -w
76+
- -buildid=
6577
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Version={{.Version}}
6678
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Commit={{.Commit}}
6779
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}}
6880
- id: "pipeleek-devops"
6981
skip: "{{ .IsSnapshot }}"
7082
main: ./cmd/pipeleek-devops
7183
binary: pipeleek-devops
84+
flags:
85+
- -trimpath
7286
goos:
7387
- linux
7488
- windows
@@ -78,13 +92,16 @@ builds:
7892
- arm64
7993
ldflags:
8094
- -s -w
95+
- -buildid=
8196
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Version={{.Version}}
8297
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Commit={{.Commit}}
8398
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}}
8499
- id: "pipeleek-gitea"
85100
skip: "{{ .IsSnapshot }}"
86101
main: ./cmd/pipeleek-gitea
87102
binary: pipeleek-gitea
103+
flags:
104+
- -trimpath
88105
goos:
89106
- linux
90107
- windows
@@ -94,6 +111,7 @@ builds:
94111
- arm64
95112
ldflags:
96113
- -s -w
114+
- -buildid=
97115
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Version={{.Version}}
98116
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Commit={{.Commit}}
99117
- -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}}

0 commit comments

Comments
 (0)