-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
201 lines (172 loc) · 5.64 KB
/
Makefile
File metadata and controls
201 lines (172 loc) · 5.64 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Jumpstarter Monorepo Makefile
#
# This Makefile provides common targets that delegate to subdirectory Makefiles.
#
# Subdirectories containing projects
SUBDIRS := python protocol controller e2e
# Deployment method for e2e tests: operator (default) or helm
METHOD ?= operator
# Default target
.PHONY: all
all: build
# Help target - shows available commands
.PHONY: help
help:
@echo "Jumpstarter Monorepo"
@echo ""
@echo "Available targets:"
@echo " make all - Build all projects (default)"
@echo " make build - Build all projects"
@echo " make test - Run tests in all projects"
@echo " make clean - Clean build artifacts in all projects"
@echo " make lint - Run linters in all projects"
@echo " make fmt - Format code in all projects"
@echo ""
@echo "End-to-end testing:"
@echo " make e2e-setup - Setup e2e test environment (one-time)"
@echo " make e2e-run - Run e2e tests (requires e2e-setup first)"
@echo " make e2e - Same as e2e-run"
@echo " make e2e-full - Full setup + run (for CI or first time)"
@echo " make e2e-clean - Clean up e2e test environment (delete cluster, certs, etc.)"
@echo ""
@echo " Use METHOD=operator (default) or METHOD=helm to select deployment method"
@echo " Example: make e2e-setup METHOD=helm"
@echo ""
@echo "Per-project targets:"
@echo " make build-<project> - Build specific project"
@echo " make test-<project> - Test specific project"
@echo " make clean-<project> - Clean specific project"
@echo ""
@echo "Projects: $(SUBDIRS)"
# Build all projects
.PHONY: build
build:
@for dir in $(SUBDIRS); do \
if [ -f $$dir/Makefile ]; then \
echo "Building $$dir..."; \
$(MAKE) -C $$dir build || true; \
fi \
done
# Test all projects
.PHONY: test
test:
@for dir in $(SUBDIRS); do \
if [ -f $$dir/Makefile ]; then \
echo "Testing $$dir..."; \
$(MAKE) -C $$dir test ; \
fi \
done
# Clean all projects
.PHONY: clean
clean:
@for dir in $(SUBDIRS); do \
if [ -f $$dir/Makefile ]; then \
echo "Cleaning $$dir..."; \
$(MAKE) -C $$dir clean || true; \
fi \
done
# Lint all projects
.PHONY: lint
lint:
@for dir in $(SUBDIRS); do \
if [ -f $$dir/Makefile ]; then \
echo "Linting $$dir..."; \
$(MAKE) -C $$dir lint; \
fi \
done
# Format all projects
.PHONY: fmt
fmt:
@for dir in $(SUBDIRS); do \
if [ -f $$dir/Makefile ]; then \
echo "Formatting $$dir..."; \
$(MAKE) -C $$dir fmt || true; \
fi \
done
# Per-project build targets
.PHONY: build-python build-protocol build-controller build-e2e
build-python:
@if [ -f python/Makefile ]; then $(MAKE) -C python build; fi
build-protocol:
@if [ -f protocol/Makefile ]; then $(MAKE) -C protocol build; fi
build-controller:
@if [ -f controller/Makefile ]; then $(MAKE) -C controller build; fi
build-e2e:
@if [ -f e2e/Makefile ]; then $(MAKE) -C e2e build; fi
# Per-project test targets
.PHONY: test-python test-protocol test-controller test-e2e
test-python:
@if [ -f python/Makefile ]; then $(MAKE) -C python test; fi
test-protocol:
@if [ -f protocol/Makefile ]; then $(MAKE) -C protocol test; fi
test-controller:
@if [ -f controller/Makefile ]; then $(MAKE) -C controller test; fi
# Setup e2e testing environment (one-time)
.PHONY: e2e-setup
e2e-setup:
@echo "Setting up e2e test environment (method: $(METHOD))..."
@METHOD=$(METHOD) bash e2e/setup-e2e.sh
# Run e2e tests
.PHONY: e2e-run
e2e-run:
@echo "Running e2e tests (method: $(METHOD))..."
@METHOD=$(METHOD) bash e2e/run-e2e.sh
# Convenience alias for running e2e tests
.PHONY: e2e
e2e: e2e-run
# Full e2e setup + run
.PHONY: e2e-full
e2e-full:
@METHOD=$(METHOD) bash e2e/run-e2e.sh --full
# Clean up e2e test environment
.PHONY: e2e-clean
e2e-clean:
@echo "Cleaning up e2e test environment..."
@if command -v kind >/dev/null 2>&1; then \
echo "Deleting jumpstarter kind cluster..."; \
kind delete cluster --name jumpstarter 2>/dev/null || true; \
fi
@echo "Removing certificates and setup files..."
@rm -f ca.pem ca-key.pem ca.csr server.pem server-key.pem server.csr
@rm -f .e2e-setup-complete
@echo "Removing local e2e configuration directory..."
@rm -rf .e2e
@echo "Removing virtual environment..."
@rm -rf .venv
@echo "Removing local bats libraries..."
@rm -rf .bats
@if [ -d /etc/jumpstarter/exporters ] && [ -w /etc/jumpstarter/exporters ]; then \
echo "Removing exporter configs..."; \
rm -rf /etc/jumpstarter/exporters/* 2>/dev/null || true; \
fi
@echo "✓ E2E test environment cleaned"
@echo ""
@echo "Note: You may need to manually remove the dex entry from /etc/hosts:"
@echo " sudo sed -i.bak '/dex.dex.svc.cluster.local/d' /etc/hosts"
# Backward compatibility alias
.PHONY: test-e2e
test-e2e: e2e-run
# Compatibility E2E testing (cross-version tests, separate from main e2e)
COMPAT_SCENARIO ?= old-controller
COMPAT_TEST ?= old-controller
COMPAT_CONTROLLER_TAG ?= v0.7.0
COMPAT_CLIENT_VERSION ?= 0.7.1
.PHONY: e2e-compat-setup
e2e-compat-setup:
@echo "Setting up compat e2e (scenario: $(COMPAT_SCENARIO))..."
@COMPAT_SCENARIO=$(COMPAT_SCENARIO) COMPAT_CONTROLLER_TAG=$(COMPAT_CONTROLLER_TAG) \
COMPAT_CLIENT_VERSION=$(COMPAT_CLIENT_VERSION) bash e2e/compat/setup.sh
.PHONY: e2e-compat-run
e2e-compat-run:
@echo "Running compat e2e (test: $(COMPAT_TEST))..."
@COMPAT_TEST=$(COMPAT_TEST) bash e2e/compat/run.sh
# Per-project clean targets
.PHONY: clean-python clean-protocol clean-controller clean-e2e
clean-python:
@if [ -f python/Makefile ]; then $(MAKE) -C python clean; fi
clean-protocol:
@if [ -f protocol/Makefile ]; then $(MAKE) -C protocol clean; fi
clean-controller:
@if [ -f controller/Makefile ]; then $(MAKE) -C controller clean; fi
clean-e2e:
@if [ -f e2e/Makefile ]; then $(MAKE) -C e2e clean; fi