Skip to content

Commit

Permalink
Run mixtool in container
Browse files Browse the repository at this point in the history
Also updates mixtool to latest version which closes #1617
Mixtool was actually updated two months ago, so the dashboards are already all compliant!

For the Makefile changes, I was looking at the issue above and I wanted to test it using the build image. I noticed that it wasn't actually running in the container. This should make it easier to test in the future.
  • Loading branch information
julienduchesne committed Aug 27, 2024
1 parent 3c1f1c2 commit 52bf88b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
40 changes: 21 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 52bf88b

Please sign in to comment.