fix(ci): wait for code queue workdirs smoke

This commit is contained in:
Codex
2026-05-19 04:09:56 +00:00
parent 2a45bfe180
commit 033bdb9f1f
@@ -938,23 +938,62 @@ spec:
proxy_get() {
local service_name="$1"
local path="$2"
curl -fsS --cacert "$kube_ca" -H "Authorization: Bearer $kube_token" \
"$kube_api/api/v1/namespaces/$ns/services/${service_name}:4222/proxy$path"
local output_path="${3:-}"
local tries="${4:-1}"
local response_path="/tmp/unidesk-dev-e2e-proxy-${service_name}-$(printf '%s' "$path" | tr -c 'A-Za-z0-9' '-').json"
local code="000"
local attempt=1
while [ "$attempt" -le "$tries" ]; do
code="$(curl -sS -o "$response_path" -w "%{http_code}" --cacert "$kube_ca" -H "Authorization: Bearer $kube_token" \
"$kube_api/api/v1/namespaces/$ns/services/${service_name}:4222/proxy$path" || true)"
if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then
if [ -n "$output_path" ]; then
cp "$response_path" "$output_path"
else
cat "$response_path"
fi
return 0
fi
echo "dev_e2e_proxy_get_retry service=$service_name path=$path status=$code attempt=$attempt/$tries" >&2
cat "$response_path" >&2 || true
if [ "$attempt" -lt "$tries" ]; then sleep 2; fi
attempt=$((attempt + 1))
done
if [ -n "$output_path" ]; then cp "$response_path" "$output_path" 2>/dev/null || true; fi
return 22
}
proxy_json() {
local method="$1"
local service_name="$2"
local path="$3"
local body="${4:-}"
local output_path="${5:-}"
local tries="${6:-1}"
local response_path="/tmp/unidesk-dev-e2e-proxy-${service_name}-${method}-$(printf '%s' "$path" | tr -c 'A-Za-z0-9' '-').json"
local code="000"
local attempt=1
local curl_args=(--cacert "$kube_ca" -H "Authorization: Bearer $kube_token" -X "$method")
if [ -n "$body" ]; then
curl -fsS --cacert "$kube_ca" -H "Authorization: Bearer $kube_token" -H "Content-Type: application/json" \
-X "$method" --data "$body" \
"$kube_api/api/v1/namespaces/$ns/services/${service_name}:4222/proxy$path"
else
curl -fsS --cacert "$kube_ca" -H "Authorization: Bearer $kube_token" \
-X "$method" \
"$kube_api/api/v1/namespaces/$ns/services/${service_name}:4222/proxy$path"
curl_args+=(-H "Content-Type: application/json" --data "$body")
fi
while [ "$attempt" -le "$tries" ]; do
code="$(curl -sS -o "$response_path" -w "%{http_code}" "${curl_args[@]}" \
"$kube_api/api/v1/namespaces/$ns/services/${service_name}:4222/proxy$path" || true)"
if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then
if [ -n "$output_path" ]; then
cp "$response_path" "$output_path"
else
cat "$response_path"
fi
return 0
fi
echo "dev_e2e_proxy_json_retry method=$method service=$service_name path=$path status=$code attempt=$attempt/$tries" >&2
cat "$response_path" >&2 || true
if [ "$attempt" -lt "$tries" ]; then sleep 2; fi
attempt=$((attempt + 1))
done
if [ -n "$output_path" ]; then cp "$response_path" "$output_path" 2>/dev/null || true; fi
return 22
}
wait_deployment_available() {
local deployment="$1"
@@ -1309,13 +1348,13 @@ spec:
wait_deployment_available code-queue-read-dev 420
wait_deployment_available code-queue-write-dev 420
proxy_get code-queue-write-dev /health >"$run_dir/code-queue-write-health.json"
proxy_get code-queue-scheduler-dev /health >"$run_dir/code-queue-scheduler-health.json"
proxy_get code-queue-read-dev /live >"$run_dir/code-queue-read-live.json"
proxy_get code-queue-read-dev /api/workdirs >"$run_dir/code-queue-read-workdirs.json"
proxy_json POST code-queue-write-dev /api/workdirs '{"providerId":"D601-dev","executionMode":"default","path":"/home/ubuntu/unidesk-dev-workspace/ci-workdirs-smoke"}' >"$run_dir/code-queue-workdir-created.json"
proxy_get code-queue-write-dev '/api/workdirs?providerId=D601-dev&executionMode=default' >"$run_dir/code-queue-write-workdirs.json"
proxy_json DELETE code-queue-write-dev /api/workdirs/D601-dev/default/%2Fhome%2Fubuntu%2Funidesk-dev-workspace%2Fci-workdirs-smoke >"$run_dir/code-queue-workdir-deleted.json"
proxy_get code-queue-write-dev /health "$run_dir/code-queue-write-health.json" 30
proxy_get code-queue-scheduler-dev /health "$run_dir/code-queue-scheduler-health.json" 30
proxy_get code-queue-read-dev /live "$run_dir/code-queue-read-live.json" 30
proxy_get code-queue-read-dev /api/workdirs "$run_dir/code-queue-read-workdirs.json" 30
proxy_json POST code-queue-write-dev /api/workdirs '{"providerId":"D601-dev","executionMode":"default","path":"/home/ubuntu/unidesk-dev-workspace/ci-workdirs-smoke"}' "$run_dir/code-queue-workdir-created.json" 30
proxy_get code-queue-write-dev '/api/workdirs?providerId=D601-dev&executionMode=default' "$run_dir/code-queue-write-workdirs.json" 30
proxy_json DELETE code-queue-write-dev /api/workdirs/D601-dev/default/%2Fhome%2Fubuntu%2Funidesk-dev-workspace%2Fci-workdirs-smoke "" "$run_dir/code-queue-workdir-deleted.json" 30
bun - "$ns" "$(params.deploy-commit)" "$backend_commit" "$frontend_commit" "$code_queue_commit" "$app_image" "$result_json" "$run_dir" <<'BUN'
const [ns, deployCommit, backendCommit, frontendCommit, codeQueueCommit, appImage, resultPath, runDir] = process.argv.slice(2);