From 58293d12fe138b779050e24e04326a117eba344c Mon Sep 17 00:00:00 2001 From: timmyhadwen Date: Sun, 23 Aug 2026 18:51:11 +1000 Subject: [PATCH] ci: only pass readable files to the Astable upload A glob that matched a directory or a zero-byte file still reached curl, which failed the whole job with exit 26 and lost the upload even though every fab artifact had been produced. add() now requires a non-empty regular file and logs what it skipped. --- .gitea/workflows/kibot.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/kibot.yml b/.gitea/workflows/kibot.yml index bd799fa..ed86990 100644 --- a/.gitea/workflows/kibot.yml +++ b/.gitea/workflows/kibot.yml @@ -425,7 +425,17 @@ jobs: # KiBot names outputs __.. The segment is # empty when the schematic has no ${rev} revision field, so match it # with a glob (`_*_`) rather than hard-coding the pipeline version. - add() { local flag="$1"; shift; local m=( "$@" ); if [ ${#m[@]} -gt 0 ]; then ARGS+=("$flag" "${m[0]}"); fi; } + # Only pass a file curl can actually read: must exist, be a + # regular file, and be non-empty. A glob that matched a + # directory or a zero-byte stub previously reached curl and + # killed the whole upload with exit 26. + add() { + local flag="$1"; shift; local m=( "$@" ) + [ ${#m[@]} -eq 0 ] && return 0 + local f="${m[0]}" + if [ -f "$f" ] && [ -s "$f" ]; then ARGS+=("$flag" "$f") + else echo "[bom-upload] skipping $flag — no readable file for ${f##*/}"; fi + } ARGS=( --part-ipn "$PROJECT_NAME" --branch dev --commit-sha "${{ github.sha }}" --commit-message "$COMMIT_MESSAGE" ) add --file "$FAB"/${PROJECT_NAME}_*_bom.csv add --schematic-pdf "$FAB"/${PROJECT_NAME}_*_schematic.pdf @@ -473,7 +483,17 @@ jobs: VAL="$PWD/Validation" shopt -s nullglob # See astable_dev: match KiBot's __ outputs by glob. - add() { local flag="$1"; shift; local m=( "$@" ); if [ ${#m[@]} -gt 0 ]; then ARGS+=("$flag" "${m[0]}"); fi; } + # Only pass a file curl can actually read: must exist, be a + # regular file, and be non-empty. A glob that matched a + # directory or a zero-byte stub previously reached curl and + # killed the whole upload with exit 26. + add() { + local flag="$1"; shift; local m=( "$@" ) + [ ${#m[@]} -eq 0 ] && return 0 + local f="${m[0]}" + if [ -f "$f" ] && [ -s "$f" ]; then ARGS+=("$flag" "$f") + else echo "[bom-upload] skipping $flag — no readable file for ${f##*/}"; fi + } ARGS=( --part-ipn "$PROJECT_NAME" --branch main --commit-sha "${{ github.sha }}" --commit-message "$COMMIT_MESSAGE" ) add --file "$FAB"/${PROJECT_NAME}_*_bom.csv add --cpl "$FAB"/${PROJECT_NAME}_*_cpl.csv