-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathMakefile
More file actions
334 lines (271 loc) · 10.3 KB
/
Makefile
File metadata and controls
334 lines (271 loc) · 10.3 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
IMAGE_NAME ?= beeai-agent
COMPOSE_FILE ?= compose.yaml
DRY_RUN ?= false
MOCK_JIRA ?= false
JIRA_DRY_RUN ?= false
AUTO_CHAIN ?= true
FORCE_CVE_TRIAGE ?= false
SILENT_RUN ?= false
COMPOSE ?= $(shell if podman compose ls >/dev/null 2>&1; then echo "podman compose"; elif command -v podman-compose >/dev/null 2>&1; then echo "podman-compose"; else echo "docker-compose"; fi)
COMPOSE_AGENTS=$(COMPOSE) -f $(COMPOSE_FILE) --profile=agents
COMPOSE_SUPERVISOR=$(COMPOSE) -f $(COMPOSE_FILE) --profile=supervisor
# Extract container tool (podman or docker) from COMPOSE
CONTAINER_TOOL ?= $(shell command -v podman >/dev/null 2>&1 && echo "podman" || echo "docker")
REGISTRY ?= quay.io/jotnar
.PHONY: build
build:
@if [ -f .secrets/build.env ]; then echo "Warning: .secrets/build.env is deprecated, please move its contents to .env"; fi
if [ -f .secrets/build.env ] && [ ! -f .env ]; then set -a && . ./.secrets/build.env && set +a; fi && \
$(COMPOSE) -f $(COMPOSE_FILE) --profile=agents --profile=supervisor build
.PHONY: push
push:
@echo "Pushing images to $(REGISTRY)..."
$(CONTAINER_TOOL) push $(REGISTRY)/phoenix:latest
$(CONTAINER_TOOL) push $(REGISTRY)/redis-commander:latest
@echo "All images pushed successfully!"
.PHONY: build-and-push
build-and-push: build push
.PHONY: run-beeai-bash
run-beeai-bash:
$(COMPOSE_AGENTS) run --rm triage-agent /bin/bash
.PHONY: run-triage-agent-standalone
run-triage-agent-standalone:
$(COMPOSE_AGENTS) run --rm \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e FORCE_CVE_TRIAGE=$(FORCE_CVE_TRIAGE) \
-e SILENT_RUN=$(SILENT_RUN) \
triage-agent
.PHONY: run-triage-agent-e2e-tests
run-triage-agent-e2e-tests:
$(COMPOSE) -f $(COMPOSE_FILE) --profile=e2e-test run --rm \
-e MOCK_JIRA="true" \
-e DRY_RUN=$(DRY_RUN) \
triage-agent-e2e-tests
.PHONY: run-rebase-agent-c9s-standalone
run-rebase-agent-c9s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e VERSION=$(VERSION) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
rebase-agent-c9s
.PHONY: run-rebase-agent-c10s-standalone
run-rebase-agent-c10s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e VERSION=$(VERSION) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
rebase-agent-c10s
.PHONY: run-rebase-agent-standalone
run-rebase-agent-standalone: run-rebase-agent-c10s-standalone
.PHONY: run-backport-agent-c9s-standalone
run-backport-agent-c9s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e UPSTREAM_PATCHES=$(UPSTREAM_PATCHES) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e CVE_ID=$(CVE_ID) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
backport-agent-c9s
.PHONY: run-backport-agent-c10s-standalone
run-backport-agent-c10s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e UPSTREAM_PATCHES=$(UPSTREAM_PATCHES) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e CVE_ID=$(CVE_ID) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
backport-agent-c10s
.PHONY: run-backport-agent-standalone
run-backport-agent-standalone: run-backport-agent-c10s-standalone
.PHONY: run-rebuild-agent-c9s-standalone
run-rebuild-agent-c9s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e DEPENDENCY_ISSUE=$(DEPENDENCY_ISSUE) \
-e DEPENDENCY_COMPONENT=$(DEPENDENCY_COMPONENT) \
-e CONSOLIDATED_ISSUES=$(CONSOLIDATED_ISSUES) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
rebuild-agent-c9s
.PHONY: run-rebuild-agent-c10s-standalone
run-rebuild-agent-c10s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e PACKAGE=$(PACKAGE) \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e BRANCH=$(BRANCH) \
-e DRY_RUN=$(DRY_RUN) \
-e MOCK_JIRA=$(MOCK_JIRA) \
-e DEPENDENCY_ISSUE=$(DEPENDENCY_ISSUE) \
-e DEPENDENCY_COMPONENT=$(DEPENDENCY_COMPONENT) \
-e CONSOLIDATED_ISSUES=$(CONSOLIDATED_ISSUES) \
-e JIRA_DRY_RUN=$(JIRA_DRY_RUN) \
-e "JUSTIFICATION=$(JUSTIFICATION)" \
rebuild-agent-c10s
.PHONY: run-rebuild-agent-standalone
run-rebuild-agent-standalone: run-rebuild-agent-c10s-standalone
.PHONY: run-mr-agent-c9s-standalone
run-mr-agent-c9s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e MERGE_REQUEST_URL=$(MERGE_REQUEST_URL) \
mr-agent-c9s
.PHONY: run-mr-agent-c10s-standalone
run-mr-agent-c10s-standalone:
$(COMPOSE_AGENTS) run --rm \
-e MERGE_REQUEST_URL=$(MERGE_REQUEST_URL) \
mr-agent-c10s
.PHONY: run-mr-agent-standalone
run-mr-agent-standalone: run-mr-agent-c10s-standalone
.PHONY: run-jira-issue-fetcher
run-jira-issue-fetcher:
@echo "Running Jira Issue Fetcher..."
@if [ ! -f .secrets/jira-issue-fetcher.env ]; then \
echo "Error: .secrets/jira-issue-fetcher.env not found"; \
echo "Copy the template: cp templates/jira-issue-fetcher.env .secrets/jira-issue-fetcher.env"; \
echo "Then edit it with your credentials"; \
exit 1; \
fi
@echo "Ensuring Redis is available (don't use depends_on otherwise it will kill agents already running)..."
@$(COMPOSE) -f $(COMPOSE_FILE) up -d valkey || true # Don't fail if valkey is already running
@echo "Running jira-issue-fetcher..."
$(COMPOSE) -f $(COMPOSE_FILE) --profile manual run --rm jira-issue-fetcher
.PHONY: build-jira-issue-fetcher
build-jira-issue-fetcher:
$(COMPOSE) --profile manual build jira-issue-fetcher
# Essential 3-Agent Architecture Targets
.PHONY: start
start:
DRY_RUN=$(DRY_RUN) MOCK_JIRA=$(MOCK_JIRA) JIRA_DRY_RUN=$(JIRA_DRY_RUN) AUTO_CHAIN=$(AUTO_CHAIN) SILENT_RUN=$(SILENT_RUN) $(COMPOSE_AGENTS) up
.PHONY: start-detached
start-detached:
DRY_RUN=$(DRY_RUN) MOCK_JIRA=$(MOCK_JIRA) JIRA_DRY_RUN=$(JIRA_DRY_RUN) AUTO_CHAIN=$(AUTO_CHAIN) SILENT_RUN=$(SILENT_RUN) $(COMPOSE_AGENTS) up -d
.PHONY: stop
stop:
$(COMPOSE_AGENTS) stop
$(COMPOSE_AGENTS) down
.PHONY: clean
clean:
$(COMPOSE) -f $(COMPOSE_FILE) down --volumes
.PHONY: logs-triage
logs-triage:
$(COMPOSE_AGENTS) logs -f triage-agent
.PHONY: logs-backport
logs-backport:
$(COMPOSE_AGENTS) logs -f backport-agent
.PHONY: logs-rebase
logs-rebase:
$(COMPOSE_AGENTS) logs -f rebase-agent
.PHONY: logs-rebuild
logs-rebuild:
$(COMPOSE_AGENTS) logs -f rebuild-agent
.PHONY: logs-jira-issue-fetcher
logs-jira-issue-fetcher:
$(COMPOSE) -f $(COMPOSE_FILE) --profile manual logs -f jira-issue-fetcher
.PHONY: trigger-pipeline
trigger-pipeline:
@if [ -z "$(JIRA_ISSUE)" ]; then \
echo "Usage: make trigger-pipeline JIRA_ISSUE=RHEL-12345 [FORCE_CVE_TRIAGE=true]"; \
exit 1; \
fi
@echo "Triggering pipeline for issue: $(JIRA_ISSUE) (force_cve_triage=$(FORCE_CVE_TRIAGE))"
$(COMPOSE_AGENTS) exec valkey redis-cli LPUSH triage_queue '{"metadata": {"issue": "$(JIRA_ISSUE)", "force_cve_triage": $(FORCE_CVE_TRIAGE)}}'
# Testing and Release Supervisor
DEBUG_LOWER := $(shell echo $(DEBUG) | tr '[:upper:]' '[:lower:]')
ifeq ($(DEBUG_LOWER),true)
DEBUG_FLAG := --debug
else
DEBUG_FLAG :=
endif
DRY_RUN_LOWER := $(shell echo $(DRY_RUN) | tr '[:upper:]' '[:lower:]')
ifeq ($(DRY_RUN_LOWER),true)
DRY_RUN_FLAG := --dry-run
else
DRY_RUN_FLAG :=
endif
IGNORE_NEEDS_ATTENTION_LOWER := $(shell echo $(IGNORE_NEEDS_ATTENTION) | tr '[:upper:]' '[:lower:]')
ifeq ($(IGNORE_NEEDS_ATTENTION_LOWER),true)
IGNORE_NEEDS_ATTENTION_FLAG := --ignore-needs-attention
else
IGNORE_NEEDS_ATTENTION_FLAG :=
endif
.PHONY: supervisor-clear-queue
supervisor-clear-queue:
$(COMPOSE_SUPERVISOR) run --rm \
supervisor python -m ymir.supervisor.main $(DEBUG_FLAG) clear-queue
.PHONY: supervisor-collect
supervisor-collect:
$(COMPOSE_SUPERVISOR) run --rm \
supervisor python -m ymir.supervisor.main $(DEBUG_FLAG) collect --no-repeat
.PHONY: process-issue
process-issue:
$(COMPOSE_SUPERVISOR) run --rm \
supervisor python -m ymir.supervisor.main $(DEBUG_FLAG) $(IGNORE_NEEDS_ATTENTION_FLAG) $(DRY_RUN_FLAG) process-issue $(JIRA_ISSUE)
.PHONY: process-erratum
process-erratum:
$(COMPOSE_SUPERVISOR) run --rm \
supervisor python -m ymir.supervisor.main $(DEBUG_FLAG) $(IGNORE_NEEDS_ATTENTION_FLAG) $(DRY_RUN_FLAG) process-erratum $(ERRATA_ID)
.PHONY: run-issue-verification-agent-standalone
run-issue-verification-agent-standalone:
$(COMPOSE_AGENTS) run --rm \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e DRY_RUN=$(DRY_RUN) \
-e IGNORE_NEEDS_ATTENTION=$(IGNORE_NEEDS_ATTENTION) \
issue-verification-agent
.PHONY: run-preliminary-testing-agent-standalone
run-preliminary-testing-agent-standalone:
$(COMPOSE_AGENTS) run --rm \
-e JIRA_ISSUE=$(JIRA_ISSUE) \
-e DRY_RUN=$(DRY_RUN) \
-e IGNORE_NEEDS_ATTENTION=$(IGNORE_NEEDS_ATTENTION) \
preliminary-testing-agent
# Common utility targets
.PHONY: status
status:
$(COMPOSE) -f $(COMPOSE_FILE) ps
.PHONY: redis-cli
redis-cli:
$(COMPOSE_AGENTS) exec valkey redis-cli
.PHONY: build-test-image
build-test-image:
$(MAKE) -f Makefile.tests build-test-image
.PHONY: check-in-container check-agents-in-container check-unprivileged-tools-in-container check-privileged-tools-in-container check-jira-issue-fetcher-in-container check-ymir-common-in-container check-supervisor-in-container check-mcp-install-in-container
check-in-container: build-test-image
$(MAKE) -f Makefile.tests check-in-container
check-agents-in-container: build-test-image
$(MAKE) -f Makefile.tests check-agents-in-container
check-unprivileged-tools-in-container: build-test-image
$(MAKE) -f Makefile.tests check-unprivileged-tools-in-container
check-privileged-tools-in-container: build-test-image
$(MAKE) -f Makefile.tests check-privileged-tools-in-container
check-jira-issue-fetcher-in-container: build-test-image
$(MAKE) -f Makefile.tests check-jira-issue-fetcher-in-container
check-ymir-common-in-container: build-test-image
$(MAKE) -f Makefile.tests check-ymir-common-in-container
check-supervisor-in-container: build-test-image
$(MAKE) -f Makefile.tests check-supervisor-in-container
check-mcp-install-in-container: build-test-image
$(MAKE) -f Makefile.tests check-mcp-install-in-container