Skip to content

Commit 8d65635

Browse files
authored
Guard registry-build sync against partial extracts (#66137)
`aws s3 sync` exits 0 silently when its source directory is missing or empty, so a partial `breeze registry extract-data` failure (one provider errors mid-run, Eleventy still produces a tree, sync uploads stale or empty JSON) would currently report green while leaving the live registry in an inconsistent state. This adds the same pre-sync content guards `registry-backfill.yml` got in PR #66027: for incremental builds, assert each target provider's HTML directory + API directory + `versions.json` exist and are non-empty; for full builds, assert the top-level `index.html`, `api/providers.json` listing, and at least one provider subtree under `api/providers/` are present. Any missing artifact aborts the sync with `::error::` before S3 is touched.
1 parent 046b490 commit 8d65635

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/registry-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,52 @@ jobs:
260260
retention-days: 7
261261
if-no-files-found: error
262262

263+
- name: "Verify build emitted expected content"
264+
env:
265+
PROVIDER: ${{ inputs.provider }}
266+
run: |
267+
# Guard against silent no-op syncs. `aws s3 sync` exits 0 when the
268+
# source dir is missing or empty, so without this a partial build
269+
# (e.g. extract_metadata.py errored mid-run) would report green
270+
# while uploading nothing or stale state. Mirrors the per-provider
271+
# guard in the "Sync backfilled version pages to S3" step in
272+
# registry-backfill.yml.
273+
if [[ -n "${PROVIDER}" ]]; then
274+
# Incremental: verify each target provider's pages and versions JSON exist.
275+
for pid in ${PROVIDER}; do
276+
LOCAL_PROV_DIR="registry/_site/providers/${pid}/"
277+
LOCAL_API_DIR="registry/_site/api/providers/${pid}/"
278+
LOCAL_VERSIONS_JSON="${LOCAL_API_DIR}versions.json"
279+
if [ ! -d "${LOCAL_PROV_DIR}" ] || [ -z "$(ls -A "${LOCAL_PROV_DIR}" 2>/dev/null)" ]; then
280+
echo "::error::Build did not emit ${LOCAL_PROV_DIR} -- aborting sync."
281+
exit 1
282+
fi
283+
if [ ! -d "${LOCAL_API_DIR}" ] || [ -z "$(ls -A "${LOCAL_API_DIR}" 2>/dev/null)" ]; then
284+
echo "::error::Build did not emit ${LOCAL_API_DIR} -- aborting sync."
285+
exit 1
286+
fi
287+
if [ ! -s "${LOCAL_VERSIONS_JSON}" ]; then
288+
echo "::error::${LOCAL_VERSIONS_JSON} missing or empty -- aborting sync."
289+
exit 1
290+
fi
291+
done
292+
else
293+
# Full build: verify the top-level homepage and provider listing.
294+
if [ ! -s "registry/_site/index.html" ]; then
295+
echo "::error::Full build did not emit registry/_site/index.html -- aborting sync."
296+
exit 1
297+
fi
298+
if [ ! -s "registry/_site/api/providers.json" ]; then
299+
echo "::error::registry/_site/api/providers.json missing or empty -- aborting sync."
300+
exit 1
301+
fi
302+
API_PROVIDERS_DIR="registry/_site/api/providers/"
303+
if [ ! -d "${API_PROVIDERS_DIR}" ] || [ -z "$(ls -A "${API_PROVIDERS_DIR}" 2>/dev/null)" ]; then
304+
echo "::error::${API_PROVIDERS_DIR} is missing or empty -- aborting sync."
305+
exit 1
306+
fi
307+
fi
308+
263309
- name: "Sync registry to S3"
264310
env:
265311
S3_BUCKET: ${{ steps.destination.outputs.bucket }}

0 commit comments

Comments
 (0)