Skip to content

Commit b4b55b4

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix/agent-gateway-upgrade-migrations
# Conflicts: # db/upgrade/2.7.1-upgrade-2.7.2-mysql.sql
2 parents 87c874f + 442597e commit b4b55b4

392 files changed

Lines changed: 12113 additions & 1367 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.asf.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ github:
3333
protected_branches:
3434
master:
3535
required_status_checks:
36-
strict: true
36+
strict: false
3737
contexts:
3838
- check-license-header
3939
- build
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -euo pipefail
19+
20+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21+
readonly SCRIPT_DIR
22+
readonly CLEANUP_SCRIPT="${SCRIPT_DIR}/free-disk-space.sh"
23+
24+
skip_output="$(AVAILABLE_DISK_KB=31457280 MIN_FREE_DISK_KB=20971520 DRY_RUN=true bash "${CLEANUP_SCRIPT}")"
25+
if [[ "${skip_output}" != *"Skipping disk cleanup"* ]]; then
26+
echo "Expected cleanup to be skipped when 30 GiB is available" >&2
27+
exit 1
28+
fi
29+
30+
cleanup_output="$(AVAILABLE_DISK_KB=10485760 MIN_FREE_DISK_KB=20971520 DRY_RUN=true bash "${CLEANUP_SCRIPT}")"
31+
if [[ "${cleanup_output}" != *"Disk cleanup required"* ]]; then
32+
echo "Expected cleanup to be required when only 10 GiB is available" >&2
33+
exit 1
34+
fi
35+
if [[ "${cleanup_output}" != *"DRY_RUN enabled"* ]]; then
36+
echo "Expected dry-run cleanup to avoid destructive commands" >&2
37+
exit 1
38+
fi
39+
40+
echo "free disk space tests passed"

