Skip to content

Commit

Permalink
backport: use main's Makefile.cli
Browse files Browse the repository at this point in the history
Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Feb 22, 2024
1 parent f309ed5 commit 54ce555
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile.cli
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright Authors of Tetragon

GO_BUILD = CGO_ENABLED=0 $(GO) build -tags standalone
CLI_GO_BUILD = CGO_ENABLED=0 $(GO) build
# renovate: datasource=docker
GO_IMAGE = docker.io/library/golang:1.22.0-alpine@sha256:8e96e6cff6a388c2f70f5f662b64120941fcd7d4b89d62fec87520323a316bd9
TARGET=tetra

RELEASE_UID ?= $(shell id -u)
Expand All @@ -11,7 +13,7 @@ cli-release:
docker run \
--rm \
--workdir /tetragon \
--volume `pwd`:/tetragon docker.io/library/golang:1.19.0-alpine3.16 \
--volume `pwd`:/tetragon $(GO_IMAGE) \
sh -c "apk add --no-cache make git setpriv && \
/usr/bin/setpriv --reuid=$(RELEASE_UID) --regid=$(RELEASE_GID) --clear-groups \
make GOCACHE=/tmp/cache cli-local-release VERSION=${VERSION}"
Expand All @@ -36,7 +38,7 @@ cli-local-release: cli-clean
for ARCH in $$ARCHS; do \
echo Building release binary for $$OS/$$ARCH...; \
test -d release/$$OS/$$ARCH|| mkdir -p release/$$OS/$$ARCH; \
env GOOS=$$OS GOARCH=$$ARCH $(GO_BUILD) -ldflags=$(GO_LDFLAGS) -o release/$$OS/$$ARCH/$(TARGET)$$EXT ./cmd/tetra; \
env GOOS=$$OS GOARCH=$$ARCH $(CLI_GO_BUILD) -ldflags="$(GO_BUILD_LDFLAGS)" -o release/$$OS/$$ARCH/$(TARGET)$$EXT ./cmd/tetra; \
tar -czf release/$(TARGET)-$$OS-$$ARCH.tar.gz -C release/$$OS/$$ARCH $(TARGET)$$EXT; \
(cd release && sha256sum $(TARGET)-$$OS-$$ARCH.tar.gz > $(TARGET)-$$OS-$$ARCH.tar.gz.sha256sum); \
done; \
Expand Down

0 comments on commit 54ce555

Please sign in to comment.