@@ -38,15 +38,77 @@ jobs:
3838 - name : List downloaded builds
3939 run : find builds -type f | head -20
4040
41- - name : Setup Service Account
41+ # Download version info to get commit hashes
42+ - name : Download version info
43+ uses : actions/download-artifact@v4
44+ with :
45+ path : version-info
46+ pattern : version-info-*
47+ merge-multiple : true
48+
49+ # Check CI status for all commits before publishing
50+ - name : Check CI status for all versions
51+ id : ci-check
4252 if : github.ref_name == 'main'
53+ env :
54+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55+ run : |
56+ FIRECRACKER_REPO="e2b-dev/firecracker"
57+ all_passed=true
58+ failed_versions=""
59+
60+ # Read all version:hash pairs
61+ for line in $(cat version-info/built_versions.txt 2>/dev/null || echo ""); do
62+ version_name=$(echo "$line" | cut -d: -f1)
63+ commit_hash=$(echo "$line" | cut -d: -f2)
64+
65+ echo "Checking CI for $version_name (commit: $commit_hash)..."
66+
67+ # Check combined commit status
68+ status=$(gh api "/repos/${FIRECRACKER_REPO}/commits/${commit_hash}/status" --jq '.state' 2>/dev/null || echo "unknown")
69+
70+ # Check check-runs (GitHub Actions)
71+ check_conclusion=$(gh api "/repos/${FIRECRACKER_REPO}/commits/${commit_hash}/check-runs" --jq '
72+ if .total_count == 0 then "no_checks"
73+ elif ([.check_runs[].conclusion] | all(. == "success" or . == "skipped" or . == null)) then "success"
74+ elif ([.check_runs[].status] | any(. == "in_progress" or . == "queued")) then "pending"
75+ else "failure"
76+ end
77+ ' 2>/dev/null || echo "unknown")
78+
79+ echo " Status: $status, Check runs: $check_conclusion"
80+
81+ if [[ "$status" == "failure" ]] || [[ "$check_conclusion" == "failure" ]]; then
82+ echo " ❌ CI failed for $version_name"
83+ all_passed=false
84+ failed_versions="${failed_versions}${version_name} "
85+ elif [[ "$status" == "pending" ]] || [[ "$check_conclusion" == "pending" ]]; then
86+ echo " ⏳ CI still running for $version_name"
87+ all_passed=false
88+ failed_versions="${failed_versions}${version_name}(pending) "
89+ else
90+ echo " ✅ CI passed for $version_name"
91+ fi
92+ done
93+
94+ if [[ "$all_passed" == "true" ]]; then
95+ echo "All CI checks passed!"
96+ echo "ci_passed=true" >> $GITHUB_OUTPUT
97+ else
98+ echo "CI checks failed or pending for: $failed_versions"
99+ echo "ci_passed=false" >> $GITHUB_OUTPUT
100+ echo "Skipping GCS upload and release creation."
101+ fi
102+
103+ - name : Setup Service Account
104+ if : github.ref_name == 'main' && steps.ci-check.outputs.ci_passed == 'true'
43105 uses : google-github-actions/auth@v2
44106 with :
45107 project_id : ${{ secrets.GCP_PROJECT_ID }}
46108 workload_identity_provider : ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
47109
48110 - name : Upload firecrackers to GCS
49- if : github.ref_name == 'main'
111+ if : github.ref_name == 'main' && steps.ci-check.outputs.ci_passed == 'true'
50112 uses : " google-github-actions/upload-cloud-storage@v1"
51113 with :
52114 path : " ./builds"
55117 parent : false
56118
57119 - name : Create releases for each Firecracker version
58- if : github.ref_name == 'main'
120+ if : github.ref_name == 'main' && steps.ci-check.outputs.ci_passed == 'true'
59121 env :
60122 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61123 run : |
0 commit comments