Skip to content

Commit b384a5d

Browse files
committed
Auto download envoy when missing
1 parent 2b58ccf commit b384a5d

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

Makefile

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SHELL := /bin/bash
2-
.PHONY: oapi-generate generate-vmm-client generate-wire generate-all dev build test install-tools gen-jwt download-ch-binaries download-ch-spec ensure-ch-binaries
2+
.PHONY: oapi-generate generate-vmm-client generate-wire generate-all dev build test install-tools gen-jwt download-ch-binaries download-ch-spec ensure-ch-binaries download-envoy-binaries ensure-envoy-binaries
33

44
# Directory where local binaries will be installed
55
BIN_DIR ?= $(CURDIR)/bin
@@ -49,6 +49,19 @@ download-ch-binaries:
4949
@chmod +x lib/vmm/binaries/cloud-hypervisor/v*/*/cloud-hypervisor
5050
@echo "Binaries downloaded successfully"
5151

52+
# Download Envoy binaries
53+
download-envoy-binaries:
54+
@echo "Downloading Envoy binaries..."
55+
@mkdir -p lib/ingress/binaries/envoy/v1.36/{x86_64,aarch64}
56+
@echo "Downloading Envoy v1.36.3 for x86_64..."
57+
@curl -L -o lib/ingress/binaries/envoy/v1.36/x86_64/envoy \
58+
https://github.com/envoyproxy/envoy/releases/download/v1.36.3/envoy-1.36.3-linux-x86_64
59+
@echo "Downloading Envoy v1.36.3 for aarch64..."
60+
@curl -L -o lib/ingress/binaries/envoy/v1.36/aarch64/envoy \
61+
https://github.com/envoyproxy/envoy/releases/download/v1.36.3/envoy-1.36.3-linux-aarch_64
62+
@chmod +x lib/ingress/binaries/envoy/v1.36/*/envoy
63+
@echo "Envoy binaries downloaded successfully"
64+
5265
# Download Cloud Hypervisor API spec
5366
download-ch-spec:
5467
@echo "Downloading Cloud Hypervisor API spec..."
@@ -86,21 +99,29 @@ generate-grpc:
8699
# Generate all code
87100
generate-all: oapi-generate generate-vmm-client generate-wire generate-grpc
88101

89-
# Check if binaries exist, download if missing
102+
# Check if CH binaries exist, download if missing
90103
.PHONY: ensure-ch-binaries
91104
ensure-ch-binaries:
92105
@if [ ! -f lib/vmm/binaries/cloud-hypervisor/v48.0/x86_64/cloud-hypervisor ]; then \
93106
echo "Cloud Hypervisor binaries not found, downloading..."; \
94107
$(MAKE) download-ch-binaries; \
95108
fi
96109

110+
# Check if Envoy binaries exist, download if missing
111+
.PHONY: ensure-envoy-binaries
112+
ensure-envoy-binaries:
113+
@if [ ! -f lib/ingress/binaries/envoy/v1.36/x86_64/envoy ]; then \
114+
echo "Envoy binaries not found, downloading..."; \
115+
$(MAKE) download-envoy-binaries; \
116+
fi
117+
97118
# Build exec-agent (guest binary) into its own directory for embedding
98119
lib/system/exec_agent/exec-agent: lib/system/exec_agent/main.go
99120
@echo "Building exec-agent..."
100121
cd lib/system/exec_agent && CGO_ENABLED=0 go build -ldflags="-s -w" -o exec-agent .
101122

102123
# Build the binary
103-
build: ensure-ch-binaries lib/system/exec_agent/exec-agent | $(BIN_DIR)
124+
build: ensure-ch-binaries ensure-envoy-binaries lib/system/exec_agent/exec-agent | $(BIN_DIR)
104125
go build -tags containers_image_openpgp -o $(BIN_DIR)/hypeman ./cmd/api
105126

106127
# Build exec CLI
@@ -118,7 +139,7 @@ dev: $(AIR)
118139
# Compile test binaries and grant network capabilities (runs as user, not root)
119140
# Usage: make test - runs all tests
120141
# make test TEST=TestCreateInstanceWithNetwork - runs specific test
121-
test: ensure-ch-binaries lib/system/exec_agent/exec-agent
142+
test: ensure-ch-binaries ensure-envoy-binaries lib/system/exec_agent/exec-agent
122143
@echo "Building test binaries..."
123144
@mkdir -p $(BIN_DIR)/tests
124145
@for pkg in $$(go list -tags containers_image_openpgp ./...); do \

0 commit comments

Comments
 (0)