This is an automated email from the ASF dual-hosted git repository.

AlinsRan pushed a commit to branch feat/webhook-adc-validation
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/feat/webhook-adc-validation by 
this push:
     new 24f141d3 fix: build local echo server image for e2e
24f141d3 is described below

commit 24f141d34dbf295e86aa21fc3ab2dce9b0c01e55
Author: rongxin <[email protected]>
AuthorDate: Mon Apr 27 17:35:32 2026 +0800

    fix: build local echo server image for e2e
    
    Co-authored-by: Copilot <[email protected]>
---
 Makefile                               |  8 +++++--
 cmd/e2e-echo-server/main.go            | 42 ++++++++++++++++++++++++++++++++++
 test/e2e/images/echo-server.Dockerfile |  7 ++++++
 3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 5346d411..1e89e087 100644
--- a/Makefile
+++ b/Makefile
@@ -194,7 +194,7 @@ kind-down:
                || echo "kind cluster does not exist"
 
 .PHONY: kind-load-images
-kind-load-images: pull-infra-images kind-load-ingress-image kind-load-adc-image
+kind-load-images: pull-infra-images build-e2e-echo-server-image 
kind-load-ingress-image kind-load-adc-image
        @kind load docker-image 
hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-gateway:dev --name $(KIND_NAME)
        @kind load docker-image 
hkccr.ccs.tencentyun.com/api7-dev/api7-ee-dp-manager:$(DASHBOARD_VERSION)  
--name $(KIND_NAME)
        @kind load docker-image 
hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-integrated:$(DASHBOARD_VERSION)  
--name $(KIND_NAME)
@@ -222,6 +222,11 @@ kind-load-adc-image:
        @docker tag ghcr.io/api7/adc:$(ADC_VERSION) ghcr.io/api7/adc:dev
        @kind load docker-image ghcr.io/api7/adc:dev --name $(KIND_NAME)
 
+.PHONY: build-e2e-echo-server-image
+build-e2e-echo-server-image:
+       @CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/e2e-echo-server 
./cmd/e2e-echo-server
+       @docker build -f test/e2e/images/echo-server.Dockerfile -t 
jmalloc/echo-server:latest .
+
 .PHONY: pull-infra-images
 pull-infra-images:
        @retry_pull() { \
@@ -247,7 +252,6 @@ pull-infra-images:
        retry_pull 
"hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-integrated:$(DASHBOARD_VERSION)" 
"hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-integrated:$(DASHBOARD_VERSION)"; \
        dockerhub_proxy="$${DOCKERHUB_PROXY:-docker.m.daocloud.io}"; \
        retry_pull "$$dockerhub_proxy/kennethreitz/httpbin:latest" 
"kennethreitz/httpbin:latest"; \
-       retry_pull "$$dockerhub_proxy/jmalloc/echo-server:latest" 
"jmalloc/echo-server:latest"; \
        retry_pull "ghcr.io/api7/adc:dev" "ghcr.io/api7/adc:dev"; \
        retry_pull "apache/apisix:dev" "apache/apisix:dev"; \
        retry_pull "openresty/openresty:1.27.1.2-4-bullseye-fat" 
"openresty/openresty:1.27.1.2-4-bullseye-fat"
diff --git a/cmd/e2e-echo-server/main.go b/cmd/e2e-echo-server/main.go
new file mode 100644
index 00000000..98a84c71
--- /dev/null
+++ b/cmd/e2e-echo-server/main.go
@@ -0,0 +1,42 @@
+package main
+
+import (
+       "log"
+       "net/http"
+
+       "github.com/gorilla/websocket"
+)
+
+var upgrader = websocket.Upgrader{
+       CheckOrigin: func(*http.Request) bool {
+               return true
+       },
+}
+
+func main() {
+       http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+               if websocket.IsWebSocketUpgrade(r) {
+                       conn, err := upgrader.Upgrade(w, r, nil)
+                       if err != nil {
+                               return
+                       }
+                       defer conn.Close()
+
+                       for {
+                               messageType, message, err := conn.ReadMessage()
+                               if err != nil {
+                                       return
+                               }
+                               if err := conn.WriteMessage(messageType, 
message); err != nil {
+                                       return
+                               }
+                       }
+               }
+
+               w.Header().Set("Content-Type", "text/plain")
+               w.WriteHeader(http.StatusOK)
+               _, _ = w.Write([]byte("ok"))
+       })
+
+       log.Fatal(http.ListenAndServe(":8080", nil))
+}
diff --git a/test/e2e/images/echo-server.Dockerfile 
b/test/e2e/images/echo-server.Dockerfile
new file mode 100644
index 00000000..071c2b14
--- /dev/null
+++ b/test/e2e/images/echo-server.Dockerfile
@@ -0,0 +1,7 @@
+FROM scratch
+
+COPY bin/e2e-echo-server /e2e-echo-server
+
+EXPOSE 8080
+
+ENTRYPOINT ["/e2e-echo-server"]

Reply via email to