-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (68 loc) · 2.82 KB
/
Makefile
File metadata and controls
81 lines (68 loc) · 2.82 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
.PHONY: build clean test lint help
# Default target: Build all services
build: build-cm
# Build the config-manager service
build-cm:
@echo "Building config-manager service..."
@cd config-manager && go build -o ../bin/config-manager .
# Build the config-manager service docker image
build-cm-docker: build-cm
@echo "Building config-manager service docker image..."
@cd deployments/docker && docker compose up --build -d
# Build the grafana-app plugin
build-plugin:
@echo "Building cbmonitor grafana-app plugin..."
@cd cbmonitor && \
export VERSION=$$(node -p "require('./package.json').version") && \
export GIT_COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") && \
export BUILD_DATE=$$(date -u +"%Y-%m-%d") && \
echo "Version: $$VERSION" && \
echo "Git Commit: $$GIT_COMMIT" && \
npm install && \
npm run build && \
mage
# Build the grafana-app plugin docker image
build-plugin-docker: build-plugin move-datasource-build-artifacts
@echo "Building cbmonitor grafana-app plugin docker image..."
@cd cbmonitor && npm run server
# Rebuild plugin locally and restart container to pick up changes
reload-plugin: build-plugin move-datasource-build-artifacts
@echo "Restarting cbmonitor container to load plugin changes..."
@docker restart cbmonitor
# Build the datasource plugin
build-couchbase-datasource:
@cd mfork-grafana-plugin && cd couchbase-datasource && \
yarn install && \
yarn build && \
mage -v
# Move the datasource build artifacts to the cbmonitor dist directory
move-datasource-build-artifacts:
@echo "Moving datasource build artifacts..."
@mkdir -p cbmonitor/dist/couchbase-datasource/
@cp -r mfork-grafana-plugin/couchbase-datasource/dist/* cbmonitor/dist/couchbase-datasource/
# Clean build artifacts
clean-cm:
@echo "Cleaning config-manager service build artifacts..."
@rm -rf bin/
@cd config-manager && go clean -cache
clean-plugin:
@echo "Cleaning cbmonitor grafana-app plugin build artifacts..."
@cd cbmonitor && mage clean
clean: clean-cm clean-plugin
# Run config-manager tests
test-cm:
@echo "Running config-manager tests..."
@cd config-manager/tests && go test -v .
help:
@echo "Available targets:"
@echo " build - Build all services"
@echo " build-cm - Build config-manager service"
@echo " build-cm-docker - Build config-manager service docker image"
@echo " build-plugin - Build cbmonitor grafana-app plugin"
@echo " build-plugin-docker - Build cbmonitor grafana-app plugin docker image"
@echo " reload-plugin - Rebuild plugin and restart container"
@echo " test-cm - Run config-manager tests"
@echo " clean - Clean all build artifacts"
@echo " clean-cm - Clean config-manager service build artifacts"
@echo " clean-plugin - Clean cbmonitor grafana-app plugin build artifacts"
@echo " help - Show this help message"