forked from openshift/monitoring-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (98 loc) · 3.81 KB
/
Copy pathMakefile
File metadata and controls
127 lines (98 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
VERSION ?= latest
PLATFORMS ?= linux/arm64,linux/amd64
ORG ?= openshift-observability-ui
PLUGIN_NAME ?=monitoring-plugin
IMAGE ?= quay.io/${ORG}/${PLUGIN_NAME}:${VERSION}
MONITORING_FEATURES ?=alerting,targets,legacy-dashboards,metrics
ALL_FEATURES ?=$(MONITORING_FEATURES),cluster-health-analyzer,perses-dashboards
MCP_DEVSPACE_FEATURES ?=cluster-health-analyzer,perses-dashboards,acm-alerting
GOLANGCI_LINT = $(shell pwd)/_output/tools/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v2.11.3
export NODE_OPTIONS?=--max_old_space_size=8192
.PHONY: install-frontend
install-frontend:
cd web && npm install
.PHONY: install-frontend-ci
install-frontend-ci:
cd web && npm ci --ignore-scripts
.PHONY: install-frontend-ci-clean
install-frontend-ci-clean: install-frontend-ci
cd web && npm cache clean
.PHONY: build-frontend
build-frontend:
cd web && npm run build
.PHONY: start-frontend
start-frontend:
cd web && npm run start
.PHONY: start-mcp-frontend
start-mcp-frontend:
cd web && CONSOLE_PLUGIN_NAME=monitoring-console-plugin npm run start
.PHONY: start-console
start-console:
./scripts/start-console.sh
.PHONY: i18n-frontend
i18n-frontend:
cd web && npm run i18n
.PHONY: lint-frontend
lint-frontend:
cd web && npm run lint
.PHONY: install-backend
install-backend:
go mod download
.PHONY: build-backend
build-backend:
go build $(BUILD_OPTS) -mod=readonly -o plugin-backend cmd/plugin-backend.go
.PHONY: start-backend
start-backend:
go run ./cmd/plugin-backend.go -port='9443' -config-path='./config' -static-path='./web/dist' -features='${MONITORING_FEATURES}'
.PHONY: start-coo-backend
start-coo-backend:
go run ./cmd/plugin-backend.go -port='9443' -config-path='./config' -static-path='./web/dist' -features='${ALL_FEATURES}'
.PHONY: test-backend
test-backend:
go test ./pkg/... -v
.PHONY: test-frontend
test-frontend:
cd web && npm run test:unit
.PHONY: test-frontend-unit
test-frontend-unit:
cd web && npm run test:unit:ci
.PHONY: build-image
build-image:
./scripts/build-image.sh
.PHONY: install
install:
make install-frontend && make install-backend
# Download and install golangci-lint if not already installed
.PHONY: golangci-lint
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
set -e ;\
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
}
.PHONY: lint-backend
lint-backend: golangci-lint
go mod tidy
$(GOLANGCI_LINT) -c $(shell pwd)/.golangci-lint.yaml run --verbose
.PHONY: build-mcp-image
build-mcp-image:
DOCKER_FILE_NAME="Dockerfile.mcp" REPO="monitoring-console-plugin" scripts/build-image.sh
.PHONY: build-dev-mcp-image
build-dev-mcp-image:
DOCKER_FILE_NAME="Dockerfile.dev-mcp" REPO="monitoring-console-plugin" scripts/build-image.sh
.PHONY: start-devspace-backend
start-devspace-backend:
/opt/app-root/plugin-backend -port='9443' -cert='/var/cert/tls.crt' -key='/var/cert/tls.key' -static-path='/opt/app-root/web/dist' -config-path='/opt/app-root/config' -features='${MONITORING_FEATURES}'
.PHONY: start-devspace-mcp-backend
start-devspace-mcp-backend:
/opt/app-root/plugin-backend -port='9443' -cert='/var/serving-cert/tls.crt' -key='/var/serving-cert/tls.key' -static-path='/opt/app-root/web/dist' -config-path='/opt/app-root/config' -features='${MCP_DEVSPACE_FEATURES}' -alertmanager='https://alertmanager.open-cluster-management-observability.svc:9095' -thanos-querier='https://rbac-query-proxy.open-cluster-management-observability.svc:8443'
.PHONY: podman-cross-build
podman-cross-build:
podman manifest create -a ${IMAGE}
podman build --platform ${PLATFORMS} --manifest ${IMAGE} -f Dockerfile.mcp
.PHONY: podman-cross-build-push
podman-cross-build-push: podman-cross-build
podman manifest push ${IMAGE}
.PHONY: test-translations
test-translations:
./scripts/test-translations.sh