@@ -8,6 +8,10 @@ RELEASE_STRING := ${RELEASE_VERSION}
88COMMIT ?= $(shell git rev-parse HEAD || echo "unknown")
99LD_FLAGS ?= "-X 'main.integrationVersion=$(RELEASE_VERSION ) ' -X 'main.gitCommit=$(COMMIT ) '"
1010
11+ # FIPS builder image configuration
12+ GO_VERSION ?= $(shell grep '^go ' go.mod | awk '{print $$2}')
13+ BUILDER_IMAGE ?= "ghcr.io/newrelic/coreint-automation:latest-go$(GO_VERSION ) -ubuntu16.04"
14+
1115NRI_ECS_IMAGE_REPO ?= newrelic/nri-ecs
1216NRI_ECS_IMAGE_TAG ?= "dev"
1317NRI_ECS_IMAGE := $(NRI_ECS_IMAGE_REPO ) :$(NRI_ECS_IMAGE_TAG )
@@ -86,6 +90,43 @@ compile-multiarch:
8690 $(MAKE ) compile GOOS=linux GOARCH=arm64
8791 $(MAKE ) compile GOOS=linux GOARCH=arm
8892
93+ compile-multiarch-fips :
94+ $(MAKE ) compile-fips-docker-amd64
95+ $(MAKE ) compile-fips-docker-arm64
96+ @echo " All FIPS binaries compiled."
97+
98+ compile-all-multiarch :
99+ $(MAKE ) compile-multiarch
100+ $(MAKE ) compile-multiarch-fips
101+
102+ compile-fips-docker-amd64 :
103+ @echo " === $( INTEGRATION) === [ compile-fips-docker-amd64 ]: Building FIPS binary for linux/amd64 using builder image..."
104+ docker run --rm \
105+ --platform linux/amd64 \
106+ -v $(PWD ) :/src \
107+ -w /src \
108+ -e GOOS=linux \
109+ -e GOARCH=amd64 \
110+ -e CGO_ENABLED=1 \
111+ -e CC=gcc \
112+ -e GOEXPERIMENT=boringcrypto \
113+ $(BUILDER_IMAGE ) \
114+ go build -o bin/$(BINARY_NAME ) -fips-linux-amd64 -ldflags $(LD_FLAGS ) -tags fips ./cmd
115+
116+ compile-fips-docker-arm64 :
117+ @echo " === $( INTEGRATION) === [ compile-fips-docker-arm64 ]: Building FIPS binary for linux/arm64 using builder image..."
118+ docker run --rm \
119+ --platform linux/amd64 \
120+ -v $(PWD ) :/src \
121+ -w /src \
122+ -e GOOS=linux \
123+ -e GOARCH=arm64 \
124+ -e CGO_ENABLED=1 \
125+ -e CC=aarch64-linux-gnu-gcc \
126+ -e GOEXPERIMENT=boringcrypto \
127+ $(BUILDER_IMAGE ) \
128+ go build -o bin/$(BINARY_NAME ) -fips-linux-arm64 -ldflags $(LD_FLAGS ) -tags fips ./cmd
129+
89130# # GOOS and GOARCH are manually set so the output BINARY_NAME includes them as suffixes.
90131# # Additionally, DOCKER_BUILDKIT is set since it's needed for Docker to populate TARGETOS and TARGETARCH ARGs.
91132# # Here we call $(MAKE) build instead of using a dependency because the latter would, for some reason, prevent
@@ -119,4 +160,4 @@ buildThirdPartyNotice:
119160rt-update-changelog :
120161 curl " https://raw.githubusercontent.com/newrelic/release-toolkit/v1/contrib/ohi-release-notes/run.sh" | bash -s -- $(filter-out $@ ,$(MAKECMDGOALS ) )
121162
122- .PHONY : all build clean image compile compile-multiarch test buildLicenseNotice
163+ .PHONY : all build clean image compile compile-multiarch compile-multiarch-fips compile-all-multiarch compile-fips-docker-amd64 compile-fips-docker-arm64 test buildLicenseNotice
0 commit comments