Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
15 changes: 11 additions & 4 deletions .github/actions/cpflow-wait-for-health/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Wait for Control Plane workload health
description: >-
Polls the workload's status endpoint with curl and exits success when the
HTTP response status is in the accepted list. Fails non-zero (and reports
`healthy=false`) once retries are exhausted.
Polls Control Plane until the latest workload version is ready, then checks
the workload endpoint with curl. Exits success when the HTTP response status
is in the accepted list. Fails non-zero (and reports `healthy=false`) once
retries are exhausted.

inputs:
workload_name:
Expand Down Expand Up @@ -68,8 +69,14 @@ runs:
exit 1
fi

workload_ready="$(echo "${workload_json}" | jq -r '.status.ready // false')"
latest_ready="$(echo "${workload_json}" | jq -r '.status.readyLatest // false')"
readiness_status="$(echo "${workload_json}" | jq -r '.health.readiness // "unknown"')"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely wrong JSON path — will always show "unknown"

The Control Plane workload object returned by cpln workload get -o json does not have a top-level .health key. Health/readiness state lives under .status (e.g. .status.ready, .status.readyLatest). The .health.readiness path will resolve to null on every poll, so the // "unknown" fallback always fires.

This only affects the log line (not the readiness gate), but it makes the "waiting for latest deployment" message permanently say readiness=unknown and removes a useful diagnostic signal. Consider dropping this field until the correct path is confirmed from a real cpln workload response, or verify the path against the API and correct it.

Suggested change
readiness_status="$(echo "${workload_json}" | jq -r '.health.readiness // "unknown"')"
readiness_status="$(echo "${workload_json}" | jq -r '.status.readyLatest // "unknown"')"

endpoint="$(echo "${workload_json}" | jq -r '.status.endpoint // empty')"
if [[ -n "${endpoint}" ]]; then

if [[ "${workload_ready}" != "true" || "${latest_ready}" != "true" ]]; then
echo "Workload status: ready=${workload_ready}, readyLatest=${latest_ready}, readiness=${readiness_status}; waiting for latest deployment."
elif [[ -n "${endpoint}" ]]; then
http_status="$(curl -s -o /dev/null -w '%{http_code}' --max-time "${CPFLOW_CURL_MAX_TIME}" "${endpoint}" 2>/dev/null || echo 000)"
echo "Endpoint: ${endpoint}, HTTP status: ${http_status}"

Expand Down
Loading
Loading