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

MON-3715: remove obsolete targets from Makefile #513

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ telemeter-bench
/bin
/benchmark
benchmark.pdf
/docs/telemeter_query

# These are empty target files, created on every docker build. Their sole
# purpose is to track the last target execution time to evalualte, whether the
Expand Down
30 changes: 4 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CACHE_DIR?=$(shell pwd)/_output/cache
METRICS_JSON=./_output/metrics.json
GOLANGCI_LINT_BIN=$(BIN_DIR)/golangci-lint
GOLANGCI_LINT_VERSION=v1.51.0
EMBEDMD_BIN=$(BIN_DIR)/embedmd
THANOS_BIN=$(BIN_DIR)/thanos
UP_BIN=$(BIN_DIR)/up
OTELCOL_BIN=$(BIN_DIR)/otelcol
Expand All @@ -32,7 +31,6 @@ JSONNET_SRC=$(shell find ./jsonnet -path ./jsonnet/vendor -prune -false -o -type
BENCHMARK_RESULTS=$(shell find ./telemeter-benchmark -type f -name '*.json')
BENCHMARK_GOAL?=5000
JSONNET_VENDOR=jsonnet/jsonnetfile.lock.json jsonnet/vendor
DOCS=$(shell grep -rlF [embedmd] docs)
TEST_E2E_CERTS_DIR=./cmd/rhelemeter-server/testdata

export PATH := $(BIN_DIR):$(PATH)
Expand All @@ -47,7 +45,7 @@ CONTAINER_CMD:=docker run --rm \
quay.io/coreos/jsonnet-ci

.PHONY: all
all: build manifests $(DOCS)
all: build manifests

.PHONY: clean
clean:
Expand Down Expand Up @@ -89,33 +87,16 @@ vendor:
go mod tidy
go mod verify

.PHONY: generate
generate: $(DOCS) manifests

.PHONY: generate-in-docker
generate-in-docker:
$(CONTAINER_CMD) $(MAKE) $(MFLAGS) generate

$(JSONNET_VENDOR): $(JB_BIN) jsonnet/jsonnetfile.json
cd jsonnet && $(JB_BIN) install

# Can't add test/timeseries.txt as a dependency, otherwise
# running make --always-make will try to regenerate the timeseries
# on CI, which will fail because there is no OpenShift cluster.
$(DOCS): $(JSONNET_SRC) $(EMBEDMD_BIN) docs/telemeter_query
$(EMBEDMD_BIN) -w $@

docs/telemeter_query: $(JSONNET_SRC)
query=""; \
for rule in $$(jsonnet metrics.json | jq -r '.[]'); do \
[ ! -z "$$query" ] && query="$$query or "; \
query="$$query$$rule"; \
done; \
echo "$$query" > $@

$(METRICS_JSON):
-$(METRICS_JSON):
curl -L https://raw.githubusercontent.com/openshift/cluster-monitoring-operator/844e7afabfcfa4162c716ea18cd8e2d010789de1/manifests/0000_50_cluster_monitoring_operator_04-config.yaml | \
$(GOJSONTOYAML_BIN) --yamltojson | jq -r '.data."metrics.yaml"' | $(GOJSONTOYAML_BIN) --yamltojson | jq -r '.matches' > $@
$(GOJSONTOYAML_BIN) --yamltojson | jq -r '.data."metrics.yaml"' | $(GOJSONTOYAML_BIN) --yamltojson | jq -r '.matches' > $@

manifests: $(JSONNET_LOCAL_OR_INSTALLED) $(JSONNET_SRC) $(JSONNET_VENDOR) $(GOJSONTOYAML_BIN) $(METRICS_JSON)
rm -rf manifests
Expand Down Expand Up @@ -232,7 +213,7 @@ test-rhelemeter-integration: build | $(THANOS_BIN) $(UP_BIN) $(PROMETHEUS_BIN) $
# Binaries #
############

dependencies: $(JB_BIN) $(THANOS_BIN) $(UP_BIN) $(EMBEDMD_BIN) $(GOJSONTOYAML_BIN) | $(PROMETHEUS_BIN) $(GOLANGCI_LINT_BIN) $(MEMCACHED_BIN)
dependencies: $(JB_BIN) $(THANOS_BIN) $(UP_BIN) $(GOJSONTOYAML_BIN) | $(PROMETHEUS_BIN) $(GOLANGCI_LINT_BIN) $(MEMCACHED_BIN)

$(BIN_DIR):
mkdir -p $@
Expand Down Expand Up @@ -266,9 +247,6 @@ $(THANOS_BIN): $(BIN_DIR)
$(UP_BIN): $(BIN_DIR)
GOBIN=$(BIN_DIR) go install -mod=readonly -modfile=tools/go.mod github.com/observatorium/up/cmd/up

$(EMBEDMD_BIN): $(BIN_DIR)
GOBIN=$(BIN_DIR) go install -mod=readonly -modfile=tools/go.mod github.com/campoy/embedmd

$(JSONNET_BIN): $(BIN_DIR)
GOBIN=$(BIN_DIR) go install -mod=readonly -modfile=tools/go.mod github.com/google/go-jsonnet/cmd/jsonnet

Expand Down
1 change: 0 additions & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.14

require (
github.com/brancz/gojsontoyaml v0.0.0-20200602132005-3697ded27e8c
github.com/campoy/embedmd v1.0.0
github.com/google/go-jsonnet v0.16.0
github.com/jsonnet-bundler/jsonnet-bundler v0.4.0
github.com/observatorium/up v0.0.0-20200615121732-d763595ede50
Expand Down
2 changes: 1 addition & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tools
// +build tools

// Package tools tracks dependencies for tools that used in the build process.
Expand All @@ -6,7 +7,6 @@ package tools

import (
_ "github.com/brancz/gojsontoyaml"
_ "github.com/campoy/embedmd"
_ "github.com/google/go-jsonnet/cmd/jsonnet"
_ "github.com/google/go-jsonnet/cmd/jsonnetfmt"
_ "github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb"
Expand Down