mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Add support for git worktrees in the tools image * Coalesce read configuration for recent data cutoff `query_frontend.search.query_ingesters_until` is removed in favor of only `query_frontend.search.query_backend_after` * Rever doc changes * Improve chlog entry
66 lines
2.1 KiB
Makefile
66 lines
2.1 KiB
Makefile
#
|
|
# Makefile fragment for installing tools
|
|
#
|
|
|
|
GO ?= go
|
|
GOFMT ?= gofmt
|
|
VENDOR_CMD ?= ${GO} mod tidy
|
|
GO_MOD_OUTDATED ?= go-mod-outdated
|
|
|
|
# Go file to track tool deps with go modules
|
|
TOOL_DIR ?= tools
|
|
TOOL_CONFIG ?= $(TOOL_DIR)/tools.go
|
|
|
|
TOOLS_IMAGE ?= grafana/tempo-ci-tools
|
|
TOOLS_IMAGE_TAG ?= main-36bd1c7
|
|
|
|
GOTOOLS ?= $(shell cd $(TOOL_DIR) && go list -e -f '{{ .Imports }}' -tags tools |tr -d '[]')
|
|
|
|
# Mount the git common directory to the tools container.
|
|
# This is needed when using git worktrees.
|
|
GIT_COMMON_DIR := $(shell git rev-parse --git-common-dir 2>/dev/null)
|
|
ifneq ($(strip $(GIT_COMMON_DIR)),)
|
|
ifneq ($(GIT_COMMON_DIR),.git)
|
|
WORKTREE_DOCKER_MOUNT := -v $(GIT_COMMON_DIR):$(GIT_COMMON_DIR)
|
|
endif
|
|
endif
|
|
|
|
TOOLS_CMD = docker run --rm -t -v ${PWD}:/tools $(WORKTREE_DOCKER_MOUNT) $(TOOLS_IMAGE):$(TOOLS_IMAGE_TAG)
|
|
LINT_CMD = docker run --rm -t -v ${PWD}:/tools $(WORKTREE_DOCKER_MOUNT) -v ${PWD}/.cache/golangci-lint:/root/.cache/golangci-lint $(TOOLS_IMAGE):$(TOOLS_IMAGE_TAG)
|
|
|
|
.PHONY: tools-image-build
|
|
tools-image-build:
|
|
@echo "=== [ tools-image-build]: Building tools image..."
|
|
@docker build -t $(TOOLS_IMAGE) -f ./tools/Dockerfile .
|
|
|
|
.PHONY: tools-docker
|
|
tools-docker:
|
|
@echo "=== [ tools-docker ]: Running tools in docker..."
|
|
@docker run -it -v $(shell pwd):/var/tempo $(TOOLS_IMAGE_NAME) make -C /var/tempo tools
|
|
|
|
tools-image:
|
|
@echo "=== [ tools-image ]: Running tools in docker..."
|
|
@docker pull $(TOOLS_IMAGE):$(TOOLS_IMAGE_TAG)
|
|
|
|
tools:
|
|
@echo "=== [ tools ]: Installing tools required by the project..."
|
|
@cd $(TOOL_DIR) && $(GO) install $(GOTOOLS)
|
|
@cd $(TOOL_DIR) && $(VENDOR_CMD)
|
|
|
|
tools-outdated:
|
|
@echo "=== [ tools-outdated ]: Finding outdated tool deps with $(GO_MOD_OUTDATED)..."
|
|
@cd $(TOOL_DIR) && $(GO) list -u -m -json all | $(GO_MOD_OUTDATED) -direct -update
|
|
|
|
tools-update:
|
|
@echo "=== [ tools-update ]: Updating tools required by the project..."
|
|
@cd $(TOOL_DIR) && for x in $(GOTOOLS); do \
|
|
$(GO) get -u $$x; \
|
|
done
|
|
@cd $(TOOL_DIR) && $(VENDOR_CMD)
|
|
|
|
.PHONY: tools tools-update tools-outdated
|
|
|
|
.PHONY: tools-update-mod
|
|
tools-update-mod:
|
|
@cd $(TOOL_DIR) && $(VENDOR_CMD)
|