-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_platform_workflows.sh
More file actions
executable file
·137 lines (123 loc) · 5.44 KB
/
Copy pathcheck_platform_workflows.sh
File metadata and controls
executable file
·137 lines (123 loc) · 5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
#
# check_platform_workflows.sh
#
# Health check for the GitHub Actions workflows that build+push
# platform/system Docker images (omnibioai-auth, omnibioai-tes,
# omnibioai-toolserver, etc.) to ghcr.io/omnibioai.
#
# Deliberately does NOT re-verify "is the image on the registry" the way
# check_base_images.sh does for base images -- if CI/CD is the actual
# push mechanism for these repos, a local push-tracking check would just
# duplicate that guarantee. The real risk for a CI/CD-driven category is
# "is the automation still working", so this checks workflow run health
# via the Actions API instead.
#
# IMPORTANT, discovered 2026-07-27: as of today, EVERY docker-push workflow
# in this list is sitting in .github/workflows_disabled/ (moved there by
# disable_cicd.sh, commit message "re-enable before launch"), and the last
# runs recorded before being disabled (2026-06-10) were themselves FAILING,
# not passing. So right now this check will report DISABLED for the whole
# list, which is expected and not a bug in the check -- but it also means
# the assumption "CI/CD already guarantees these get pushed" does NOT
# currently hold. Nothing is pushing these images automatically right now.
# Re-run this after CI/CD is re-enabled for it to be a meaningful signal
# again; until then treat DISABLED as "no push guarantee exists, verify
# manually" rather than "healthy, nothing to do".
#
# Usage: GH_TOKEN=... ./check_platform_workflows.sh [machine_dir]
set -uo pipefail
MACHINE_DIR="${1:-$HOME/Desktop/machine}"
# Falls back to the gh CLI's own stored credentials (gh auth login) when
# GH_TOKEN isn't exported -- cron runs with a minimal environment, so this
# is what lets this script work unattended instead of failing silently
# every night on a missing env var.
GH_TOKEN="${GH_TOKEN:-$(gh auth token 2>/dev/null)}"
: "${GH_TOKEN:?No GH_TOKEN set and 'gh auth token' returned nothing -- run 'gh auth login' or export GH_TOKEN}"
STALE_DAYS=14
# repo -> docker-push workflow filename (discovered by grepping
# .github/workflows{,_disabled}/*.y*ml for docker/build-push-action|ghcr.io)
declare -A REPO_WORKFLOWS=(
[omnibioai-tes]=ci.yml
[omnibioai-lims]=ci.yml
[omnibioai-rag]=ci.yml
[omnibioai-model-registry]=ci.yml
[omnibioai-control-center]=ci.yml
[omnibioai-dev-hub]=ci.yml
[omnibioai-sdk]=ci.yml
[omnibioai-workflow-bundles]=ci.yml
[omnibioai-auth]=ci.yml
[omnibioai-policy-engine]=ci.yml
[omnibioai-hpc-policy-engine]=ci.yml
[omnibioai-security-audit]=ci.yml
[omnibioai-api-gateway]=ci.yml
[omnibioai-launcher]=docker-publish.yml
[omnibioai-toolserver]=ci.yml
[omnibioai-tool-runtime]=ci.yml
[omnibioai-iam-client]=ci.yml
[omnibioai-security-sdk]=ci.yml
[omnibioai]=ci.yml
[omnibioai-videos]=ci.yml
)
gh_api_get() {
curl -s -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" "$1"
}
now_epoch=$(date +%s)
declare -a DISABLED_LIST=()
declare -a FAILING_LIST=()
declare -a STALE_LIST=()
declare -a OK_LIST=()
declare -a UNKNOWN_LIST=()
for repo in "${!REPO_WORKFLOWS[@]}"; do
wf="${REPO_WORKFLOWS[$repo]}"
active_path="${MACHINE_DIR}/${repo}/.github/workflows/${wf}"
disabled_path="${MACHINE_DIR}/${repo}/.github/workflows_disabled/${wf}"
is_disabled=false
if [ -f "$disabled_path" ] && [ ! -f "$active_path" ]; then
is_disabled=true
fi
runs=$(gh_api_get "https://api.github.com/repos/OmniBioAI/${repo}/actions/runs?per_page=1")
run_count=$(echo "$runs" | jq -r '.total_count // 0' 2>/dev/null)
if [ -z "$run_count" ] || [ "$run_count" = "0" ] || [ "$run_count" = "null" ]; then
echo "[UNKNOWN] $repo/$wf -- no workflow runs found via API"
UNKNOWN_LIST+=("$repo")
continue
fi
conclusion=$(echo "$runs" | jq -r '.workflow_runs[0].conclusion')
created_at=$(echo "$runs" | jq -r '.workflow_runs[0].created_at')
run_epoch=$(date -d "$created_at" +%s 2>/dev/null)
age_days=$(( (now_epoch - run_epoch) / 86400 ))
if $is_disabled; then
echo "[DISABLED] $repo/$wf -- workflow disabled; last recorded run: $conclusion on $created_at (${age_days}d ago)"
DISABLED_LIST+=("$repo (last: $conclusion, ${age_days}d ago)")
elif [ "$conclusion" = "failure" ] || [ "$conclusion" = "cancelled" ] || [ "$conclusion" = "timed_out" ]; then
echo "[FAILING] $repo/$wf -- last run: $conclusion on $created_at (${age_days}d ago)"
FAILING_LIST+=("$repo (last: $conclusion, ${age_days}d ago)")
elif [ "$age_days" -gt "$STALE_DAYS" ]; then
echo "[STALE] $repo/$wf -- active but no run in ${age_days}d (last: $conclusion on $created_at)"
STALE_LIST+=("$repo (${age_days}d since last run)")
elif [ "$conclusion" = "success" ]; then
echo "[OK] $repo/$wf -- last run succeeded $created_at (${age_days}d ago)"
OK_LIST+=("$repo")
else
echo "[UNKNOWN] $repo/$wf -- unrecognized conclusion '$conclusion'"
UNKNOWN_LIST+=("$repo")
fi
done
echo ""
echo "==== Summary ===="
echo "OK: ${#OK_LIST[@]}"
echo "FAILING: ${#FAILING_LIST[@]}"
echo "STALE: ${#STALE_LIST[@]}"
echo "DISABLED: ${#DISABLED_LIST[@]}"
echo "UNKNOWN: ${#UNKNOWN_LIST[@]}"
if [ ${#DISABLED_LIST[@]} -gt 0 ]; then
echo ""
echo "!! ${#DISABLED_LIST[@]} of ${#REPO_WORKFLOWS[@]} repos have their docker-push workflow disabled."
echo " CI/CD is NOT currently providing a push guarantee for these images."
fi
if [ ${#FAILING_LIST[@]} -gt 0 ]; then
echo ""
echo "!! Repos with a failing docker-push workflow (active, but broken):"
for r in "${FAILING_LIST[@]}"; do echo " - $r"; done
fi