Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/scripts/resolve-ci-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,24 @@ add_module() {
modules+=("${module}")
}

is_root_reactor_module() {
local module="$1"
local candidate="${module}"

while [[ "${candidate}" == */* ]]; do
if grep -Fq "<module>${candidate}</module>" pom.xml; then
return 0
fi
candidate="${candidate%/*}"
done

grep -Fq "<module>${candidate}</module>" pom.xml
}

find_module() {
local path="$1"
local dir
local module

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

while [[ "${dir}" != "." && "${dir}" != "/" ]]; do
if [[ -f "${dir}/pom.xml" ]]; then
printf '%s\n' "${dir#./}"
module="${dir#./}"
if is_root_reactor_module "${module}"; then
printf '%s\n' "${module}"
fi
return
fi
dir="$(dirname "${dir}")"
Expand Down Expand Up @@ -95,6 +113,8 @@ while IFS= read -r file; do
module="$(find_module "${file}")"
if [[ -n "${module:-}" ]]; then
add_module "${module}"
else
full_build_required=true
fi
fi
done < <(printf '%s' "${changed_files_json}" | jq -r '.[]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ services:
ports:
- "30432:5432"
volumes:
- /tmp/shenyu-e2e/opengauss/schema/create-table.sql:/docker-entrypoint-initdb.d
- /tmp/shenyu-e2e/opengauss/schema/create-table.sql:/docker-entrypoint-initdb.d/create-table.sql
deploy:
resources:
limits:
cpus: '1'
memory: 768M
memory: 4G
reservations:
cpus: '0.5'
memory: 512M
memory: 2G
healthcheck:
test: [ "CMD-SHELL", "gsql -U gaussdb -h127.0.0.1 -p5432 -dshenyu -WShenYuE2E@123 -c \"SELECT 1\"" ]
test: [ "CMD-SHELL", "gsql -U gaussdb -h 127.0.0.1 -p 5432 -d shenyu -c \"SELECT 1\"" ]
interval: 10s
timeout: 5s
retries: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
ports:
- "30432:5432"
volumes:
- /tmp/shenyu-e2e/postgres/schema/create-table.sql:/docker-entrypoint-initdb.d
- /tmp/shenyu-e2e/postgres/schema/create-table.sql:/docker-entrypoint-initdb.d/create-table.sql
healthcheck:
test: [ "CMD-SHELL", "psql -U shenyue2e -h127.0.0.1 -p5432 -dshenyu -c \"SELECT 1\"" ]
interval: 10s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,34 @@
# limitations under the License.
#

set -euo pipefail

# init kubernetes for h2
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$curPath")
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-h2.yml up -d --quiet-pull
sleep 30s
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-h2.yml"

# execute healthcheck.sh
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh h2 http://localhost:31095/actuator/health http://localhost:31195/actuator/health
# Start services and wait for their healthchecks.
docker network create -d bridge shenyu || true
trap 'docker compose -f "$COMPOSE_FILE" down || true' EXIT
dump_logs() {
echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-admin || true
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-bootstrap || true
}
if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull --wait --wait-timeout 300; then
dump_logs
exit 1
fi
## run e2e-test
sleep 60s

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
exit 1
fi

echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-h2.yml logs shenyu-admin
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-h2.yml logs shenyu-bootstrap
dump_logs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@
# limitations under the License.
#

set -euo pipefail

# init kubernetes for h2
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_mysql.sh
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$curPath")
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-mysql.yml up -d --quiet-pull
sleep 30s
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-mysql.yml"

# execute healthcheck.sh
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh h2 http://localhost:31095/actuator/health http://localhost:31195/actuator/health
# Start services and wait for their healthchecks.
docker network create -d bridge shenyu || true
trap 'docker compose -f "$COMPOSE_FILE" down || true' EXIT
dump_logs() {
echo "shenyu-mysql log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-mysql || true
echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-admin || true
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-bootstrap || true
}
if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull --wait --wait-timeout 300; then
dump_logs
exit 1
fi
## run e2e-test
sleep 60s

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
exit 1
fi

echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-mysql.yml logs shenyu-admin
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-mysql.yml logs shenyu-bootstrap
dump_logs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@
# limitations under the License.
#

set -euo pipefail

# init kubernetes for h2
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_opengauss.sh
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$curPath")
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-opengauss.yml up -d --quiet-pull
sleep 30s
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-opengauss.yml"

# execute healthcheck.sh
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh h2 http://localhost:31095/actuator/health http://localhost:31195/actuator/health
# Start services and wait for their healthchecks.
docker network create -d bridge shenyu || true
trap 'docker compose -f "$COMPOSE_FILE" down || true' EXIT
dump_logs() {
echo "shenyu-opengauss log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-opengauss || true
echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-admin || true
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-bootstrap || true
}
if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull --wait --wait-timeout 300; then
dump_logs
exit 1
fi
## run e2e-test
sleep 60s

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
exit 1
fi

echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-opengauss.yml logs shenyu-admin
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-opengauss.yml logs shenyu-bootstrap
dump_logs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,38 @@
# limitations under the License.
#

set -euo pipefail

# init kubernetes for h2
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_postgres.sh
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$curPath")
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-postgres.yml up -d --quiet-pull
sleep 30s
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-postgres.yml"

# execute healthcheck.sh
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh h2 http://localhost:31095/actuator/health http://localhost:31195/actuator/health
# Start services and wait for their healthchecks.
docker network create -d bridge shenyu || true
trap 'docker compose -f "$COMPOSE_FILE" down || true' EXIT
dump_logs() {
echo "shenyu-postgres log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-postgres || true
echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-admin || true
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs shenyu-bootstrap || true
}
if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull --wait --wait-timeout 300; then
dump_logs
exit 1
fi
## run e2e-test
sleep 60s

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
exit 1
fi

echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-postgres.yml logs shenyu-admin
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-postgres.yml logs shenyu-bootstrap
dump_logs
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,46 @@
# limitations under the License.
#

set -euo pipefail

# init kubernetes for h2
SHENYU_TESTCASE_DIR=$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$curPath")

docker network create -d bridge shenyu
docker network create -d bridge shenyu || true

COMPOSE_FILE=""
cleanup() {
if [ -n "$COMPOSE_FILE" ]; then
docker compose -f "$COMPOSE_FILE" down || true
fi
}
dump_logs() {
echo "compose service logs:"
echo "------------------"
docker compose -f "$COMPOSE_FILE" logs || true
}
trap cleanup EXIT

STORAGE_ARRAY=("h2" "mysql" "opengauss" "postgres")
for storage in "${STORAGE_ARRAY[@]}"; do
if [ "$storage" != "h2" ]; then
bash "${SHENYU_TESTCASE_DIR}"/k8s/script/storage/storage_init_"${storage}".sh
fi

docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-"${storage}".yml up -d --quiet-pull
sleep 30s

# execute healthcheck.sh
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh "${storage}" http://localhost:31095/actuator/health http://localhost:31195/actuator/health
COMPOSE_FILE="$SHENYU_TESTCASE_DIR/compose/storage/shenyu-storage-$storage.yml"
if ! docker compose -f "$COMPOSE_FILE" up -d --quiet-pull --wait --wait-timeout 300; then
dump_logs
exit 1
fi
## run e2e-test
sleep 60s

./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test

echo "shenyu-admin log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-"${storage}".yml logs shenyu-admin
echo "shenyu-bootstrap log:"
echo "------------------"
docker compose -f "$SHENYU_TESTCASE_DIR"/compose/storage/shenyu-storage-"${storage}".yml logs shenyu-bootstrap
if ! ./mvnw -B -f ./shenyu-e2e/pom.xml -pl shenyu-e2e-case/shenyu-e2e-case-storage -am test; then
dump_logs
exit 1
fi

dump_logs
docker compose -f "$COMPOSE_FILE" down || true
COMPOSE_FILE=""
done
Loading