feat(runner): classify current cd non110 queue readiness
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 40s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 40s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -220,6 +220,15 @@ def validate_harbor_registry_controlled_recovery_receipt(
|
||||
"gitea_queue_latest_cd_run_status": gitea_queue[
|
||||
"latest_visible_cd_run_status"
|
||||
],
|
||||
"gitea_queue_current_cd_waiting_for_runner_or_queue": gitea_queue[
|
||||
"current_cd_waiting_for_runner_or_queue"
|
||||
],
|
||||
"gitea_queue_current_cd_no_matching_runner_label": gitea_queue[
|
||||
"current_cd_no_matching_runner_label"
|
||||
],
|
||||
"gitea_queue_controlled_profile_no_matching_runner_label_count": (
|
||||
gitea_queue["controlled_profile_no_matching_runner_label_count"]
|
||||
),
|
||||
"gitea_queue_harbor_110_repair_run_status": gitea_queue[
|
||||
"latest_visible_harbor_110_repair_run_status"
|
||||
],
|
||||
@@ -840,10 +849,15 @@ def _gitea_queue_readback(value: Any) -> dict[str, Any]:
|
||||
"status": "not_provided",
|
||||
"latest_visible_cd_run_id": "",
|
||||
"latest_visible_cd_run_status": "",
|
||||
"latest_visible_cd_run_waiting": False,
|
||||
"latest_visible_cd_run_commit_sha": "",
|
||||
"current_cd_no_matching_runner_label": "",
|
||||
"current_cd_waiting_for_runner_or_queue": False,
|
||||
"current_cd_inflight_classifier": "",
|
||||
"current_cd_harbor_latest_registry_v2_status": "",
|
||||
"current_cd_harbor_retrying_unavailable": False,
|
||||
"controlled_profile_no_matching_runner_labels": {},
|
||||
"controlled_profile_no_matching_runner_label_count": 0,
|
||||
"cd_run_jobs_stale_or_mismatched": False,
|
||||
"cd_run_jobs_payload_classifier": "",
|
||||
"cd_run_jobs_head_sha_mismatch": False,
|
||||
@@ -905,6 +919,23 @@ def _gitea_queue_readback(value: Any) -> dict[str, Any]:
|
||||
or readback.get("latest_visible_cd_inflight_classifier")
|
||||
or ""
|
||||
)
|
||||
current_cd_waiting = bool(
|
||||
rollups.get("current_main_cd_run_waiting") is True
|
||||
or readback.get("latest_visible_cd_run_waiting") is True
|
||||
)
|
||||
current_cd_no_matching_label = str(
|
||||
rollups.get("current_main_cd_no_matching_runner_label")
|
||||
or readback.get("latest_visible_cd_no_matching_runner_label")
|
||||
or ""
|
||||
)
|
||||
controlled_profile_no_matching_labels = {
|
||||
str(key): str(label)
|
||||
for key, label in _dict(
|
||||
readback.get("controlled_profile_no_matching_runner_labels")
|
||||
or rollups.get("controlled_profile_no_matching_runner_labels")
|
||||
).items()
|
||||
if label
|
||||
}
|
||||
current_cd_latest_registry_status = str(
|
||||
rollups.get("current_main_cd_harbor_latest_registry_v2_status")
|
||||
or readback.get("latest_visible_cd_harbor_latest_registry_v2_status")
|
||||
@@ -956,6 +987,8 @@ def _gitea_queue_readback(value: Any) -> dict[str, Any]:
|
||||
jobs_stale=jobs_stale,
|
||||
jobs_cross_workflow=jobs_cross_workflow,
|
||||
current_cd_harbor_retrying=current_cd_harbor_retrying,
|
||||
current_cd_waiting=current_cd_waiting,
|
||||
current_cd_no_matching_runner=bool(current_cd_no_matching_label),
|
||||
cd_jobs_stale=cd_jobs_stale,
|
||||
cd_jobs_head_sha_mismatch=cd_jobs_head_sha_mismatch,
|
||||
cd_jobs_run_id_mismatch=cd_jobs_run_id_mismatch,
|
||||
@@ -966,6 +999,8 @@ def _gitea_queue_readback(value: Any) -> dict[str, Any]:
|
||||
cd_jobs_payload_classifier=cd_jobs_payload_classifier,
|
||||
harbor_jobs_payload_classifier=harbor_jobs_payload_classifier,
|
||||
no_matching_label=no_matching_label,
|
||||
current_cd_no_matching_label=current_cd_no_matching_label,
|
||||
current_cd_waiting=current_cd_waiting,
|
||||
blockers=blockers,
|
||||
)
|
||||
return {
|
||||
@@ -976,14 +1011,23 @@ def _gitea_queue_readback(value: Any) -> dict[str, Any]:
|
||||
"latest_visible_cd_run_status": str(
|
||||
readback.get("latest_visible_cd_run_status") or ""
|
||||
),
|
||||
"latest_visible_cd_run_waiting": current_cd_waiting,
|
||||
"latest_visible_cd_run_commit_sha": str(
|
||||
readback.get("latest_visible_cd_run_commit_sha") or ""
|
||||
),
|
||||
"current_cd_no_matching_runner_label": current_cd_no_matching_label,
|
||||
"current_cd_waiting_for_runner_or_queue": current_cd_waiting,
|
||||
"current_cd_inflight_classifier": current_cd_inflight_classifier,
|
||||
"current_cd_harbor_latest_registry_v2_status": (
|
||||
current_cd_latest_registry_status
|
||||
),
|
||||
"current_cd_harbor_retrying_unavailable": current_cd_harbor_retrying,
|
||||
"controlled_profile_no_matching_runner_labels": (
|
||||
controlled_profile_no_matching_labels
|
||||
),
|
||||
"controlled_profile_no_matching_runner_label_count": len(
|
||||
controlled_profile_no_matching_labels
|
||||
),
|
||||
"cd_run_jobs_stale_or_mismatched": cd_jobs_stale,
|
||||
"cd_run_jobs_payload_classifier": cd_jobs_payload_classifier,
|
||||
"cd_run_jobs_head_sha_mismatch": cd_jobs_head_sha_mismatch,
|
||||
@@ -1040,9 +1084,11 @@ def _gitea_queue_normalized_classifier_fields(
|
||||
cd_jobs_payload_classifier: str,
|
||||
harbor_jobs_payload_classifier: str,
|
||||
no_matching_label: str,
|
||||
current_cd_no_matching_label: str,
|
||||
current_cd_waiting: bool,
|
||||
blockers: list[str],
|
||||
) -> list[dict[str, Any]]:
|
||||
return [
|
||||
fields = [
|
||||
{
|
||||
"field_id": "cd_run_jobs_payload_classifier",
|
||||
"value": cd_jobs_payload_classifier,
|
||||
@@ -1075,6 +1121,22 @@ def _gitea_queue_normalized_classifier_fields(
|
||||
"raw_output_returned": False,
|
||||
},
|
||||
]
|
||||
if current_cd_no_matching_label or current_cd_waiting:
|
||||
fields.append(
|
||||
{
|
||||
"field_id": "current_cd_workflow_runner_readiness",
|
||||
"value": current_cd_no_matching_label,
|
||||
"waiting": current_cd_waiting,
|
||||
"blockers": [
|
||||
item
|
||||
for item in blockers
|
||||
if item.startswith("gitea_queue_current_cd_")
|
||||
],
|
||||
"metadata_only": True,
|
||||
"raw_output_returned": False,
|
||||
}
|
||||
)
|
||||
return fields
|
||||
|
||||
|
||||
def _gitea_queue_blockers(
|
||||
@@ -1083,6 +1145,8 @@ def _gitea_queue_blockers(
|
||||
jobs_stale: bool,
|
||||
jobs_cross_workflow: bool,
|
||||
current_cd_harbor_retrying: bool,
|
||||
current_cd_waiting: bool,
|
||||
current_cd_no_matching_runner: bool,
|
||||
cd_jobs_stale: bool,
|
||||
cd_jobs_head_sha_mismatch: bool,
|
||||
cd_jobs_run_id_mismatch: bool,
|
||||
@@ -1092,6 +1156,10 @@ def _gitea_queue_blockers(
|
||||
blockers: list[str] = []
|
||||
if current_cd_harbor_retrying:
|
||||
blockers.append("gitea_queue_current_cd_harbor_retrying_unavailable")
|
||||
if current_cd_no_matching_runner:
|
||||
blockers.append("gitea_queue_current_cd_no_matching_runner")
|
||||
if current_cd_waiting:
|
||||
blockers.append("gitea_queue_current_cd_waiting_for_runner_or_queue")
|
||||
if cd_jobs_head_sha_mismatch:
|
||||
blockers.append("gitea_queue_cd_jobs_head_sha_mismatch")
|
||||
if cd_jobs_run_id_mismatch:
|
||||
|
||||
@@ -530,6 +530,50 @@ def test_harbor_recovery_receipt_surfaces_cd_jobs_payload_classifier() -> None:
|
||||
]
|
||||
|
||||
|
||||
def test_harbor_recovery_receipt_surfaces_current_cd_runner_readiness() -> None:
|
||||
payload = validate_harbor_registry_controlled_recovery_receipt(
|
||||
{
|
||||
"gitea_actions_queue_readback": _gitea_queue_current_cd_waiting_non110(),
|
||||
}
|
||||
)
|
||||
|
||||
assert "gitea_queue_current_cd_no_matching_runner" in payload["active_blockers"]
|
||||
assert (
|
||||
"gitea_queue_current_cd_waiting_for_runner_or_queue"
|
||||
in payload["active_blockers"]
|
||||
)
|
||||
queue = payload["readback"]["gitea_actions_queue"]
|
||||
assert queue["current_cd_waiting_for_runner_or_queue"] is True
|
||||
assert queue["current_cd_no_matching_runner_label"] == "awoooi-non110-ubuntu"
|
||||
assert queue["controlled_profile_no_matching_runner_labels"] == {
|
||||
"cd.yaml": "awoooi-non110-ubuntu",
|
||||
"harbor-110-local-repair.yaml": "awoooi-non110-host",
|
||||
}
|
||||
normalized = {
|
||||
item["field_id"]: item for item in queue["normalized_classifier_fields"]
|
||||
}
|
||||
assert normalized["current_cd_workflow_runner_readiness"]["value"] == (
|
||||
"awoooi-non110-ubuntu"
|
||||
)
|
||||
assert normalized["current_cd_workflow_runner_readiness"]["waiting"] is True
|
||||
assert normalized["current_cd_workflow_runner_readiness"]["blockers"] == [
|
||||
"gitea_queue_current_cd_no_matching_runner",
|
||||
"gitea_queue_current_cd_waiting_for_runner_or_queue",
|
||||
]
|
||||
assert payload["rollups"][
|
||||
"gitea_queue_current_cd_waiting_for_runner_or_queue"
|
||||
] is True
|
||||
assert payload["rollups"]["gitea_queue_current_cd_no_matching_runner_label"] == (
|
||||
"awoooi-non110-ubuntu"
|
||||
)
|
||||
assert (
|
||||
payload["rollups"][
|
||||
"gitea_queue_controlled_profile_no_matching_runner_label_count"
|
||||
]
|
||||
== 2
|
||||
)
|
||||
|
||||
|
||||
def test_harbor_recovery_receipt_waits_for_deploy_marker_readback() -> None:
|
||||
payload = validate_harbor_registry_controlled_recovery_receipt(
|
||||
{
|
||||
@@ -864,6 +908,40 @@ def _gitea_queue_cd_jobs_head_sha_mismatch() -> dict:
|
||||
return payload
|
||||
|
||||
|
||||
def _gitea_queue_current_cd_waiting_non110() -> dict:
|
||||
payload = _gitea_queue_cd_jobs_head_sha_mismatch()
|
||||
payload["status"] = "blocked_current_cd_workflow_waiting_for_runner_or_queue"
|
||||
payload["readback"].update(
|
||||
{
|
||||
"latest_visible_cd_run_status": "Waiting",
|
||||
"latest_visible_cd_run_waiting": True,
|
||||
"latest_visible_cd_no_matching_runner_label": "awoooi-non110-ubuntu",
|
||||
"controlled_profile_no_matching_runner_labels": {
|
||||
"cd.yaml": "awoooi-non110-ubuntu",
|
||||
"harbor-110-local-repair.yaml": "awoooi-non110-host",
|
||||
},
|
||||
"controlled_profile_no_matching_runner_label_count": 2,
|
||||
"latest_visible_harbor_110_repair_no_matching_runner_label": (
|
||||
"awoooi-non110-host"
|
||||
),
|
||||
}
|
||||
)
|
||||
payload["rollups"].update(
|
||||
{
|
||||
"current_main_cd_run_status": "Waiting",
|
||||
"current_main_cd_run_waiting": True,
|
||||
"current_main_cd_no_matching_runner_label": "awoooi-non110-ubuntu",
|
||||
"controlled_profile_no_matching_runner_label_count": 2,
|
||||
"controlled_profile_no_matching_runner_labels": {
|
||||
"cd.yaml": "awoooi-non110-ubuntu",
|
||||
"harbor-110-local-repair.yaml": "awoooi-non110-host",
|
||||
},
|
||||
"harbor_110_repair_no_matching_runner_label": "awoooi-non110-host",
|
||||
}
|
||||
)
|
||||
return payload
|
||||
|
||||
|
||||
def _deploy_marker_verified() -> dict:
|
||||
return {
|
||||
"schema_version": "awoooi_production_deploy_readback_blocker_v1",
|
||||
|
||||
Reference in New Issue
Block a user