Jenkins CI (#496)

* jenkins: initial commit

* dockerfile: add git and libbtbb installations to prerequisites

* jenkins: add usbhub installation to docker, reset port before flashing ubertooth firmware

* jenkins: move builds/tests to scripts in ci-scripts

* jenkins: fix typo

* jenkins: fix another typo

* jenkins: specify usbhub id for dual hub setup

* jenkins: update cleanup, test host after testing firmware

* jenkins: turn unused usb hub ports off for testing

* jenkins: restructure test to better detect faulty firmware

* break firmware for ci

* jenkins: use relative path when specifying DFU_TOOL

* jenkins: remove intentional infinite loop to fix build

* jenkins: remove unneeded options and environment sections from build

* update usbhub driver and enable the --disable-i2c option

* ci: disable privileged mode and enable device cgroup rule for usb in docker

* ci: remove redundancies from Dockerfile

* ci: update comments in Dockerfile
This commit is contained in:
Jacob Graves
2022-06-08 13:20:49 -04:00
committed by GitHub
parent 2617e8ef11
commit 86734a4827
6 changed files with 121 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
# Sandbox test environment for Ubertooth
FROM ubuntu:20.04
# Override interactive installations and install prerequisite programs
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
cmake \
gcc \
gcc-arm-none-eabi \
git \
g++ \
libbluetooth-dev \
libnewlib-arm-none-eabi \
libusb-1.0-0-dev \
make \
pkg-config \
python3-distutils \
python3-numpy \
python3-pip \
python3-qtpy \
python3-setuptools \
python-is-python3 \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install git+https://github.com/CapableRobot/CapableRobot_USBHub_Driver --upgrade
RUN wget https://github.com/greatscottgadgets/libbtbb/archive/2020-12-R1.tar.gz -O libbtbb-2020-12-R1.tar.gz &&\
tar -xf libbtbb-2020-12-R1.tar.gz &&\
cd libbtbb-2020-12-R1 &&\
mkdir build &&\
cd build &&\
cmake .. &&\
make &&\
make install &&\
ldconfig
# Inform Docker that the container is listening on port 8080 at runtime.
EXPOSE 8080
Vendored
+36
View File
@@ -0,0 +1,36 @@
pipeline {
agent {
dockerfile {
args '--group-add=46 --device-cgroup-rule="c 189:* rmw" -v /dev/bus/usb:/dev/bus/usb'
}
}
stages {
stage('Build (Host)') {
steps {
sh './ci-scripts/build-host.sh'
}
}
stage('Build (Firmware)') {
steps {
sh './ci-scripts/build-firmware.sh'
}
}
stage('Test') {
steps {
sh './ci-scripts/configure-hubs.sh --off'
retry(3) {
sh './ci-scripts/test.sh'
}
}
}
}
post {
always {
sh './ci-scripts/configure-hubs.sh --reset'
cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true,
disableDeferredWipeout: true,
notFailBuild: true)
}
}
}
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
cd firmware/bluetooth_rxtx
DFU_TOOL=../../host/build/ubertooth-tools/src/ubertooth-dfu make
cd ../..
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
mkdir host/build
cd host/build
cmake ..
make
cd ../..
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash -x
usbhub --disable-i2c --hub D9D1 power state --port 1,2,3,4 $1
usbhub --disable-i2c --hub 624C power state --port 1,2,3,4 $1
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
usbhub --disable-i2c --hub D9D1 power state --port 4 --reset
sleep 1s
host/build/ubertooth-tools/src/ubertooth-dfu -d firmware/bluetooth_rxtx/bluetooth_rxtx.dfu -r
DFU_STATUS="$?"
if [ "$DFU_STATUS" == "0" ]
then
echo "DFU installation success! Checking device..."
sleep 1s
host/build/ubertooth-tools/src/ubertooth-util -b -p -s
DEVICE_STATUS="$?"
if [ "$DEVICE_STATUS" == "0" ]
then
echo "Device found! Exiting."
exit $DEVICE_STATUS
elif [ "$DEVICE_STATUS" == "1" ]
then
echo "Could not find device! Broken firmware? Exiting."
exit 99
else
echo "Unhandled device error!"
exit $DEVICE_STATUS
fi
elif [ "$DFU_STATUS" == "1" ]
then
echo "No Ubertooth found! Disconnected? Exiting."
exit $DFU_STATUS
elif [ "$DFU_STATUS" == "127" ]
then
echo "Host tool installation failed! Exiting."
exit $DFU_STATUS
else
echo "Unhandled DFU error!"
exit $DFU_STATUS
fi