From a9567cbc260481daa1220ea54c537aeb5595c24b Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Jul 2026 09:59:28 +0800 Subject: [PATCH] fix(runner): stop harbor repair after failed check --- .gitea/workflows/harbor-110-local-repair.yaml | 18 +++++++++++++++++- .../test_cd_controlled_runtime_profile.py | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/harbor-110-local-repair.yaml b/.gitea/workflows/harbor-110-local-repair.yaml index 0b425898f..351395777 100644 --- a/.gitea/workflows/harbor-110-local-repair.yaml +++ b/.gitea/workflows/harbor-110-local-repair.yaml @@ -157,6 +157,7 @@ jobs: echo "harbor_110_remote_ssh_reachable=true" if ! run_ssh 'test -x /usr/local/bin/recover-110-control-path-and-harbor-local.sh'; then + diagnose_ssh_control_channel || true echo "BLOCKED harbor_110_local_recovery_script_missing path=/usr/local/bin/recover-110-control-path-and-harbor-local.sh" exit 65 fi @@ -178,6 +179,11 @@ jobs: set -e printf '%s\n' "${check_output}" echo "harbor_110_remote_repair_check_rc=${check_rc}" + if [ "${check_rc}" -ne 0 ]; then + diagnose_ssh_control_channel || true + echo "BLOCKED harbor_110_remote_repair_check_unavailable rc=${check_rc}" + exit 65 + fi trigger="${GITHUB_EVENT_NAME:-${AWOOOI_HARBOR_110_LOCAL_REPAIR_TRIGGER:-unknown}}" echo "harbor_110_remote_repair_trigger=${trigger}" @@ -188,7 +194,17 @@ jobs: fi echo "harbor_110_remote_repair_apply_all_start=1" - run_recovery --apply-all + set +e + apply_output="$(run_recovery --apply-all 2>&1)" + apply_rc=$? + set -e + printf '%s\n' "${apply_output}" + echo "harbor_110_remote_repair_apply_all_rc=${apply_rc}" + if [ "${apply_rc}" -ne 0 ]; then + diagnose_ssh_control_channel || true + echo "BLOCKED harbor_110_remote_repair_apply_all_failed rc=${apply_rc}" + exit "${apply_rc}" + fi local_status="$( run_ssh 'curl --silent --show-error --output /dev/null --write-out "%{http_code}" --max-time 10 http://127.0.0.1:5000/v2/ || true' diff --git a/ops/runner/test_cd_controlled_runtime_profile.py b/ops/runner/test_cd_controlled_runtime_profile.py index 91518cb25..d018c66ac 100644 --- a/ops/runner/test_cd_controlled_runtime_profile.py +++ b/ops/runner/test_cd_controlled_runtime_profile.py @@ -149,7 +149,11 @@ def test_harbor_110_local_repair_workflow_is_dispatch_only_and_bounded() -> None assert "operation_boundary_remote_ssh_bounded=true" in text assert "harbor_110_remote_control_channel_unavailable" in text assert "harbor_110_remote_repair_check_start=1" in text + assert 'if [ "${check_rc}" -ne 0 ]; then' in text + assert "BLOCKED harbor_110_remote_repair_check_unavailable" in text assert "harbor_110_remote_repair_apply_all_start=1" in text + assert "harbor_110_remote_repair_apply_all_rc=" in text + assert "BLOCKED harbor_110_remote_repair_apply_all_failed" in text assert "GITHUB_EVENT_NAME" in text assert "harbor_110_remote_repair_skipped=already_ready" in text assert "192.168.0.110" in text