This is an automated email from the ASF dual-hosted git repository.
yuluo-yx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 89a02011e5 ci: select IT-K8s cases by protocol (#7353)
89a02011e5 is described below
commit 89a02011e596d2580faddafa2494298247b2f2a1
Author: aias00 <[email protected]>
AuthorDate: Mon Sep 28 18:39:26 2026 -0700
ci: select IT-K8s cases by protocol (#7353)
---
.github/scripts/resolve-k8s-ingress-matrix-test.sh | 66 ++++++++++++++++++++++
.github/scripts/resolve-test-case-matrix.sh | 46 +++++++++++++--
.github/workflows/integrated-test-k8s-ingress.yml | 13 +++--
3 files changed, 113 insertions(+), 12 deletions(-)
diff --git a/.github/scripts/resolve-k8s-ingress-matrix-test.sh
b/.github/scripts/resolve-k8s-ingress-matrix-test.sh
new file mode 100644
index 0000000000..250a8ab592
--- /dev/null
+++ b/.github/scripts/resolve-k8s-ingress-matrix-test.sh
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly SCRIPT_DIR
+readonly RESOLVER="${SCRIPT_DIR}/resolve-test-case-matrix.sh"
+
+resolve_matrix() {
+ local changed_files_json="$1"
+ local output_file
+
+ output_file="$(mktemp)"
+ CI_CASE_MODE="k8s-ingress" \
+ CHANGED_FILES_JSON="${changed_files_json}" \
+ GITHUB_OUTPUT="${output_file}" \
+ bash "${RESOLVER}" >/dev/null
+ awk -F= '$1 == "k8s_ingress_matrix" { sub(/^[^=]*=/, ""); print }'
"${output_file}"
+ rm -f "${output_file}"
+}
+
+assert_matrix() {
+ local changed_files_json="$1"
+ local expected="$2"
+ local actual
+
+ actual="$(resolve_matrix "${changed_files_json}")"
+ if [[ "${actual}" != "${expected}" ]]; then
+ echo "Expected ${expected} for ${changed_files_json}, got
${actual:-<empty>}" >&2
+ return 1
+ fi
+}
+
+assert_matrix
'["shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/pom.xml"]'
\
+ '{"include":[{"case":"shenyu-integrated-test-k8s-ingress-grpc"}]}'
+assert_matrix
'["shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/pom.xml"]' \
+ '{"include":[{"case":"shenyu-integrated-test-k8s-ingress-websocket"}]}'
+assert_matrix
'["shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/pom.xml"]' \
+ '{"include":[{"case":"shenyu-integrated-test-k8s-ingress-http"}]}'
+assert_matrix
'["shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/pom.xml"]'
\
+ '{"include":[{"case":"shenyu-integrated-test-k8s-ingress-apache-dubbo"}]}'
+assert_matrix
'["shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/pom.xml","shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-websocket/pom.xml","shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/GrpcPlugin.java"]'
\
+
'{"include":[{"case":"shenyu-integrated-test-k8s-ingress-grpc"},{"case":"shenyu-integrated-test-k8s-ingress-websocket"}]}'
+assert_matrix '["shenyu-common/pom.xml"]' \
+
'{"include":[{"case":"shenyu-integrated-test-k8s-ingress-http"},{"case":"shenyu-integrated-test-k8s-ingress-apache-dubbo"},{"case":"shenyu-integrated-test-k8s-ingress-websocket"},{"case":"shenyu-integrated-test-k8s-ingress-grpc"}]}'
+assert_matrix
'["shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-common/pom.xml"]' \
+ '{"include":[]}'
+assert_matrix '[".github/workflows/integrated-test-k8s-ingress.yml"]' \
+
'{"include":[{"case":"shenyu-integrated-test-k8s-ingress-http"},{"case":"shenyu-integrated-test-k8s-ingress-apache-dubbo"},{"case":"shenyu-integrated-test-k8s-ingress-websocket"},{"case":"shenyu-integrated-test-k8s-ingress-grpc"}]}'
+
+echo "IT-K8s matrix resolver tests passed"
diff --git a/.github/scripts/resolve-test-case-matrix.sh
b/.github/scripts/resolve-test-case-matrix.sh
index fdf06f71bf..23cfcd18aa 100644
--- a/.github/scripts/resolve-test-case-matrix.sh
+++ b/.github/scripts/resolve-test-case-matrix.sh
@@ -23,7 +23,7 @@ full_required=false
storage_cases=()
e2e_cases=()
integration_cases=()
-run_k8s_ingress=false
+k8s_ingress_cases=()
run_k8s_examples=false
if ! command -v jq >/dev/null 2>&1; then
@@ -76,6 +76,13 @@ add_integration_all() {
add_unique integration_cases "shenyu-integrated-test-sdk-http"
}
+add_k8s_ingress_all() {
+ add_unique k8s_ingress_cases "shenyu-integrated-test-k8s-ingress-http"
+ add_unique k8s_ingress_cases
"shenyu-integrated-test-k8s-ingress-apache-dubbo"
+ add_unique k8s_ingress_cases "shenyu-integrated-test-k8s-ingress-websocket"
+ add_unique k8s_ingress_cases "shenyu-integrated-test-k8s-ingress-grpc"
+}
+
is_ignored_change() {
local file="$1"
@@ -122,16 +129,28 @@ resolve_k8s_change() {
if [[ "${mode}" == "k8s-ingress" ]]; then
case "${file}" in
pom.xml|mvnw|mvnw.cmd|.mvn/*|\
- shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-*/*|\
shenyu-kubernetes-controller/*|\
shenyu-common/*|shenyu-web/*|shenyu-bootstrap/*|shenyu-admin/*|\
shenyu-admin-listener/*|shenyu-sync-data-center/*|\
shenyu-loadbalancer/*|shenyu-protocol/*|shenyu-register-center/*|shenyu-registry/*|\
shenyu-plugin/pom.xml|shenyu-plugin/shenyu-plugin-api/*|shenyu-plugin/shenyu-plugin-base/*|\
- shenyu-spring-boot-starter/pom.xml|\
-
*apache-dubbo*|*shenyu-plugin-dubbo*|*grpc*|*websocket*|*divide*|*springmvc*|\
- shenyu-examples/shenyu-examples-http*/*)
- run_k8s_ingress=true
+
shenyu-plugin/shenyu-plugin-proxy/pom.xml|shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/pom.xml|\
+
shenyu-spring-boot-starter/pom.xml|shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml)
+ add_k8s_ingress_all
+ ;;
+ shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/*|\
+ *divide*|*springmvc*|*http*)
+ add_unique k8s_ingress_cases "shenyu-integrated-test-k8s-ingress-http"
+ ;;
+
shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/*|\
+
*apache-dubbo*|*shenyu-plugin-dubbo*|*shenyu-client-dubbo*|*shenyu-examples-dubbo*)
+ add_unique k8s_ingress_cases
"shenyu-integrated-test-k8s-ingress-apache-dubbo"
+ ;;
+
shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/*|*websocket*)
+ add_unique k8s_ingress_cases
"shenyu-integrated-test-k8s-ingress-websocket"
+ ;;
+ shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-grpc/*|*grpc*)
+ add_unique k8s_ingress_cases "shenyu-integrated-test-k8s-ingress-grpc"
;;
esac
return 0
@@ -331,6 +350,17 @@ map_domain_path() {
while IFS= read -r file; do
[[ -n "${file}" ]] || continue
+ if [[ "${mode}" == "k8s-ingress" ]]; then
+ case "${file}" in
+ .github/workflows/integrated-test-k8s-ingress.yml|\
+ .github/scripts/resolve-test-case-matrix.sh|\
+ .github/scripts/resolve-k8s-ingress-matrix-test.sh)
+ add_k8s_ingress_all
+ continue
+ ;;
+ esac
+ fi
+
if is_ignored_change "${file}"; then
continue
fi
@@ -393,11 +423,13 @@ e2e_matrix="$(printf '%s\n' "${e2e_cases[@]}" | jq -R . |
jq -cs '
{include: map(select(length > 0) | ({script: .} + case_config))}
')"
integration_matrix="$(printf '%s\n' "${integration_cases[@]}" | jq -R . | jq
-cs '{include: map(select(length > 0) | {case:.})}')"
+k8s_ingress_matrix="$(printf '%s\n' "${k8s_ingress_cases[@]}" | jq -R . | jq
-cs '{include: map(select(length > 0) | {case:.})}')"
run_storage=$([[ "${#storage_cases[@]}" -gt 0 ]] && echo true || echo false)
run_e2e_cases=$([[ "${#e2e_cases[@]}" -gt 0 ]] && echo true || echo false)
run_e2e=$([[ "${run_storage}" == "true" || "${run_e2e_cases}" == "true" ]] &&
echo true || echo false)
run_integration=$([[ "${#integration_cases[@]}" -gt 0 ]] && echo true || echo
false)
+run_k8s_ingress=$([[ "${#k8s_ingress_cases[@]}" -gt 0 ]] && echo true || echo
false)
{
echo "run_storage=${run_storage}"
@@ -407,6 +439,7 @@ run_integration=$([[ "${#integration_cases[@]}" -gt 0 ]] &&
echo true || echo fa
echo "e2e_matrix=${e2e_matrix}"
echo "run_integration=${run_integration}"
echo "integration_matrix=${integration_matrix}"
+ echo "k8s_ingress_matrix=${k8s_ingress_matrix}"
echo "full_required=${full_required}"
echo "run_k8s_ingress=${run_k8s_ingress}"
echo "run_k8s_examples=${run_k8s_examples}"
@@ -416,5 +449,6 @@ echo "Full required: ${full_required}"
echo "Storage matrix: ${storage_matrix}"
echo "E2E matrix: ${e2e_matrix}"
echo "Integration matrix: ${integration_matrix}"
+echo "K8s ingress matrix: ${k8s_ingress_matrix}"
echo "Run k8s ingress: ${run_k8s_ingress}"
echo "Run k8s examples: ${run_k8s_examples}"
diff --git a/.github/workflows/integrated-test-k8s-ingress.yml
b/.github/workflows/integrated-test-k8s-ingress.yml
index e36d3f50ab..80b609a779 100644
--- a/.github/workflows/integrated-test-k8s-ingress.yml
+++ b/.github/workflows/integrated-test-k8s-ingress.yml
@@ -73,8 +73,11 @@ jobs:
runs-on: ubuntu-latest
outputs:
k8s_ingress: ${{ steps.cases.outputs.run_k8s_ingress }}
+ k8s_ingress_matrix: ${{ steps.cases.outputs.k8s_ingress_matrix }}
steps:
- uses: actions/checkout@v3
+ - name: Test IT-K8s matrix resolver
+ run: bash .github/scripts/resolve-k8s-ingress-matrix-test.sh
- uses: ./actions/paths-filter
id: filter
with:
@@ -97,6 +100,9 @@ jobs:
- '!.github/**'
- '!.github/ISSUE_TEMPLATE/**'
- '!.github/PULL_REQUEST_TEMPLATE'
+ - '.github/workflows/integrated-test-k8s-ingress.yml'
+ - '.github/scripts/resolve-test-case-matrix.sh'
+ - '.github/scripts/resolve-k8s-ingress-matrix-test.sh'
- name: Resolve k8s ingress cases
id: cases
if: steps.filter.outputs['k8s-ingress'] == 'true'
@@ -108,12 +114,7 @@ jobs:
build:
needs: changes
strategy:
- matrix:
- case:
- - shenyu-integrated-test-k8s-ingress-http
- - shenyu-integrated-test-k8s-ingress-apache-dubbo
- - shenyu-integrated-test-k8s-ingress-websocket
- - shenyu-integrated-test-k8s-ingress-grpc
+ matrix: ${{ fromJSON(needs.changes.outputs.k8s_ingress_matrix ||
'{"include":[]}') }}
runs-on: ubuntu-latest
if: github.repository == 'apache/shenyu' &&
needs.changes.outputs.k8s_ingress == 'true'
steps: