Skip to content

Commit 5ca5e26

Browse files
Build in fips mode
1 parent 59d70c7 commit 5ca5e26

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ FROM registry.ddbuild.io/images/mirror/golang:1.22 as builder
44
WORKDIR /go/src/kubernetes-csi/external-provisioner
55
ADD . .
66
ENV GOTOOLCHAIN auto
7-
ENV GOFLAGS="-buildvcs=false"
87
RUN make build
98

109
FROM $BASE_IMAGE

cmd/csi-provisioner/fips.go

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build fips
2+
3+
package main
4+
5+
import _ "crypto/tls/fipsonly"

release-tools/build.make

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ BUILD_PLATFORMS =
7979

8080
# Add go ldflags using LDFLAGS at the time of compilation.
8181
IMPORTPATH_LDFLAGS = -X main.version=$(REV)
82-
EXT_LDFLAGS = -extldflags "-static"
82+
EXT_LDFLAGS =
8383
LDFLAGS =
8484
FULL_LDFLAGS = $(LDFLAGS) $(IMPORTPATH_LDFLAGS) $(EXT_LDFLAGS)
8585
# This builds each command (= the sub-directories of ./cmd) for the target platform(s)
@@ -95,7 +95,7 @@ $(CMDS:%=build-%): build-%: check-go-version-go
9595
if ! [ $${#os_arch_seen_pre} = $${#os_arch_seen} ]; then \
9696
continue; \
9797
fi; \
98-
if ! (set -x; cd ./$(CMDS_DIR)/$* && CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -o "$(abspath ./bin)/$*$$suffix" .); then \
98+
if ! (set -x; cd ./$(CMDS_DIR)/$* && CGO_ENABLED=1 GOEXPERIMENT=boringcrypto GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -tags fips -o "$(abspath ./bin)/$*$$suffix" . && go tool nm "$(abspath ./bin)/$*$$suffix" | grep 'sig\.FIPSOnly'); then \
9999
echo "Building $* for GOOS=$$os GOARCH=$$arch failed, see error(s) above."; \
100100
exit 1; \
101101
fi; \

0 commit comments

Comments
 (0)