From a320c09fbd66a7e35d855918bf55019aaf734398 Mon Sep 17 00:00:00 2001 From: "betsy.mcphail" Date: Fri, 27 Sep 2024 12:22:27 -0400 Subject: [PATCH] Use the source version of drake's install_prereqs for external examples Previously, the binary version of the script was called in addition to replicating much of the source version. With this change, the copy-and-paste is removed. --- Jenkinsfile | 12 +- drake_bazel_external/.github/ci_build_test | 4 - drake_bazel_external/.github/setup | 20 +-- drake_bazel_external/.github/ubuntu_setup | 19 ++- drake_bazel_external/README.md | 12 +- drake_bazel_external/setup/install_prereqs | 149 --------------------- drake_cmake_external/.github/ci_build_test | 5 +- drake_cmake_external/.github/setup | 20 +-- drake_cmake_external/.github/ubuntu_setup | 19 ++- drake_cmake_external/README.md | 29 +++- drake_cmake_external/setup/install_prereqs | 149 --------------------- private/test/file_sync_test.py | 10 +- 12 files changed, 104 insertions(+), 344 deletions(-) delete mode 100755 drake_bazel_external/setup/install_prereqs delete mode 100755 drake_cmake_external/setup/install_prereqs diff --git a/Jenkinsfile b/Jenkinsfile index 34ffcd9c..79f923c9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,11 +17,13 @@ node('linux-jammy-unprovisioned') { stage('checkout') { checkout scm } + } + dir('src/drake_bazel_external'){ stage('bazel_external setup') { - sh './drake_bazel_external/.github/setup' + sh './.github/setup' } stage('bazel_external build and test') { - sh './drake_bazel_external/.github/ci_build_test' + sh './.github/ci_build_test' } } } catch (e) { @@ -58,11 +60,13 @@ node('linux-jammy-unprovisioned') { stage('checkout') { checkout scm } + } + dir('src/drake_cmake_external'){ stage('cmake_external setup') { - sh './drake_cmake_external/.github/setup' + sh './.github/setup' } stage('cmake_external build and test') { - sh './drake_cmake_external/.github/ci_build_test' + sh './.github/ci_build_test' } } } catch (e) { diff --git a/drake_bazel_external/.github/ci_build_test b/drake_bazel_external/.github/ci_build_test index 9efbfe5c..672ca65e 100755 --- a/drake_bazel_external/.github/ci_build_test +++ b/drake_bazel_external/.github/ci_build_test @@ -3,9 +3,5 @@ set -euxo pipefail -pushd drake_bazel_external - bazel version bazel test //... - -popd diff --git a/drake_bazel_external/.github/setup b/drake_bazel_external/.github/setup index 99031d69..7972343b 100755 --- a/drake_bazel_external/.github/setup +++ b/drake_bazel_external/.github/setup @@ -3,11 +3,15 @@ set -euxo pipefail -cd $(dirname "${BASH_SOURCE}") -sudo ./ubuntu_setup - -cat > "${HOME}/.bazelrc" << EOF -startup --output_user_root=${WORKSPACE}/_bazel_${USER} -test --color=yes -test --keep_going -EOF +# CI setup +sudo ./.github/ubuntu_setup + +# Download the drake source +mkdir ~/drake_install +wget -O drake.tar.gz \ + https://github.com/RobotLocomotion/drake/archive/master.tar.gz +trap 'rm -f drake.tar.gz' EXIT +tar -xf drake.tar.gz -C ~/drake_install + +# Install the source prereqs +sudo ~/drake_install/drake-master/setup/ubuntu/install_prereqs.sh diff --git a/drake_bazel_external/.github/ubuntu_setup b/drake_bazel_external/.github/ubuntu_setup index 0a1ac2ad..0ce8b3d0 100755 --- a/drake_bazel_external/.github/ubuntu_setup +++ b/drake_bazel_external/.github/ubuntu_setup @@ -3,10 +3,25 @@ set -euxo pipefail +if [[ "${EUID:-}" -ne 0 ]]; then + echo 'This script must be run as root' >&2 + exit 2 +fi + echo 'APT::Acquire::Retries "4";' > /etc/apt/apt.conf.d/80-acquire-retries echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90-get-assume-yes export DEBIAN_FRONTEND='noninteractive' -cd $(dirname "${BASH_SOURCE}")/.. -setup/install_prereqs +apt-get update +apt-get install --no-install-recommends lsb-release + +if [[ "$(lsb_release -sc)" != 'jammy' ]]; then + echo 'This script requires Ubuntu 22.04 (Jammy)' >&2 + exit 3 +fi + +apt-get install --no-install-recommends $(cat <&2 - exit 1 - esac - shift -done - -if [[ "${EUID:-}" -ne 0 ]]; then - echo 'This script must be run as root' >&2 - exit 2 -fi - -apt-get update -apt-get install --no-install-recommends lsb-release - -if [[ "$(lsb_release -sc)" != 'jammy' ]]; then - echo 'This script requires Ubuntu 22.04 (Jammy)' >&2 - exit 3 -fi - -apt-get install --no-install-recommends $(cat < /etc/apt/sources.list.d/bazel.list - -apt-get update -apt-get install --no-install-recommends $(cat < /etc/apt/sources.list.d/ros2-latest.list - - apt-get update - apt-get install --no-install-recommends $(cat < "${HOME}/.bazelrc" << EOF -startup --output_user_root=${WORKSPACE}/_bazel_${USER} -test --color=yes -test --keep_going -EOF +# CI setup +sudo ./.github/ubuntu_setup + +# Download the drake source +mkdir ~/drake_install +wget -O drake.tar.gz \ + https://github.com/RobotLocomotion/drake/archive/master.tar.gz +trap 'rm -f drake.tar.gz' EXIT +tar -xf drake.tar.gz -C ~/drake_install + +# Install the source prereqs +sudo ~/drake_install/drake-master/setup/ubuntu/install_prereqs.sh diff --git a/drake_cmake_external/.github/ubuntu_setup b/drake_cmake_external/.github/ubuntu_setup index 0a1ac2ad..0ce8b3d0 100755 --- a/drake_cmake_external/.github/ubuntu_setup +++ b/drake_cmake_external/.github/ubuntu_setup @@ -3,10 +3,25 @@ set -euxo pipefail +if [[ "${EUID:-}" -ne 0 ]]; then + echo 'This script must be run as root' >&2 + exit 2 +fi + echo 'APT::Acquire::Retries "4";' > /etc/apt/apt.conf.d/80-acquire-retries echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90-get-assume-yes export DEBIAN_FRONTEND='noninteractive' -cd $(dirname "${BASH_SOURCE}")/.. -setup/install_prereqs +apt-get update +apt-get install --no-install-recommends lsb-release + +if [[ "$(lsb_release -sc)" != 'jammy' ]]; then + echo 'This script requires Ubuntu 22.04 (Jammy)' >&2 + exit 3 +fi + +apt-get install --no-install-recommends $(cat <&2 - exit 1 - esac - shift -done - -if [[ "${EUID:-}" -ne 0 ]]; then - echo 'This script must be run as root' >&2 - exit 2 -fi - -apt-get update -apt-get install --no-install-recommends lsb-release - -if [[ "$(lsb_release -sc)" != 'jammy' ]]; then - echo 'This script requires Ubuntu 22.04 (Jammy)' >&2 - exit 3 -fi - -apt-get install --no-install-recommends $(cat < /etc/apt/sources.list.d/bazel.list - -apt-get update -apt-get install --no-install-recommends $(cat < /etc/apt/sources.list.d/ros2-latest.list - - apt-get update - apt-get install --no-install-recommends $(cat <