Skip to content

Commit

Permalink
Fixed make docs
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <[email protected]>
  • Loading branch information
bwplotka committed May 14, 2020
1 parent 7f78174 commit 07f947f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions docs/components/compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [<flags>]
Expand Down
2 changes: 1 addition & 1 deletion docs/components/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [<flags>]

Expand Down
7 changes: 4 additions & 3 deletions scripts/genflagdocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 07f947f

Please sign in to comment.