chore: Sign project binary on MacOS

In order to be able to run the generated binary, it needs to be
"cosigned". Also, please note that we use the "codesign" binary that's
shipped in MacOS directly (instead of "promu codesign"), as that depends
on an image that doesn't support linux/arm64 (w.r.t. darwin's rosetta
emulation) yet:

```
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
```

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
This commit is contained in:
Pranshu Srivastava 2024-12-23 21:59:29 +05:30
parent 2ffaff82c8
commit ddddb00ed1
No known key found for this signature in database
GPG key ID: 63938388A4528764
2 changed files with 5 additions and 1 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@ benchmark.txt
/cmd/prometheus/debug
/benchout
/cmd/promtool/data
_CodeSignature
!/.travis.yml
!/.promu.yml

View file

@ -201,7 +201,10 @@ common-unused:
.PHONY: common-build
common-build: promu
@echo ">> building binaries"
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
@$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES) && \
if [ "$(GOHOSTOS)" = "darwin" ] && command -v codesign > /dev/null 2>&1; then \
codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime $(PREFIX) >/dev/null 2>&1; \
fi
.PHONY: common-tarball
common-tarball: promu