11# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0
33
4- name : SDK Proto Sync
4+ name : SDK Sync Dashboard
55
66on :
77 schedule :
@@ -30,14 +30,33 @@ jobs:
3030 steps :
3131 - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3232 - id : config
33- run : echo "matrix=$(jq -c '.include' tasks/sdk-sync-config.json)" >> "$GITHUB_OUTPUT"
33+ run : |
34+ MATRIX=$(jq -e -c '
35+ if (.include | type == "array" and length > 0 and all(.[];
36+ type == "object" and
37+ (.name | type == "string") and
38+ (.display_name | type == "string") and
39+ (.bindings_committed | type == "boolean") and
40+ (.no_file_tracking_hint == null or (.no_file_tracking_hint | type == "string")) and
41+ (.generated_bindings_status | type == "string") and
42+ (.label | type == "string") and
43+ (.drift_task | type == "string") and
44+ (.build_check_task | type == "string") and
45+ (.proto_task | type == "string") and
46+ (.build_task | type == "string") and
47+ (.test_task | type == "string") and
48+ (.source_dirs | type == "array" and all(.[]; type == "string"))
49+ )) then .include else error("invalid SDK sync configuration") end
50+ ' tasks/sdk-sync-config.json)
51+ echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
3452
3553 sdk_sync_check :
3654 name : Sync Check (${{ matrix.sdk.name }})
3755 needs : load_config
3856 runs-on : linux-amd64-cpu8
3957 timeout-minutes : 30
4058 container :
59+ # Keep this workflow reproducible; update the digest deliberately when the CI image changes.
4160 image : ghcr.io/nvidia/openshell/ci:5b9daab9351b1e053f9a5e0ce4c899f5d3f674b0
4261 credentials :
4362 username : ${{ github.actor }}
@@ -57,12 +76,20 @@ jobs:
5776 BUILD_CHECK_TASK : ${{ matrix.sdk.build_check_task }}
5877 run : |
5978 mkdir -p report
60- mise run "$DRIFT_TASK" > report/drift.json 2> report/drift.stderr || true
79+ DRIFT_STATUS=0
80+ mise run "$DRIFT_TASK" > report/drift.json 2> report/drift.stderr || DRIFT_STATUS=$?
6181 if ! jq -e 'type == "object" and has("synced") and (.synced | type == "boolean") and (has("error") | not)' report/drift.json >/dev/null 2>&1; then
6282 jq -n --arg sdk "$SDK_NAME" '{sdk:$sdk, has_drift:"error", build_failed:"false"}' > report/status.json
6383 exit 0
6484 fi
6585 SYNCED=$(jq -r '.synced' report/drift.json)
86+ if { [ "$DRIFT_STATUS" -eq 0 ] && [ "$SYNCED" = "true" ]; } || \
87+ { [ "$DRIFT_STATUS" -eq 1 ] && [ "$SYNCED" = "false" ]; }; then
88+ :
89+ else
90+ jq -n --arg sdk "$SDK_NAME" '{sdk:$sdk, has_drift:"error", build_failed:"false"}' > report/status.json
91+ exit 0
92+ fi
6693 if [ "$SYNCED" = "true" ]; then
6794 jq -n --arg sdk "$SDK_NAME" '{sdk:$sdk, has_drift:"false", build_failed:"false"}' > report/status.json
6895 exit 0
@@ -86,14 +113,15 @@ jobs:
86113 issue_management :
87114 name : Manage Drift Issue (${{ matrix.sdk.name }})
88115 needs : [load_config, sdk_sync_check]
89- if : always() && needs.load_config.result == 'success' && needs.sdk_sync_check.result == 'success'
116+ if : always() && needs.load_config.result == 'success'
90117 runs-on : linux-amd64-cpu8
91118 timeout-minutes : 5
92119 permissions :
93120 contents : read
94121 issues : write
95122 packages : read
96123 container :
124+ # Keep this workflow reproducible; update the digest deliberately when the CI image changes.
97125 image : ghcr.io/nvidia/openshell/ci:5b9daab9351b1e053f9a5e0ce4c899f5d3f674b0
98126 credentials :
99127 username : ${{ github.actor }}
@@ -115,8 +143,10 @@ jobs:
115143 echo "build_failed=$(jq -r '.build_failed' report/status.json)" >> "$GITHUB_OUTPUT"
116144 - name : Warn on drift detection error
117145 if : steps.status.outputs.has_drift == 'error'
146+ env :
147+ SDK_NAME : ${{ matrix.sdk.name }}
118148 run : |
119- echo "::error::Drift detection failed for ${{ matrix.sdk.name }} SDK"
149+ echo "::error::Drift detection failed for $SDK_NAME SDK"
120150 cat report/drift.stderr
121151 exit 1
122152 - name : Install tools
@@ -126,14 +156,16 @@ jobs:
126156 if : steps.status.outputs.has_drift == 'true'
127157 env :
128158 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
159+ SDK_NAME : ${{ matrix.sdk.name }}
160+ SDK_LABEL : ${{ matrix.sdk.label }}
129161 run : |
130162 set +e
131163 RESULT=$(uv run python tasks/scripts/sdk_sync.py manage-issue \
132164 --drift-report "$(cat report/drift.json)" \
133165 --build-report "$(cat report/build.json)" \
134- --sdk "${{ matrix.sdk.name }} " \
166+ --sdk "$SDK_NAME " \
135167 --repo "$GITHUB_REPOSITORY" \
136- --label "${{ matrix.sdk.label }} ")
168+ --label "$SDK_LABEL ")
137169 STATUS=$?
138170 set -e
139171 if ! printf '%s\n' "$RESULT" | jq .; then
@@ -147,16 +179,23 @@ jobs:
147179 ACTION=unknown
148180 fi
149181 if [ "$ACTION" != "created" ] && [ "$ACTION" != "updated" ]; then
150- echo "::error::Issue management for ${{ matrix.sdk.name }} failed: $ACTION"
182+ echo "::error::Issue management for $SDK_NAME failed: $ACTION"
151183 exit 1
152184 fi
153185 - name : Close resolved drift issue
154186 if : steps.status.outputs.has_drift == 'false'
155187 env :
156188 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
189+ SDK_LABEL : ${{ matrix.sdk.label }}
157190 run : |
158- ISSUE=$(gh issue list --repo "$GITHUB_REPOSITORY" --label "${{ matrix.sdk.label }}" --state open --json number --jq '.[0].number')
159- if [ -n "$ISSUE" ]; then
191+ ISSUES=$(gh issue list --repo "$GITHUB_REPOSITORY" --label "$SDK_LABEL" --state open --limit 101 --json number --jq '.[].number')
192+ ISSUE_COUNT=$(printf '%s\n' "$ISSUES" | sed '/^$/d' | wc -l | tr -d ' ')
193+ if [ "$ISSUE_COUNT" -ge 101 ]; then
194+ echo "::error::Issue list for $SDK_LABEL reached the 101-result limit; refusing to close issues"
195+ exit 1
196+ fi
197+ while IFS= read -r ISSUE; do
198+ [ -z "$ISSUE" ] && continue
160199 gh issue close "$ISSUE" --repo "$GITHUB_REPOSITORY" --comment "The SDK proto drift check passed. Closing automatically."
161200 echo "Closed issue #$ISSUE"
162- fi
201+ done <<< "$ISSUES"
0 commit comments