2017-01-08 14:45:28 -04:00
|
|
|
#! /bin/bash
|
|
|
|
|
2017-07-18 22:51:10 -03:00
|
|
|
if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
|
|
|
echo "guessing PX4_DOCKER_REPO based on input";
|
2018-11-22 00:27:21 -04:00
|
|
|
if [[ $@ =~ .*px4_fmu.* ]]; then
|
2017-07-18 22:51:10 -03:00
|
|
|
# nuttx-px4fmu-v{1,2,3,4,5}
|
2020-12-22 05:21:22 -04:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-02-04"
|
2020-11-10 12:04:47 -04:00
|
|
|
elif [[ $@ =~ .*ocpoc.* ]] || [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*beaglebone.* ]] || [[ $@ =~ .*pilotpi.default ]]; then
|
|
|
|
# aerotenna_ocpoc_default, beaglebone_blue_default, emlid_navio2_default, px4_raspberrypi_default, scumaker_pilotpi_default
|
2020-12-22 05:21:22 -04:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-02-04"
|
2020-11-10 12:04:47 -04:00
|
|
|
elif [[ $@ =~ .*pilotpi.arm64 ]]; then
|
|
|
|
# scumaker_pilotpi_arm64
|
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-aarch64:latest"
|
2017-07-18 22:51:10 -03:00
|
|
|
elif [[ $@ =~ .*eagle.* ]] || [[ $@ =~ .*excelsior.* ]]; then
|
|
|
|
# eagle, excelsior
|
2020-04-02 07:23:40 -03:00
|
|
|
PX4_DOCKER_REPO="lorenzmeier/px4-dev-snapdragon:2020-04-01"
|
2019-11-29 05:58:52 -04:00
|
|
|
elif [[ $@ =~ .*ocpoc.* ]] || [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*bebop.* ]]; then
|
|
|
|
# aerotenna_ocpoc_default, posix_rpi_cross, posix_bebop_default
|
2020-12-22 05:21:22 -04:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-02-04"
|
2019-08-04 23:50:28 -03:00
|
|
|
elif [[ $@ =~ .*clang.* ]] || [[ $@ =~ .*scan-build.* ]]; then
|
2017-07-18 22:51:10 -03:00
|
|
|
# clang tools
|
2020-12-22 05:21:22 -04:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-clang:2021-02-04"
|
2017-07-18 22:51:10 -03:00
|
|
|
elif [[ $@ =~ .*tests* ]]; then
|
|
|
|
# run all tests with simulation
|
2020-12-22 05:21:22 -04:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-simulation-bionic:2021-02-04"
|
2017-07-18 22:51:10 -03:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "PX4_DOCKER_REPO is set to '$PX4_DOCKER_REPO'";
|
2017-05-26 10:28:37 -03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# otherwise default to nuttx
|
2017-07-18 22:51:10 -03:00
|
|
|
if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
2020-09-18 13:17:51 -03:00
|
|
|
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2020-09-14"
|
2017-01-14 10:38:28 -04:00
|
|
|
fi
|
|
|
|
|
2017-05-26 10:28:37 -03:00
|
|
|
# docker hygiene
|
|
|
|
|
|
|
|
#Delete all stopped containers (including data-only containers)
|
|
|
|
#docker rm $(docker ps -a -q)
|
|
|
|
|
|
|
|
#Delete all 'untagged/dangling' (<none>) images
|
|
|
|
#docker rmi $(docker images -q -f dangling=true)
|
|
|
|
|
|
|
|
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
|
|
|
|
2017-01-08 14:45:28 -04:00
|
|
|
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
SRC_DIR=$PWD/../
|
|
|
|
|
|
|
|
CCACHE_DIR=${HOME}/.ccache
|
2017-05-26 10:28:37 -03:00
|
|
|
mkdir -p "${CCACHE_DIR}"
|
2017-01-08 14:45:28 -04:00
|
|
|
|
2017-05-26 10:28:37 -03:00
|
|
|
docker run -it --rm -w "${SRC_DIR}" \
|
2017-09-07 23:21:18 -03:00
|
|
|
--env=AWS_ACCESS_KEY_ID \
|
|
|
|
--env=AWS_SECRET_ACCESS_KEY \
|
|
|
|
--env=BRANCH_NAME \
|
|
|
|
--env=CCACHE_DIR="${CCACHE_DIR}" \
|
|
|
|
--env=CI \
|
|
|
|
--env=CODECOV_TOKEN \
|
|
|
|
--env=COVERALLS_REPO_TOKEN \
|
|
|
|
--env=LOCAL_USER_ID="$(id -u)" \
|
2017-10-20 10:20:30 -03:00
|
|
|
--env=PX4_ASAN \
|
|
|
|
--env=PX4_MSAN \
|
|
|
|
--env=PX4_TSAN \
|
|
|
|
--env=PX4_UBSAN \
|
2017-09-07 23:21:18 -03:00
|
|
|
--env=TRAVIS_BRANCH \
|
|
|
|
--env=TRAVIS_BUILD_ID \
|
|
|
|
--publish 14556:14556/udp \
|
|
|
|
--volume=${CCACHE_DIR}:${CCACHE_DIR}:rw \
|
|
|
|
--volume=${SRC_DIR}:${SRC_DIR}:rw \
|
2017-10-20 10:20:30 -03:00
|
|
|
${PX4_DOCKER_REPO} /bin/bash -c "$1 $2 $3"
|