ci: allow ci_flash to run on local development envs
What changed, and why it matters
This change is a developer tooling update. It makes the project's continuous-integration flash script work on local developer machines, not just the CI server. It adds fallback serial ports, creates a local Python virtual environment if one isn't present, skips Bluetooth testing if a Bluetooth tool is missing, and deactivates the virtual environment at the end. There is no indication this affects end-user security or the firmware itself.
No security action required. Treat as normal CI/developer-experience maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies ci_flash.sh to be environment-agnostic. It changes serial-port default selection to prefer /dev/ttyUSB0 when present, otherwise /dev/ttyACM0. It conditionally sources a CI-specific Python virtualenv (~/venv3) or creates and uses a local ./venv3, installing pinserver requirements. It adds a runtime check for /usr/bin/bt-agent and passes –skipble when absent. Finally it appends deactivate. These are build/test script ergonomics; no firmware, cryptography, or protocol logic is changed.
Changed components
ci_flash.shInspect captured patch +23 / −5
diff --git a/ci_flash.sh b/ci_flash.sh
index ff53f3f..2950944 100755
--- a/ci_flash.sh
+++ b/ci_flash.sh
@@ -5,8 +5,10 @@ if [[ -z ${JADESERIALPORT} ]]; then
echo "Serial port \"${JADESERIALPORT}\" isn't valid, using defaults"
if [ "$(uname)" == "Darwin" ]; then
JADESERIALPORT=/dev/cu.SLAB_USBtoUART
- else
+ elif [ -c /dev/ttyUSB0 ]; then
JADESERIALPORT=/dev/ttyUSB0
+ else
+ JADESERIALPORT=/dev/ttyACM0
fi
echo "Serial port set to default \"${JADESERIALPORT}\""
fi
@@ -56,21 +58,37 @@ if fgrep -qs "CONFIG_APPTRACE_GCOV_ENABLE=y" ${BUILD_DIR}/sdkconfig sdkconfig; t
fi
fi
-source ~/venv3/bin/activate
-
+if [ -r ~/venv3/bin/activate ]; then
+ # Assume we are running under the CI: pinserver requirements are already installed
+ source ~/venv3/bin/activate
+else
+ # Install and activate a local venv
+ if [ ! -r ./venv3/bin/activate ]; then
+ virtualenv -p python3 venv3
+ fi
+ source ./venv3/bin/activate
+ pip install -r pinserver/requirements.txt
+fi
pip install --require-hashes -r requirements.txt
# NOTE: tools/fwprep.py should have run in the build step and produced the compressed firmware file
+SKIP_ARGS=""
+if [ ! -x /usr/bin/bt-agent ]; then
+ echo "bt-agent not available, skipping bluetooth OTA"
+ SKIP_ARGS=" --skipble"
+fi
FW_FULL=$(ls ${BUILD_DIR}/*_fw.bin)
-python jade_ota.py --push-mnemonic --log=INFO --serialport=${JADESERIALPORT} --fwfile=${FW_FULL}
+python jade_ota.py --push-mnemonic --log=INFO --serialport=${JADESERIALPORT} --fwfile=${FW_FULL}${SKIP_ARGS}
sleep 5
python -c "from jadepy import JadeAPI; jade = JadeAPI.create_serial(device=\"${JADESERIALPORT}\", timeout=5) ; jade.connect(); jade.drain(); jade.disconnect()"
-python test_jade.py --log=INFO --serialport=${JADESERIALPORT}
+python test_jade.py --log=INFO --serialport=${JADESERIALPORT}${SKIP_ARGS}
# check if gcov is enabled and run collection tool
if fgrep -qs "CONFIG_APPTRACE_GCOV_ENABLE=y" ${BUILD_DIR}/sdkconfig sdkconfig; then
./tools/gcov/generate_report.sh
killall -9 openocd || true
fi
+
+deactivate
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.