Skip to content

Commit 7636de0

Browse files
authored
Enhance port release before CI test (opea-project#1704)
Signed-off-by: chensuyue <[email protected]>
1 parent d397e3f commit 7636de0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/scripts/docker_compose_clean_up.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,20 @@ case "$1" in
3030
echo "$ports"
3131
for port in $ports; do
3232
if [[ $port =~ [a-zA-Z_-] ]]; then
33-
port=$(grep -E "export $port=" tests/$test_case | cut -d'=' -f2)
33+
echo "Search port value $port from the test case..."
34+
port_fix=$(grep -E "export $port=" tests/$test_case | cut -d'=' -f2)
35+
if [[ "$port_fix" == "" ]]; then
36+
echo "Can't find the port value from the test case, use the default value in yaml..."
37+
port_fix=$(yq '.services[].ports[]' $yaml_file | grep $port | cut -d':' -f2 | grep -o '[0-9a-zA-Z]\+')
38+
fi
39+
port=$port_fix
3440
fi
3541
if [[ $port =~ [0-9] ]]; then
3642
if [[ $port == 5000 ]]; then
3743
echo "Error: Port 5000 is used by local docker registry, please DO NOT use it in docker compose deployment!!!"
3844
exit 1
3945
fi
46+
echo "Check port $port..."
4047
cid=$(docker ps --filter "publish=${port}" --format "{{.ID}}")
4148
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && echo "release $port"; fi
4249
fi

0 commit comments

Comments
 (0)