Correctly set version info when building, fixed build script and added headers for apps endpoints.
This commit is contained in:
parent
cdf9997cfe
commit
e679fecf6e
6
Makefile
6
Makefile
@ -5,7 +5,7 @@ help: Makefile
|
||||
@echo -e "Metricator Makefile available subcommands:\n"
|
||||
@cat $< | grep "## " | sort | sed -n 's/^## //p'
|
||||
@echo ""
|
||||
@make -f Makefile show-git-data
|
||||
@make show-git-data
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
@ -14,8 +14,8 @@ check-build-dir:
|
||||
|
||||
## metricatord-build: builds metricator daemon and places into ${PWD}/._bin.
|
||||
metricatord-build: check-build-dir
|
||||
rm ./._bin/metricatord || true
|
||||
cd cmd/metricatord && go build -o ../../._bin/metricatord
|
||||
@rm ./._bin/metricatord || true
|
||||
@scripts/build.sh metricatord
|
||||
|
||||
## metricatord-run: starts metricator daemon.
|
||||
metricatord-run: metricatord-build
|
||||
|
@ -27,6 +27,8 @@ type Config struct {
|
||||
// Endpoint is a remote application endpoint which should give us metrics
|
||||
// in Prometheus format.
|
||||
Endpoint string
|
||||
// Headers is a list of headers that should be added to metrics request.
|
||||
Headers map[string]string
|
||||
// TimeBetweenRequests is a minimal amount of time which should pass
|
||||
// between requests.
|
||||
TimeBetweenRequests time.Duration
|
||||
|
@ -3,3 +3,15 @@
|
||||
# Metricator build script.
|
||||
|
||||
source ./scripts/shell_helpers/get_git_data.sh
|
||||
|
||||
WHATTOBUILD=$1
|
||||
|
||||
LINKERFLAGS="\
|
||||
-X go.dev.pztrn.name/metricator/internal/common.Branch=${BRANCHNAME} \
|
||||
-X go.dev.pztrn.name/metricator/internal/common.Build=${BUILDID} \
|
||||
-X go.dev.pztrn.name/metricator/internal/common.CommitHash=${COMMITHASH} \
|
||||
-X go.dev.pztrn.name/metricator/internal/common.Version=${VERSION}"
|
||||
|
||||
|
||||
cd cmd/${WHATTOBUILD}
|
||||
go build -tags netgo -ldflags "${LINKERFLAGS} -w -extldflags '-static'" -o ../../._bin/${WHATTOBUILD}
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Showing git data in console.
|
||||
source ./scripts/shell_helpers/get_git_data.sh
|
||||
|
||||
echo "* Branch: ${BRANCH}"
|
||||
echo "* Branch: ${BRANCHNAME}"
|
||||
echo "* Build ID: ${BUILDID}"
|
||||
echo "* Commit hash: ${COMMITHASH}"
|
||||
echo "* Version: ${VERSION}"
|
||||
|
Loading…
Reference in New Issue
Block a user