Skip to content

Commit 3810d1f

Browse files
authored
🧹 avoid reporting panics from dev environments (#5604)
* 🧹 avoid reporting panics from dev environments Signed-off-by: Salim Afiune Maya <afiune@mondoo.com> * 🧹 avoid setting Build variable Signed-off-by: Salim Afiune Maya <afiune@mondoo.com> --------- Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
1 parent 65e24c3 commit 3810d1f

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Makefile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ ifndef MANIFEST_VERSION
1010
MANIFEST_VERSION=$(shell git describe --abbrev=0 --tags)
1111
endif
1212

13-
ifndef TAG
14-
# echo "read TAG from git"
15-
TAG=$(shell git log --pretty=format:'%h' -n 1)
16-
endif
17-
1813
ifndef VERSION
1914
# echo "read VERSION from git"
2015
VERSION=${LATEST_VERSION_TAG}+$(shell git rev-list --count HEAD)
@@ -33,8 +28,8 @@ ifeq ($(TARGETOS),windows)
3328
BIN_SUFFIX=".exe"
3429
endif
3530

36-
LDFLAGS=-ldflags "-s -w -X go.mondoo.com/cnquery/v11.Version=${VERSION} -X go.mondoo.com/cnquery/v11.Build=${TAG}" # -linkmode external -extldflags=-static
37-
LDFLAGSDIST=-tags production -ldflags "-s -w -X go.mondoo.com/cnquery/v11.Version=${LATEST_VERSION_TAG} -X go.mondoo.com/cnquery/v11.Build=${TAG} -s -w"
31+
LDFLAGS=-ldflags "-s -w -X go.mondoo.com/cnquery/v11.Version=${VERSION}" # -linkmode external -extldflags=-static
32+
LDFLAGSDIST=-tags production -ldflags "-s -w -X go.mondoo.com/cnquery/v11.Version=${LATEST_VERSION_TAG} -s -w"
3833

3934
.PHONY: info/ldflags
4035
info/ldflags:
@@ -797,7 +792,7 @@ license/headers/apply:
797792
metrics/start: metrics/grafana/start metrics/prometheus/start
798793

799794
metrics/prometheus/start:
800-
APP_NAME=cnquery VERSION=${VERSION} BUILD=${TAG} prometheus --config.file=prometheus.yml
795+
APP_NAME=cnquery VERSION=${VERSION} prometheus --config.file=prometheus.yml
801796

802797
metrics/grafana/start:
803798
docker run -d --name=grafana \

providers-sdk/v1/upstream/health/errors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import (
2020
type PanicReportFn func(product, version, build string, r any, stacktrace []byte)
2121

2222
func ReportPanic(product, version, build string, reporters ...PanicReportFn) {
23+
if build == "" {
24+
return // avoid reporting panics from environments that don't set this variable
25+
}
26+
2327
if r := recover(); r != nil {
2428
sendPanic(product, version, build, r, debug.Stack())
2529

0 commit comments

Comments
 (0)