Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile: Run mixtool in container #9117

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ mimir-build-image/$(UPTODATE): mimir-build-image/*
# All the boiler plate for building golang follows:
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
BUILD_IN_CONTAINER ?= true
LATEST_BUILD_IMAGE_TAG ?= pr9070-5347ec889b
LATEST_BUILD_IMAGE_TAG ?= pr9117-daf8649bf3

# TTY is parameterized to allow Google Cloud Builder to run builds,
# as it currently disallows TTY devices. This value needs to be overridden
Expand All @@ -300,7 +300,7 @@ GOVOLUMES= -v mimir-go-cache:/go/cache \
# Mount local ssh credentials to be able to clone private repos when doing `mod-check`
SSHVOLUME= -v ~/.ssh/:/root/.ssh:$(CONTAINER_MOUNT_OPTIONS)

exes $(EXES) $(EXES_RACE) protos $(PROTO_GOS) lint lint-packaging-scripts test test-with-race cover shell mod-check check-protos doc format dist build-mixin format-mixin check-mixin-tests license check-license conftest-fmt check-conftest-fmt helm-conftest-test helm-conftest-quick-test conftest-verify check-helm-tests build-helm-tests print-go-version: fetch-build-image
exes $(EXES) $(EXES_RACE) protos $(PROTO_GOS) lint lint-packaging-scripts test test-with-race cover shell mod-check check-protos doc format dist build-mixin format-mixin check-mixin check-mixin-jb check-mixin-mixtool check-mixin-tests license check-license conftest-fmt check-conftest-fmt helm-conftest-test helm-conftest-quick-test conftest-verify check-helm-tests build-helm-tests print-go-version: fetch-build-image
@echo ">>>> Entering build container: $@"
$(SUDO) time docker run --rm $(TTY) -i $(SSHVOLUME) $(GOVOLUMES) $(BUILD_IMAGE) GOOS=$(GOOS) GOARCH=$(GOARCH) BINARY_SUFFIX=$(BINARY_SUFFIX) $@;

Expand Down Expand Up @@ -586,6 +586,26 @@ check-mixin-tests: ## Test the mixin files.
format-mixin: ## Format the mixin files.
@find $(MIXIN_PATH) -type f -name '*.libsonnet' | xargs jsonnetfmt -i

check-mixin: ## Build, format and check the mixin files.
check-mixin: build-mixin format-mixin check-mixin-jb check-mixin-mixtool check-mixin-runbooks
@echo "Checking diff:"
@for suffix in $(MIXIN_OUT_PATH_SUFFIXES); do \
./tools/find-diff-or-untracked.sh $(MIXIN_PATH) "$(MIXIN_OUT_PATH)$$suffix" || (echo "Please build and format mixin by running 'make build-mixin format-mixin'" && false); \
done

@echo "Running mixtool version $$(mixtool --version)"
@cd $(MIXIN_PATH) && \
jb install && \
mixtool lint mixin.libsonnet

check-mixin-jb:
@cd $(MIXIN_PATH) && \
jb install

check-mixin-mixtool: check-mixin-jb
@cd $(MIXIN_PATH) && \
mixtool lint mixin.libsonnet

# Helm static tests

HELM_SCRIPTS_PATH=operations/helm/scripts
Expand Down Expand Up @@ -674,24 +694,6 @@ check-white-noise: ## Check the white noise in the markdown files.
check-white-noise: clean-white-noise
@git diff --exit-code -- '*.md' || (echo "Please remove trailing whitespaces running 'make clean-white-noise'" && false)

check-mixin: ## Build, format and check the mixin files.
check-mixin: build-mixin format-mixin check-mixin-jb check-mixin-mixtool check-mixin-runbooks
@echo "Checking diff:"
@for suffix in $(MIXIN_OUT_PATH_SUFFIXES); do \
./tools/find-diff-or-untracked.sh $(MIXIN_PATH) "$(MIXIN_OUT_PATH)$$suffix" || (echo "Please build and format mixin by running 'make build-mixin format-mixin'" && false); \
done

@cd $(MIXIN_PATH) && \
jb install && \
mixtool lint mixin.libsonnet

check-mixin-jb:
@cd $(MIXIN_PATH) && \
jb install

check-mixin-mixtool: check-mixin-jb
@cd $(MIXIN_PATH) && \
mixtool lint mixin.libsonnet

check-mixin-runbooks: build-mixin
@tools/lint-runbooks.sh
Expand Down
2 changes: 1 addition & 1 deletion mimir-build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ RUN GO111MODULE=on \
go install github.com/fatih/[email protected] && \
go install github.com/campoy/[email protected] && \
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected] && \
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@b97ae11 && \
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@1aace356d01747eea16a2677ed13bdcbbd4bb082 && \
go install github.com/mikefarah/yq/[email protected] && \
go install github.com/google/go-jsonnet/cmd/[email protected] && \
go install github.com/google/go-jsonnet/cmd/[email protected] && \
Expand Down
Loading