Skip to content

Commit 145720a

Browse files
committed
udpate goreleaser config to include ldflags
clusterctl-operator version subcommand was not printing the version correctly in the previous releases. This commit fixes the same. Signed-off-by: Anurag <81210977+kranurag7@users.noreply.github.com>
1 parent d6e5f4f commit 145720a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.goreleaser.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ builds:
66
- id: "clusterctl-operator"
77
main: ./cmd/plugin
88
binary: bin/clusterctl-operator
9+
env:
10+
- CGO_ENABLED=0
11+
ldflags:
12+
- -s -w
13+
- -X 'sigs.k8s.io/cluster-api-operator/version.gitMajor={{.Major}}'
14+
- -X 'sigs.k8s.io/cluster-api-operator/version.gitMinor={{.Minor}}'
15+
- -X 'sigs.k8s.io/cluster-api-operator/version.gitVersion={{.Version}}'
16+
- -X 'sigs.k8s.io/cluster-api-operator/version.gitCommit={{.Commit}}'
17+
- -X 'sigs.k8s.io/cluster-api-operator/version.gitTreeState={{ if .IsGitDirty }}dirty{{ else }}clean{{ end }}'
18+
- -X 'sigs.k8s.io/cluster-api-operator/version.buildDate={{.Date}}'
919
goos:
1020
- linux
1121
- darwin

0 commit comments

Comments
 (0)