From 07f947fdb18c265ebab1bfa7bdc47f74a1b57f75 Mon Sep 17 00:00:00 2001 From: Bartlomiej Plotka Date: Thu, 14 May 2020 17:05:34 +0100 Subject: [PATCH] Fixed make docs Signed-off-by: Bartlomiej Plotka --- Dockerfile | 2 +- Makefile | 12 +++++++----- docs/components/compact.md | 3 +-- docs/components/store.md | 2 +- scripts/genflagdocs.sh | 7 ++++--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index bf71a154f3d..51cf401fb03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM quay.io/prometheus/busybox:latest LABEL maintainer="The Thanos Authors" -COPY thanos /bin/thanos +COPY /thanos_tmp_for_docker /bin/thanos ENTRYPOINT [ "/bin/thanos" ] diff --git a/Makefile b/Makefile index 46a3f6ed531..7ca3472902e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -PREFIX ?= $(shell pwd) FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print) DOCKER_IMAGE_REPO ?= quay.io/thanos/thanos @@ -176,8 +175,8 @@ react-app-start: $(REACT_APP_NODE_MODULES_PATH) .PHONY: build build: ## Builds Thanos binary using `promu`. build: check-git deps $(PROMU) - @echo ">> building binaries $(GOBIN)" - @$(PROMU) build --prefix $(PREFIX) + @echo ">> building Thanos binary in $(GOBIN)" + @$(PROMU) build --prefix $(GOBIN) .PHONY: crossbuild crossbuild: ## Builds all binaries for all platforms. @@ -193,8 +192,11 @@ deps: ## Ensures fresh go.mod and go.sum. .PHONY: docker docker: ## Builds 'thanos' docker with no tag. docker: build + @echo ">> copying Thanos from $(GOBIN) to ./thanos_tmp_for_docker" + @cp $(GOBIN)/thanos ./thanos_tmp_for_docker @echo ">> building docker image 'thanos'" @docker build -t "thanos" . + @rm ./thanos_tmp_for_docker .PHONY: docker-multi-stage docker-multi-stage: ## Builds 'thanos' docker image using multi-stage. @@ -212,13 +214,13 @@ docker-push: .PHONY: docs docs: ## Regenerates flags in docs for all thanos commands. docs: $(EMBEDMD) build - @EMBEDMD_BIN="$(EMBEDMD)" SED_BIN="$(SED)" scripts/genflagdocs.sh + @EMBEDMD_BIN="$(EMBEDMD)" SED_BIN="$(SED)" THANOS_BIN="$(GOBIN)/thanos" scripts/genflagdocs.sh @find . -type f -name "*.md" | SED_BIN="$(SED)" xargs scripts/cleanup-white-noise.sh .PHONY: check-docs check-docs: ## checks docs against discrepancy with flags, links, white noise. check-docs: $(EMBEDMD) $(LICHE) build - @EMBEDMD_BIN="$(EMBEDMD)" SED_BIN="$(SED)" scripts/genflagdocs.sh check + @EMBEDMD_BIN="$(EMBEDMD)" SED_BIN="$(SED)" THANOS_BIN="$(GOBIN)/thanos" scripts/genflagdocs.sh check @$(LICHE) --recursive docs --exclude "(couchdb.apache.org/bylaws.html|cloud.tencent.com|alibabacloud.com|zoom.us)" --document-root . @$(LICHE) --exclude "goreportcard.com" --document-root . *.md @find . -type f -name "*.md" | SED_BIN="$(SED)" xargs scripts/cleanup-white-noise.sh diff --git a/docs/components/compact.md b/docs/components/compact.md index 4272a29cf1a..1ca48e14a8a 100644 --- a/docs/components/compact.md +++ b/docs/components/compact.md @@ -74,8 +74,7 @@ In order to achieve this co-ordination, blocks are not deleted directly. Instead ## Flags -[embedmd]: # "flags/compact.txt $" - +[embedmd]:# (flags/compact.txt $) ```$ usage: thanos compact [] diff --git a/docs/components/store.md b/docs/components/store.md index fa9b1546dd9..daa69f36580 100644 --- a/docs/components/store.md +++ b/docs/components/store.md @@ -27,7 +27,7 @@ In general about 1MB of local disk space is required per TSDB block stored in th ## Flags -[embedmd]: # "flags/store.txt $" +[embedmd]:# (flags/store.txt $) ```$ usage: thanos store [] diff --git a/scripts/genflagdocs.sh b/scripts/genflagdocs.sh index 5e4543ce51f..108f8920f03 100755 --- a/scripts/genflagdocs.sh +++ b/scripts/genflagdocs.sh @@ -6,6 +6,7 @@ set -u EMBEDMD_BIN=${EMBEDMD_BIN:-embedmd} SED_BIN=${SED_BIN:-sed} +THANOS_BIN=${THANOS_BIN:-${GOBIN}/thanos} function docs { # If check arg was passed, instead of the docs generation verifies if docs coincide with the codebase. @@ -38,17 +39,17 @@ CHECK=${1:-} commands=("compact" "query" "rule" "sidecar" "store" "tools") for x in "${commands[@]}"; do - ./thanos "${x}" --help &> "docs/components/flags/${x}.txt" + ${THANOS_BIN} "${x}" --help &> "docs/components/flags/${x}.txt" done toolsCommands=("bucket" "rules-check") for x in "${toolsCommands[@]}"; do - ./thanos tools "${x}" --help &> "docs/components/flags/tools_${x}.txt" + ${THANOS_BIN} tools "${x}" --help &> "docs/components/flags/tools_${x}.txt" done toolsBucketCommands=("verify" "ls" "inspect" "web" "replicate" "downsample") for x in "${toolsBucketCommands[@]}"; do - ./thanos tools bucket "${x}" --help &> "docs/components/flags/tools_bucket_${x}.txt" + ${THANOS_BIN} tools bucket "${x}" --help &> "docs/components/flags/tools_bucket_${x}.txt" done # Remove white noise.