Stabilize self-hosted CI workflows and resolve issue #62 #73
@@ -768,7 +768,9 @@ jobs:
|
||||
output_file="$2"
|
||||
probe_tmp="$(mktemp)"
|
||||
|
||||
if ! docker compose -p "${COMPOSE_PROJECT_NAME}" -f "${COMPOSE_FILE}" exec -T backend python -c "$(printf '%s\n' \
|
||||
run_probe_with_python() {
|
||||
python_bin="$1"
|
||||
docker compose -p "${COMPOSE_PROJECT_NAME}" -f "${COMPOSE_FILE}" exec -T backend "${python_bin}" -c "$(printf '%s\n' \
|
||||
'import sys' \
|
||||
'import urllib.error' \
|
||||
'import urllib.request' \
|
||||
@@ -787,9 +789,21 @@ jobs:
|
||||
' print("000")' \
|
||||
' print("")'
|
||||
)" "${endpoint_path}" >"${probe_tmp}" 2>/dev/null
|
||||
then
|
||||
' print("")')" "${endpoint_path}"
|
||||
}
|
||||
|
||||
probe_err="$(mktemp)"
|
||||
|
||||
if run_probe_with_python python >"${probe_tmp}" 2>"${probe_err}" || run_probe_with_python python3 >"${probe_tmp}" 2>>"${probe_err}"; then
|
||||
:
|
||||
else
|
||||
: >"${output_file}"
|
||||
{
|
||||
echo '{"status":"probe_exec_failed"}'
|
||||
sed -n '1,5p' "${probe_err}" || true
|
||||
} >"${output_file}"
|
||||
rm -f "${probe_tmp}"
|
||||
rm -f "${probe_err}"
|
||||
echo "000"
|
||||
return 0
|
||||
fi
|
||||
@@ -797,6 +811,7 @@ jobs:
|
||||
http_code="$(head -n 1 "${probe_tmp}")"
|
||||
tail -n +2 "${probe_tmp}" >"${output_file}"
|
||||
rm -f "${probe_tmp}"
|
||||
rm -f "${probe_err}"
|
||||
echo "${http_code}"
|
||||
}
|
||||
|
||||
@@ -1012,7 +1027,9 @@ jobs:
|
||||
output_file="$3"
|
||||
probe_tmp="$(mktemp)"
|
||||
|
||||
if ! docker compose -p "${COMPOSE_PROJECT_NAME}" -f "${COMPOSE_FILE}" exec -T "${container_name}" python -c "$(printf '%s\n' \
|
||||
run_probe_with_python() {
|
||||
python_bin="$1"
|
||||
docker compose -p "${COMPOSE_PROJECT_NAME}" -f "${COMPOSE_FILE}" exec -T "${container_name}" "${python_bin}" -c "$(printf '%s\n' \
|
||||
'import sys' \
|
||||
'import urllib.error' \
|
||||
'import urllib.request' \
|
||||
@@ -1029,9 +1046,21 @@ jobs:
|
||||
' print(body)' \
|
||||
'except Exception:' \
|
||||
' print(\"000\")' \
|
||||
' print(\"\")')" "${endpoint_path}" >"${probe_tmp}" 2>/dev/null; then
|
||||
' print("")')" "${endpoint_path}"
|
||||
}
|
||||
|
||||
probe_err="$(mktemp)"
|
||||
|
||||
if run_probe_with_python python >"${probe_tmp}" 2>"${probe_err}" || run_probe_with_python python3 >"${probe_tmp}" 2>>"${probe_err}"; then
|
||||
:
|
||||
else
|
||||
: >"${output_file}"
|
||||
{
|
||||
echo '{"status":"probe_exec_failed"}'
|
||||
sed -n '1,5p' "${probe_err}" || true
|
||||
} >"${output_file}"
|
||||
rm -f "${probe_tmp}"
|
||||
rm -f "${probe_err}"
|
||||
echo "000"
|
||||
return 0
|
||||
fi
|
||||
@@ -1039,6 +1068,7 @@ jobs:
|
||||
http_code="$(head -n 1 "${probe_tmp}")"
|
||||
tail -n +2 "${probe_tmp}" >"${output_file}"
|
||||
rm -f "${probe_tmp}"
|
||||
rm -f "${probe_err}"
|
||||
echo "${http_code}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user