elastic / elastic/crd-ref-docs

Add flag for reading binary version

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
173
Forks
81
PR merge metrics
No merged PRs in 30d

Description

It would be nice to be able to get the version of the binary through a flag eg. `crd-ref-docs --version`. We rely on doing this in order to ensure that our team uses the right versions of binaries. We would like to be able to do something like this in our Makefile:

```Makefile
CRD_REF_DOCS ?= $(TOOLSBIN)/crd-ref-docs
CRD_REF_DOCS_GO_MOD_VERSION ?= $(shell cat tools/go.mod | grep -E "github.com/elastic/crd-ref-docs" | cut -d ' ' -f2)

.PHONY: crd-ref-docs
crd-ref-docs: ## 📦 Download crd-ref-docs locally if necessary.
(test -s $(CRD_REF_DOCS) && \
$(CRD_REF_DOCS) --version | grep $(CRD_REF_DOCS_GO_MOD_VERSION)) || \
(cd tools && GOBIN=$(TOOLSBIN) go install github.com/elastic/crd-ref-docs)
```

This make target will download the binary and install it in `./tools/bin` if it doesn't exist or the version doesn't match what we have in the go module in `./tools/go.mod`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.