Skip to content

Commit

Permalink
makefile: Pinned all tools; Added liche dep for markdown link check. (#…
Browse files Browse the repository at this point in the history
…737)

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka authored Jan 16, 2019
1 parent c9dd273 commit 7d30beb
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 32 deletions.
59 changes: 36 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,26 @@ DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))-$(she
FIRST_GOPATH ?= $(firstword $(subst :, ,$(shell go env GOPATH)))
TMP_GOPATH ?= /tmp/thanos-go
BIN_DIR ?= $(FIRST_GOPATH)/bin
GOIMPORTS ?= $(BIN_DIR)/goimports
PROMU ?= $(BIN_DIR)/promu
DEP_FINISHED ?= .dep-finished
ERRCHECK ?= $(BIN_DIR)/errcheck
EMBEDMD ?= $(BIN_DIR)/embedmd

# Tools.
DEP ?= $(BIN_DIR)/dep-$(DEP_VERSION)

DEP_VERSION ?=45be32ba4708aad5e2aa8c86f9432c4c4c1f8da2
DEP_VERSION ?= 45be32ba4708aad5e2aa8c86f9432c4c4c1f8da2
EMBEDMD ?= $(BIN_DIR)/embedmd-$(EMBEDMD_VERSION)
# v2.0.0
EMBEDMD_VERSION ?= 97c13d6e41602fc6e397eb51c45f38069371a969
ERRCHECK ?= $(BIN_DIR)/errcheck-$(ERRCHECK_VERSION)
# v1.2.0
ERRCHECK_VERSION ?= e14f8d59a22d460d56c5ee92507cd94c78fbf274
LICHE ?= $(BIN_DIR)/liche-$(LICHE_VERSION)
LICHE_VERSION ?= 2a2e6e56f6c615c17b2e116669c4cdb31b5453f3
GOIMPORTS ?= $(BIN_DIR)/goimports-$(GOIMPORTS_VERSION)
GOIMPORTS_VERSION ?= 1c3d964395ce8f04f3b03b30aaed0b096c08c3c6
PROMU ?= $(BIN_DIR)/promu-$(PROMU_VERSION)
# v0.2.0
PROMU_VERSION ?= 264dc36af9ea3103255063497636bd5713e3e9c1

# E2e test deps.
SUPPORTED_PROM_VERSIONS ?=v2.0.0 v2.2.1 v2.3.2 v2.4.3 v2.5.0
ALERTMANAGER_VERSION ?=v0.15.2
MINIO_SERVER_VERSION ?=RELEASE.2018-10-06T00-15-16Z
Expand Down Expand Up @@ -93,12 +104,13 @@ docker-push:
# docs regenerates flags in docs for all thanos commands.
.PHONY: docs
docs: $(EMBEDMD) build
@scripts/genflagdocs.sh
@EMBEDMD_BIN="$(EMBEDMD)" scripts/genflagdocs.sh

# check-docs checks if documentation have discrepancy with flags
# check-docs checks if documentation have discrepancy with flags and if the links are valid.
.PHONY: check-docs
check-docs: $(EMBEDMD) build
@scripts/genflagdocs.sh check
check-docs: $(EMBEDMD) $(LICHE) build
@EMBEDMD_BIN="$(EMBEDMD)" scripts/genflagdocs.sh check
@$(LICHE) --recursive docs --document-root .

# errcheck performs static analysis and returns error if any of the errors is not checked.
.PHONY: errcheck
Expand Down Expand Up @@ -165,24 +177,25 @@ vendor: Gopkg.toml Gopkg.lock $(DEP_FINISHED) | $(DEP)
@echo ">> dep ensure"
@$(DEP) ensure $(DEPARGS) || rm $(DEP_FINISHED)

$(GOIMPORTS):
@echo ">> fetching goimports"
@go get -u golang.org/x/tools/cmd/goimports
$(DEP_FINISHED):
@touch $(DEP_FINISHED)

$(PROMU):
@echo ">> fetching promu"
GOOS= GOARCH= go get -u github.com/prometheus/promu
# tooling deps. TODO(bwplotka): Pin them all to certain version!

$(DEP):
$(call fetch_go_bin_version,github.com/golang/dep/cmd/dep,$(DEP_VERSION))

$(DEP_FINISHED):
@touch $(DEP_FINISHED)
$(EMBEDMD):
$(call fetch_go_bin_version,github.com/campoy/embedmd,$(EMBEDMD_VERSION))

$(ERRCHECK):
@echo ">> fetching errcheck"
@go get -u github.com/kisielk/errcheck
$(call fetch_go_bin_version,github.com/kisielk/errcheck,$(ERRCHECK_VERSION))

$(EMBEDMD):
@echo ">> install campoy/embedmd"
@go get -u github.com/campoy/embedmd
$(GOIMPORTS):
$(call fetch_go_bin_version,golang.org/x/tools/cmd/goimports,$(GOIMPORTS_VERSION))

$(LICHE):
$(call fetch_go_bin_version,github.com/raviqqe/liche,$(LICHE_VERSION))

$(PROMU):
$(call fetch_go_bin_version,github.com/prometheus/promu,$(PROMU_VERSION))
1 change: 0 additions & 1 deletion benchmark/cmd/thanosbench/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
prom "github.com/prometheus/prometheus/config"
"gopkg.in/yaml.v2"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
6 changes: 3 additions & 3 deletions docs/release_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Additionally we aim for `master` branch being stable.
Process of cutting a new *minor* Thanos release:

1. Add PR on branch `release-<major>.<minor>` that will start minor release branch and prepare changes to cut release.
1. Bump [VERSION file](./VERSION)
1. Update [CHANGELOG file](./CHANGELOG.md)
1. Bump [VERSION file](/VERSION)
1. Update [CHANGELOG file](/CHANGELOG.md)
Note that `CHANGELOG.md` should only document changes relevant to users of Thanos, including external API changes, performance improvements, and new features. Do not document changes of internal interfaces, code refactorings and clean-ups, changes to the build process, etc. People interested in these are asked to refer to the git history.
Format is described in `CHANGELOG.md`.

Expand All @@ -39,7 +39,7 @@ Process of cutting a new *minor* Thanos release:
Go to the releases page of the project, click on the `Draft a new release` button and select the tag you just pushed. Describe release and post relevant entry from changelog. Click `Save draft` rather than `Publish release` at this time. (This will prevent the release being visible before it has got the binaries attached to it.)
Once tarballs are published on release page, you can click `Publish` and release is complete. Announce `#thanos` slack channel.
1. After release on second PR just after, add `-master` [VERSION file](./VERSION) suffix to the end of version. This will ensure master built images will have different version then released one.
1. After release on second PR just after, add `-master` [VERSION file](/VERSION) suffix to the end of version. This will ensure master built images will have different version then released one.
## Branch management and versioning strategy
Expand Down
2 changes: 1 addition & 1 deletion pkg/objstore/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string) (*B
} else {
chain = []credentials.Provider{
&credentials.EnvAWS{},
&credentials.FileAWSCredentials{},
&credentials.FileAWSCredentials{},
&credentials.IAM{
Client: &http.Client{
Transport: http.DefaultTransport,
Expand Down
4 changes: 2 additions & 2 deletions pkg/store/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ func (p *PrometheusStore) Series(r *storepb.SeriesRequest, s storepb.Store_Serie
return nil
}

func(p *PrometheusStore) chunkSamples(series prompb.TimeSeries, samplesPerChunk int) ([]storepb.AggrChunk, error) {
func (p *PrometheusStore) chunkSamples(series prompb.TimeSeries, samplesPerChunk int) ([]storepb.AggrChunk, error) {
var aggregatedChunks []storepb.AggrChunk
samples := series.Samples

for len(samples) > 0 {
chunkSize := len(samples)
if chunkSize > samplesPerChunk {
if chunkSize > samplesPerChunk {
chunkSize = samplesPerChunk
}

Expand Down
6 changes: 4 additions & 2 deletions scripts/genflagdocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
set -e
set -u

EMBEDMD_BIN=${EMBEDMD_BIN:-embedmd}

function docs {
# if check arg was passed, instead of the docs generation verifies if docs coincide with the codebase
if [[ "${CHECK}" == "check" ]]; then
set +e
DIFF=$(embedmd -d *.md)
DIFF=$(${EMBEDMD_BIN} -d *.md)
RESULT=$?
if [[ "$RESULT" != "0" ]]; then
cat << EOF
Expand All @@ -19,7 +21,7 @@ EOF
exit 2
fi
else
embedmd -w *.md
${EMBEDMD_BIN} -w *.md
fi

}
Expand Down

0 comments on commit 7d30beb

Please sign in to comment.