Skip to content

Commit 6fc8354

Browse files
committed
chore: add ldf values in ko
1 parent cd535ff commit 6fc8354

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ on:
2020
- 'v*'
2121
branches:
2222
- main
23-
- 'pull-request/*'
2423
paths-ignore:
2524
- '**/*.md'
2625
- 'docs/**'

.ko.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@
1515
# .ko.yaml in the root of the repository
1616
defaultBaseImage: cgr.dev/chainguard/static:latest
1717
platforms: [linux/amd64, linux/arm64]
18-
19-
ldflags:
20-
- "-s -w"
21-
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
22-
2318
env: [CGO_ENABLED=0]
2419

2520
builds:
2621

2722
- id: fault-quarantine-module
2823
dir: fault-quarantine-module
2924
main: .
25+
ldflags:
26+
- "-s -w"
27+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
3028
labels:
3129
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
3230
org.opencontainers.image.licenses: "Apache-2.0"
@@ -39,6 +37,9 @@ builds:
3937
- id: fault-remediation-module
4038
dir: fault-remediation-module
4139
main: .
40+
ldflags:
41+
- "-s -w"
42+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
4243
labels:
4344
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
4445
org.opencontainers.image.licenses: "Apache-2.0"
@@ -51,6 +52,9 @@ builds:
5152
- id: health-events-analyzer
5253
dir: health-events-analyzer
5354
main: .
55+
ldflags:
56+
- "-s -w"
57+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
5458
labels:
5559
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
5660
org.opencontainers.image.licenses: "Apache-2.0"
@@ -63,6 +67,9 @@ builds:
6367
- id: csp-health-monitor
6468
dir: health-monitors/csp-health-monitor
6569
main: ./cmd/csp-health-monitor
70+
ldflags:
71+
- "-s -w"
72+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
6673
labels:
6774
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
6875
org.opencontainers.image.licenses: "Apache-2.0"
@@ -75,6 +82,9 @@ builds:
7582
- id: maintenance-notifier
7683
dir: health-monitors/csp-health-monitor
7784
main: ./cmd/maintenance-notifier
85+
ldflags:
86+
- "-s -w"
87+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
7888
labels:
7989
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
8090
org.opencontainers.image.licenses: "Apache-2.0"
@@ -87,6 +97,9 @@ builds:
8797
- id: labeler-module
8898
dir: labeler-module
8999
main: .
100+
ldflags:
101+
- "-s -w"
102+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
90103
labels:
91104
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
92105
org.opencontainers.image.licenses: "Apache-2.0"
@@ -99,6 +112,9 @@ builds:
99112
- id: node-drainer-module
100113
dir: node-drainer-module
101114
main: .
115+
ldflags:
116+
- "-s -w"
117+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
102118
labels:
103119
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
104120
org.opencontainers.image.licenses: "Apache-2.0"
@@ -111,6 +127,9 @@ builds:
111127
- id: janitor
112128
dir: janitor
113129
main: .
130+
ldflags:
131+
- "-s -w"
132+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
114133
labels:
115134
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
116135
org.opencontainers.image.licenses: "Apache-2.0"
@@ -123,6 +142,9 @@ builds:
123142
- id: platform-connectors
124143
dir: platform-connectors
125144
main: .
145+
ldflags:
146+
- "-s -w"
147+
- "-X main.version={{.Env.VERSION}} -X main.commit={{.Env.GIT_COMMIT}} -X main.date={{.Env.BUILD_DATE}}"
126148
labels:
127149
org.opencontainers.image.source: "https://github.com/nvidia/nvsentinel"
128150
org.opencontainers.image.licenses: "Apache-2.0"

scripts/buildko.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export VERSION="${VERSION:-v0.1.0}"
2323
export GIT_COMMIT="${GIT_COMMIT:-dev}"
2424
export BUILD_DATE=$(date -u +%FT%TZ)
2525

26+
# Display build variables for debugging
27+
echo "Build variables:"
28+
echo " VERSION=${VERSION}"
29+
echo " GIT_COMMIT=${GIT_COMMIT}"
30+
echo " BUILD_DATE=${BUILD_DATE}"
31+
2632
# Build flags - use PLATFORMS env var if set, otherwise use .ko.yaml defaults
2733
KO_FLAGS=(-B --image-refs=digests.txt --sbom=cyclonedx --tags="${VERSION}")
2834
if [ -n "${PLATFORMS:-}" ]; then

0 commit comments

Comments
 (0)