‎.github/scripts/free-disk-space.sh‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -euo pipefail
19+
20+
readonly MIN_FREE_DISK_KB="${MIN_FREE_DISK_KB:-20971520}"
21+
readonly DRY_RUN="${DRY_RUN:-false}"
22+
23+
if [[ -n "${AVAILABLE_DISK_KB:-}" ]]; then
24+
available_disk_kb="${AVAILABLE_DISK_KB}"
25+
else
26+
available_disk_kb="$(df --output=avail -k / | tail -n 1 | tr -d ' ')"
27+
fi
28+
readonly available_disk_kb
29+
30+
if [[ ! "${MIN_FREE_DISK_KB}" =~ ^[0-9]+$ || ! "${available_disk_kb}" =~ ^[0-9]+$ ]]; then
31+
echo "Disk thresholds must be integer values in KiB" >&2
32+
exit 1
33+
fi
34+
35+
echo "Available disk: ${available_disk_kb} KiB; required: ${MIN_FREE_DISK_KB} KiB"
36+
if ((available_disk_kb >= MIN_FREE_DISK_KB)); then
37+
echo "Skipping disk cleanup because sufficient space is available"
38+
exit 0
39+
fi
40+
41+
echo "Disk cleanup required because available space is below the threshold"
42+
if [[ "${DRY_RUN}" == "true" ]]; then
43+
echo "DRY_RUN enabled; cleanup commands were not executed"
44+
exit 0
45+
fi
46+
47+
df --human-readable
48+
sudo apt clean
49+
while IFS= read -r image; do
50+
[[ -n "${image}" ]] || continue
51+
docker rmi "${image}" || true
52+
done < <(docker image ls --all --quiet)
53+
54+
case "${AGENT_TOOLSDIRECTORY:-}" in
55+
/opt/hostedtoolcache|/opt/hostedtoolcache/*)
56+
sudo rm -rf -- "${AGENT_TOOLSDIRECTORY}"
57+
;;
58+
"")
59+
echo "AGENT_TOOLSDIRECTORY is not set; skipping tool cache cleanup"
60+
;;
61+
*)
62+
echo "Refusing to remove unexpected AGENT_TOOLSDIRECTORY: ${AGENT_TOOLSDIRECTORY}" >&2
63+
exit 1
64+
;;
65+
esac
66+
67+
df --human-readable

‎.github/scripts/resolve-ci-modules.sh‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,24 @@ add_module() {
4141
modules+=("${module}")
4242
}
4343

44+
is_root_reactor_module() {
45+
local module="$1"
46+
local candidate="${module}"
47+
48+
while [[ "${candidate}" == */* ]]; do
49+
if grep -Fq "<module>${candidate}</module>" pom.xml; then
50+
return 0
51+
fi
52+
candidate="${candidate%/*}"
53+
done
54+
55+
grep -Fq "<module>${candidate}</module>" pom.xml
56+
}
57+
4458
find_module() {
4559
local path="$1"
4660
local dir
61+
local module
4762

4863
if [[ -d "${path}" ]]; then
4964
dir="${path}"
@@ -53,7 +68,10 @@ find_module() {
5368

5469
while [[ "${dir}" != "." && "${dir}" != "/" ]]; do
5570
if [[ -f "${dir}/pom.xml" ]]; then
56-
printf '%s\n' "${dir#./}"
71+
module="${dir#./}"
72+
if is_root_reactor_module "${module}"; then
73+
printf '%s\n' "${module}"
74+
fi
5775
return
5876
fi
5977
dir="$(dirname "${dir}")"
@@ -64,7 +82,10 @@ is_ignored_change() {
6482
local file="$1"
6583

6684
case "${file}" in
67-
.github/*|*.md|*.txt|resources/static/*|.asf.yaml|.gitignore|.licenserc.yaml|LICENSE|NOTICE|*/LICENSE|*/NOTICE)
85+
*.png|*.jpg|*.jpeg|*.gif|*.svg|*.ico|*.pdf|*.doc|*.docx|DISCLAIMER|*/resources/static/*)
86+
return 0
87+
;;
88+
.github/*|shenyu-e2e/*|shenyu-integrated-test/*|*.md|*.txt|resources/static/*|.asf.yaml|.gitignore|.licenserc.yaml|LICENSE|NOTICE|*/LICENSE|*/NOTICE)
6889
return 0
6990
;;
7091
esac
@@ -95,10 +116,22 @@ while IFS= read -r file; do
95116
module="$(find_module "${file}")"
96117
if [[ -n "${module:-}" ]]; then
97118
add_module "${module}"
119+
else
120+
full_build_required=true
98121
fi
99122
fi
100123
done < <(printf '%s' "${changed_files_json}" | jq -r '.[]')
101124

125+
# SPI changes can affect modules that consume shared classes without declaring a
126+
# direct Maven dependency on every transitive module. Build the full reactor so
127+
# those modules cannot silently use a stale SNAPSHOT from the Maven cache.
128+
for module in "${modules[@]}"; do
129+
if [[ "${module}" == "shenyu-spi" ]]; then
130+
full_build_required=true
131+
break
132+
fi
133+
done
134+
102135
if [[ "${has_code_changes}" == "true" && ("${#modules[@]}" -eq 0 || "${#modules[@]}" -gt "${max_modules}") ]]; then
103136
full_build_required=true
104137
fi
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set -euo pipefail
19+
20+
WORKFLOW_FILE="${1:-.github/workflows/docker-publish.yml}"
21+
readonly WORKFLOW_FILE
22+
23+
ruby - "${WORKFLOW_FILE}" <<'RUBY'
24+
require "yaml"
25+
26+
workflow = YAML.safe_load(File.read(ARGV.fetch(0)), aliases: true)
27+
events = workflow["on"] || workflow[true]
28+
push = events.fetch("push")
29+
patterns = push.fetch("paths-ignore")
30+
flags = File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB
31+
32+
def ignored?(patterns, path, flags)
33+
patterns.any? do |pattern|
34+
if pattern.end_with?("/**")
35+
path.start_with?(pattern.delete_suffix("**"))
36+
else
37+
File.fnmatch?(pattern, path, flags)
38+
end
39+
end
40+
end
41+
42+
ignored_paths = [
43+
".github/workflows/ci.yml",
44+
"actions/setup-java-with-retry/action.yml",
45+
"shenyu-e2e/shenyu-e2e-case/pom.xml",
46+
"shenyu-integrated-test/shenyu-integrated-test-grpc/pom.xml",
47+
"shenyu-examples/shenyu-examples-http/pom.xml"
48+
]
49+
runtime_paths = [
50+
"pom.xml",
51+
"db/init/mysql/schema.sql",
52+
"shenyu-admin/src/main/java/Admin.java",
53+
"shenyu-plugin/shenyu-plugin-api/src/main/java/ShenyuPlugin.java",
54+
"shenyu-dist/shenyu-admin-dist/docker/Dockerfile"
55+
]
56+
57+
ignored_paths.each do |path|
58+
raise "Expected #{path} to skip GHCR publishing" unless ignored?(patterns, path, flags)
59+
end
60+
61+
runtime_paths.each do |path|
62+
raise "Expected #{path} to trigger GHCR publishing" if ignored?(patterns, path, flags)
63+
end
64+
65+
raise "Release tag publishing must remain enabled" unless push.fetch("tags").include?("v*.*.*")
66+
67+
puts "GHCR publish path tests passed"
68+
RUBY

0 commit comments

Comments
 (0)