-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from VictoriaMetrics/config-updater-multiple-t…
…argets-support vmagent-config-updater: support multiple targets
- Loading branch information
Showing
30 changed files
with
2,797 additions
and
1,191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# All these commands must run from repository root. | ||
|
||
SERVICES_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
DOCKER_NAMESPACE := victoriametrics | ||
GO_BUILDER_IMAGE := golang:1.23.4-alpine | ||
|
||
BUILDINFO_TAG ?= $(shell echo $$(git describe --long --all | tr '/' '-')$$( \ | ||
git diff-index --quiet HEAD -- || echo '-dirty-'$$(git diff-index -u HEAD | openssl sha1 | cut -c 10-17))) | ||
|
||
PKG_TAG ?= $(shell git tag -l --points-at HEAD) | ||
ifeq ($(PKG_TAG),) | ||
PKG_TAG := $(BUILDINFO_TAG) | ||
endif | ||
|
||
%-exists: | ||
$(eval SERVICE := $*) | ||
if [ ! -d $(SERVICES_DIR)/$(SERVICE) ]; then \ | ||
echo "Service $(SERVICE) does not exist"; \ | ||
exit 1; \ | ||
fi | ||
|
||
%-go-build: %-exists | ||
$(eval SERVICE := $*) | ||
mkdir -p gocache-for-docker | ||
docker run --rm \ | ||
--user $(shell id -u):$(shell id -g) \ | ||
--mount type=bind,src="$(SERVICES_DIR)/$(SERVICE)",dst=/config-updater \ | ||
-w /config-updater \ | ||
--mount type=bind,src="$(SERVICES_DIR)/$(SERVICE)/gocache-for-docker",dst=/gocache \ | ||
--env GOCACHE=/gocache \ | ||
--env GO111MODULE=on \ | ||
--env CGO_ENABLED=0 \ | ||
--env GOOS=linux \ | ||
--env GOARCH=amd64 \ | ||
$(GO_BUILDER_IMAGE) \ | ||
go build -mod=vendor -trimpath -buildvcs=false \ | ||
-ldflags "-s -w -extldflags '-static'" \ | ||
-tags 'netgo osusergo nethttpomithttp2' \ | ||
-o bin/config-updater . | ||
|
||
%-go-package: %-go-build | ||
$(eval SERVICE := $*) | ||
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(DOCKER_NAMESPACE)/$(SERVICE):$(PKG_TAG)$$') || (\ | ||
docker build \ | ||
--tag $(DOCKER_NAMESPACE)/$(SERVICE):$(PKG_TAG) \ | ||
$(SERVICES_DIR)/$(SERVICE)) | ||
|
||
%-go-publish: %-go-package | ||
$(eval SERVICE := $*) | ||
docker push $(DOCKER_NAMESPACE)/$(SERVICE):$(PKG_TAG) | ||
|
||
%-go-package-run: %-go-package | ||
$(eval SERVICE := $*) | ||
docker run -it --rm \ | ||
--user $(shell id -u):$(shell id -g) \ | ||
--net host \ | ||
$(DOCKER_NAMESPACE)/$(SERVICE):$(PKG_TAG) | ||
|
||
%-go-run: %-exists | ||
$(eval SERVICE := $*) | ||
cd $(SERVICES_DIR)/$(SERVICE) && go run . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module vmagent-config-updater | ||
|
||
go 1.23.4 | ||
|
||
require gopkg.in/yaml.v3 v3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= | ||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
Oops, something went wrong.