From aba955fa168bbfe40a3222ea606ba4f0bbc40449 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 16 Mar 2021 20:49:07 +0200 Subject: [PATCH] Makefile: prepare vmutils-windows-*.zip archive on `make release-vmutils` command The archive contains the following executables for Windows: * vmagent * vmalert * vmauth * vmctl Other components - vmbackup, vmrestore, victoria-metrics - aren't supported for Windows yet --- Makefile | 33 ++++++++++++++++++++++++++++++++- app/vmagent/Makefile | 6 ++++++ app/vmalert/Makefile | 6 ++++++ app/vmauth/Makefile | 6 ++++++ app/vmctl/Makefile | 6 ++++++ deployment/docker/Makefile | 24 ++++++++++++++++++++++++ docs/CHANGELOG.md | 1 + 7 files changed, 81 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e69e16662..2cc7a0849 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,12 @@ vmutils-arm64: \ vmrestore-arm64 \ vmctl-arm64 +vmutils-windows-amd64: \ + vmagent-windows-amd64 \ + vmalert-windows-amd64 \ + vmauth-windows-amd64 \ + vmctl-windows-amd64 + release-snap: snapcraft snapcraft upload "victoriametrics_$(PKG_TAG)_multi.snap" --release beta,edge,candidate @@ -89,7 +95,8 @@ release-victoria-metrics-generic: victoria-metrics-$(GOARCH)-prod release-vmutils: \ release-vmutils-amd64 \ - release-vmutils-arm64 + release-vmutils-arm64 \ + release-vmutils-windows-amd64 release-vmutils-amd64: GOARCH=amd64 $(MAKE) release-vmutils-generic @@ -97,6 +104,9 @@ release-vmutils-amd64: release-vmutils-arm64: GOARCH=arm64 $(MAKE) release-vmutils-generic +release-vmutils-windows-amd64: + GOARCH=amd64 $(MAKE) release-vmutils-windows-generic + release-vmutils-generic: \ vmagent-$(GOARCH)-prod \ vmalert-$(GOARCH)-prod \ @@ -121,6 +131,24 @@ release-vmutils-generic: \ vmctl-$(GOARCH)-prod \ | sed s/-$(GOARCH)// > vmutils-$(GOARCH)-$(PKG_TAG)_checksums.txt +release-vmutils-windows-generic: \ + vmagent-windows-$(GOARCH)-prod \ + vmalert-windows-$(GOARCH)-prod \ + vmauth-windows-$(GOARCH)-prod \ + vmctl-windows-$(GOARCH)-prod + cd bin && \ + zip vmutils-windows-$(GOARCH)-$(PKG_TAG).zip \ + vmagent-windows-$(GOARCH)-prod.exe \ + vmalert-windows-$(GOARCH)-prod.exe \ + vmauth-windows-$(GOARCH)-prod.exe \ + vmctl-windows-$(GOARCH)-prod.exe \ + && sha256sum vmutils-windows-$(GOARCH)-$(PKG_TAG).zip \ + vmagent-windows-$(GOARCH)-prod.exe \ + vmalert-windows-$(GOARCH)-prod.exe \ + vmauth-windows-$(GOARCH)-prod.exe \ + vmctl-windows-$(GOARCH)-prod.exe \ + > vmutils-windows-$(GOARCH)-$(PKG_TAG)_checksums.txt + pprof-cpu: go tool pprof -trim_path=github.com/VictoriaMetrics/VictoriaMetrics@ $(PPROF_FILE) @@ -194,6 +222,9 @@ app-local-pure: app-local-with-goarch: GO111MODULE=on go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-$(GOARCH)$(RACE) $(PKG_PREFIX)/app/$(APP_NAME) +app-local-windows-with-goarch: + CGO_ENABLED=0 GO111MODULE=on go build $(RACE) -mod=vendor -ldflags "$(GO_BUILDINFO)" -o bin/$(APP_NAME)-windows-$(GOARCH)$(RACE).exe $(PKG_PREFIX)/app/$(APP_NAME) + quicktemplate-gen: install-qtc qtc diff --git a/app/vmagent/Makefile b/app/vmagent/Makefile index 0ee29504d..7677340f4 100644 --- a/app/vmagent/Makefile +++ b/app/vmagent/Makefile @@ -78,3 +78,9 @@ vmagent-local-with-goarch: vmagent-pure: APP_NAME=vmagent $(MAKE) app-local-pure + +vmagent-windows-amd64: + GOARCH=amd64 APP_NAME=vmagent $(MAKE) app-local-windows-with-goarch + +vmagent-windows-amd64-prod: + APP_NAME=vmagent $(MAKE) app-via-docker-windows-amd64 diff --git a/app/vmalert/Makefile b/app/vmalert/Makefile index 8406b02e0..162429f98 100644 --- a/app/vmalert/Makefile +++ b/app/vmalert/Makefile @@ -88,3 +88,9 @@ vmalert-local-with-goarch: vmalert-pure: APP_NAME=vmalert $(MAKE) app-local-pure + +vmalert-windows-amd64: + GOARCH=amd64 APP_NAME=vmalert $(MAKE) app-local-windows-with-goarch + +vmalert-windows-amd64-prod: + APP_NAME=vmalert $(MAKE) app-via-docker-windows-amd64 diff --git a/app/vmauth/Makefile b/app/vmauth/Makefile index 03cf4cba0..2997d47d6 100644 --- a/app/vmauth/Makefile +++ b/app/vmauth/Makefile @@ -77,3 +77,9 @@ vmauth-local-with-goarch: vmauth-pure: APP_NAME=vmauth $(MAKE) app-local-pure + +vmauth-windows-amd64: + GOARCH=amd64 APP_NAME=vmauth $(MAKE) app-local-windows-with-goarch + +vmauth-windows-amd64-prod: + APP_NAME=vmauth $(MAKE) app-via-docker-windows-amd64 diff --git a/app/vmctl/Makefile b/app/vmctl/Makefile index b039877ba..6b28a1323 100644 --- a/app/vmctl/Makefile +++ b/app/vmctl/Makefile @@ -71,3 +71,9 @@ vmctl-local-with-goarch: vmctl-pure: APP_NAME=vmctl $(MAKE) app-local-pure + +vmctl-windows-amd64: + GOARCH=amd64 APP_NAME=vmctl $(MAKE) app-local-windows-with-goarch + +vmctl-windows-amd64-prod: + APP_NAME=vmctl $(MAKE) app-via-docker-windows-amd64 diff --git a/deployment/docker/Makefile b/deployment/docker/Makefile index 3fc7248a8..e8efa986b 100644 --- a/deployment/docker/Makefile +++ b/deployment/docker/Makefile @@ -39,6 +39,22 @@ app-via-docker: package-builder -tags 'netgo osusergo nethttpomithttp2' \ -o bin/$(APP_NAME)$(APP_SUFFIX)-prod $(PKG_PREFIX)/app/$(APP_NAME) +app-via-docker-windows: package-builder + mkdir -p gocache-for-docker + docker run --rm \ + --user $(shell id -u):$(shell id -g) \ + --mount type=bind,src="$(shell pwd)",dst=/VictoriaMetrics \ + -w /VictoriaMetrics \ + --mount type=bind,src="$(shell pwd)/gocache-for-docker",dst=/gocache \ + --env GOCACHE=/gocache \ + --env GO111MODULE=on \ + $(DOCKER_OPTS) \ + $(BUILDER_IMAGE) \ + go build $(RACE) -mod=vendor -trimpath \ + -ldflags "-s -w -extldflags '-static' $(GO_BUILDINFO)" \ + -tags 'netgo osusergo nethttpomithttp2' \ + -o bin/$(APP_NAME)-windows$(APP_SUFFIX)-prod.exe $(PKG_PREFIX)/app/$(APP_NAME) + package-via-docker: package-base (docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(DOCKER_NAMESPACE)/$(APP_NAME):$(PKG_TAG)$(APP_SUFFIX)$(RACE)$$') || (\ $(MAKE) app-via-docker && \ @@ -78,6 +94,11 @@ app-via-docker-goarch: DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=linux --env GOARCH=$(GOARCH)' \ $(MAKE) app-via-docker +app-via-docker-windows-goarch: + APP_SUFFIX='-$(GOARCH)' \ + DOCKER_OPTS='--env CGO_ENABLED=0 --env GOOS=windows --env GOARCH=$(GOARCH)' \ + $(MAKE) app-via-docker-windows + app-via-docker-goarch-cgo: CGO_ENABLED=1 $(MAKE) app-via-docker-goarch @@ -102,6 +123,9 @@ app-via-docker-ppc64le: app-via-docker-386: GOARCH=386 $(MAKE) app-via-docker-goarch-nocgo +app-via-docker-windows-amd64: + GOARCH=amd64 $(MAKE) app-via-docker-windows-goarch + package-via-docker-goarch: APP_SUFFIX='-$(GOARCH)' \ DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=linux --env GOARCH=$(GOARCH)' \ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index fbea8efc7..4f95915ea 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -15,6 +15,7 @@ * FEATURE: accept `round_digits` query arg at `/api/v1/query` and `/api/v1/query_range` handlers. This option can be set at Prometheus datasource in Grafana for limiting the number of digits after the decimal point in response values. * FEATURE: add `-influx.databaseNames` command-line flag, which can be used for accepting data from some Telegraf plugins such as [fluentd plugin](https://github.com/fangli/fluent-plugin-influxdb). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1124). * FEATURE: add `-logNewSeries` command-line flag, which can be used for debugging the source of time series churn rate. +* FEATURE: publish Windows builds for [vmagent](https://victoriametrics.github.io/vmagent.html), [vmalert](https://victoriametrics.github.io/vmalert.html), [vmauth](https://victoriametrics.github.io/vmauth.html) and [vmctl](https://victoriametrics.github.io/vmctl.html) at `vmutils-windows-*.zip` archives at [releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). * BUGFIX: vmagent: prevent from high CPU usage bug during failing scrapes with small `scrape_timeout` (less than a few seconds). * BUGFIX: vmagent: reduce memory usage when Kubernetes service discovery is used in big number of distinct scrape config jobs by sharing Kubernetes object cache. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1113