From 3caac5edd4d60f9281e3d8341356735e81b3c9cf 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 | 3 +++ 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, 52 insertions(+) diff --git a/Makefile b/Makefile index e794b16034..af9525636d 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,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 0ee29504d3..7677340f4e 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 8406b02e0d..162429f988 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 03cf4cba0e..2997d47d67 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 b039877baa..6b28a13235 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 3fc7248a87..e8efa986bd 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 fbea8efc74..4f95915ea2 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