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.
This commit is contained in:
@@ -425,7 +425,17 @@ jobs:
|
||||
# KiBot names outputs <name>_<rev>_<id>.<ext>. The <rev> 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 <name>_<rev>_<id> 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
|
||||
|
||||
Reference in New Issue
Block a user