fix(ci): correct metadata artifact paths in package_build_artifacts.sh

airframes.xml and all_events.json.xz on the px4-travis S3 bucket have
been stale since October 2025 because package_build_artifacts.sh had
wrong paths for both files after the migration from metadata.yml to
build_all_targets.yml.

- airframes.xml: SITL builds produce it under docs/, not at the build
  root (only NuttX does that). Use explicit file checks to try both.
- all_events.json.xz: was copied flat into artifacts/$build_dir/ but
  the _general section expected it under events/. Preserve the
  subdirectory so the copy to _general/ actually finds the file.
- Remove duplicate cp lines that were misleadingly commented as
  "ROS 2 msgs".
- Fail with an error when critical _general metadata files are missing
  rather than silently producing incomplete artifacts.

Also uploaded fresh metadata to S3 manually to unblock Flight Review.

Fixes #26713

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche 2026-03-11 14:37:58 -07:00
parent 59ded6affd
commit a9f2e0e44e

View File

@ -6,32 +6,42 @@ cp **/**/*.elf artifacts/ 2>/dev/null || true
for build_dir_path in build/*/ ; do
build_dir_path=${build_dir_path::${#build_dir_path}-1}
build_dir=${build_dir_path#*/}
mkdir artifacts/$build_dir
mkdir -p artifacts/$build_dir
find artifacts/ -maxdepth 1 -type f -name "*$build_dir*"
# Airframe
cp $build_dir_path/airframes.xml artifacts/$build_dir/
# Airframe (NuttX: build root, SITL: docs/ subdirectory)
airframes_src=""
if [ -f "$build_dir_path/airframes.xml" ]; then
airframes_src="$build_dir_path/airframes.xml"
elif [ -f "$build_dir_path/docs/airframes.xml" ]; then
airframes_src="$build_dir_path/docs/airframes.xml"
fi
if [ -n "$airframes_src" ]; then
cp "$airframes_src" "artifacts/$build_dir/"
fi
# Parameters
cp $build_dir_path/parameters.xml artifacts/$build_dir/
cp $build_dir_path/parameters.json artifacts/$build_dir/
cp $build_dir_path/parameters.json.xz artifacts/$build_dir/
cp $build_dir_path/parameters.xml artifacts/$build_dir/ 2>/dev/null || true
cp $build_dir_path/parameters.json artifacts/$build_dir/ 2>/dev/null || true
cp $build_dir_path/parameters.json.xz artifacts/$build_dir/ 2>/dev/null || true
# Actuators
cp $build_dir_path/actuators.json artifacts/$build_dir/
cp $build_dir_path/actuators.json.xz artifacts/$build_dir/
cp $build_dir_path/actuators.json artifacts/$build_dir/ 2>/dev/null || true
cp $build_dir_path/actuators.json.xz artifacts/$build_dir/ 2>/dev/null || true
# Events
cp $build_dir_path/events/all_events.json.xz artifacts/$build_dir/
# ROS 2 msgs
cp $build_dir_path/events/all_events.json.xz artifacts/$build_dir/
# Module Docs
mkdir -p artifacts/$build_dir/events/
cp $build_dir_path/events/all_events.json.xz artifacts/$build_dir/events/ 2>/dev/null || true
ls -la artifacts/$build_dir
echo "----------"
done
if [ -d artifacts/px4_sitl_default ]; then
# general metadata
mkdir artifacts/_general/
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
# general metadata (used by Flight Review and other downstream consumers)
mkdir -p artifacts/_general/
# Airframe
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
if [ -f artifacts/px4_sitl_default/airframes.xml ]; then
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
else
echo "Error: expected 'artifacts/px4_sitl_default/airframes.xml' not found." >&2
exit 1
fi
# Parameters
cp artifacts/px4_sitl_default/parameters.xml artifacts/_general/
cp artifacts/px4_sitl_default/parameters.json artifacts/_general/
@ -40,9 +50,11 @@ if [ -d artifacts/px4_sitl_default ]; then
cp artifacts/px4_sitl_default/actuators.json artifacts/_general/
cp artifacts/px4_sitl_default/actuators.json.xz artifacts/_general/
# Events
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
# ROS 2 msgs
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
# Module Docs
if [ -f artifacts/px4_sitl_default/events/all_events.json.xz ]; then
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
else
echo "Error: expected 'artifacts/px4_sitl_default/events/all_events.json.xz' not found." >&2
exit 1
fi
ls -la artifacts/_general/
fi