diff --git a/.travis.yml b/.travis.yml index 41286c6..f5072a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ cache: - /home/travis/docker/ env: - - ROS_RELEASE=kinetic DOCKER_CACHE_FILE=/home/travis/docker/kinetic-cache.tar.gz - ROS_RELEASE=melodic DOCKER_CACHE_FILE=/home/travis/docker/melodic-cache.tar.gz - ROS_RELEASE=noetic DOCKER_CACHE_FILE=/home/travis/docker/noetic-cache.tar.gz @@ -34,5 +33,5 @@ before_install: install: true script: - - docker build ${TRAVIS_BUILD_DIR} -t cartographer_ros:${ROS_RELEASE} -f Dockerfile.${ROS_RELEASE} --build-arg github_token=${GITHUB_TOKEN} + - scripts/build_docker.sh $GITHUB_TOKEN - scripts/save_docker_cache.sh diff --git a/Dockerfile.kinetic b/Dockerfile.kinetic deleted file mode 100644 index 7e2bb8d..0000000 --- a/Dockerfile.kinetic +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2016 The Cartographer Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM osrf/ros:kinetic-desktop - -ARG CARTOGRAPHER_VERSION=master - -# We require a GitHub access token to be passed. -ARG github_token - -# Xenial's base image doesn't ship with sudo. -RUN apt-get update && apt-get install -y sudo - -# First, we invalidate the entire cache if cartographer-project/cartographer has -# changed. This file's content changes whenever master changes. See: -# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone -ADD https://api.github.com/repos/cartographer-project/cartographer/git/refs/heads/master?access_token=$github_token \ - cartographer_ros/cartographer_version.json - -# wstool needs the updated rosinstall file to clone the correct repos. -COPY cartographer_ros.rosinstall cartographer_ros/ -COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ -RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ - cartographer_ros/scripts/prepare_catkin_workspace.sh - -# rosdep needs the updated package.xml files to install the correct debs. -COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/ -COPY cartographer_ros_msgs/package.xml catkin_ws/src/cartographer_ros/cartographer_ros_msgs/ -COPY cartographer_rviz/package.xml catkin_ws/src/cartographer_ros/cartographer_rviz/ -COPY scripts/install_debs.sh cartographer_ros/scripts/ -RUN cartographer_ros/scripts/install_debs.sh - -# Install Abseil and proto3. -RUN /catkin_ws/src/cartographer/scripts/install_abseil.sh -RUN /catkin_ws/src/cartographer/scripts/install_proto3.sh - -# Build, install, and test all packages individually to allow caching. The -# ordering of these steps must match the topological package ordering as -# determined by Catkin. -COPY scripts/install.sh cartographer_ros/scripts/ -COPY scripts/catkin_test_results.sh cartographer_ros/scripts/ - -RUN cartographer_ros/scripts/install.sh --pkg cartographer && \ - cartographer_ros/scripts/install.sh --pkg cartographer --make-args test - -COPY cartographer_ros_msgs catkin_ws/src/cartographer_ros/cartographer_ros_msgs/ -RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs && \ - cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs \ - --catkin-make-args run_tests && \ - cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros_msgs - -COPY cartographer_ros catkin_ws/src/cartographer_ros/cartographer_ros/ -RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros && \ - cartographer_ros/scripts/install.sh --pkg cartographer_ros \ - --catkin-make-args run_tests && \ - cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros - -COPY cartographer_rviz catkin_ws/src/cartographer_ros/cartographer_rviz/ -RUN cartographer_ros/scripts/install.sh --pkg cartographer_rviz && \ - cartographer_ros/scripts/install.sh --pkg cartographer_rviz \ - --catkin-make-args run_tests && \ - cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_rviz - -COPY scripts/ros_entrypoint.sh / - -RUN rm -rf /var/lib/apt/lists/* -# A BTRFS bug may prevent us from cleaning up these directories. -# https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#I_cannot_delete_an_empty_directory -RUN rm -rf cartographer_ros catkin_ws || true diff --git a/Dockerfile.melodic b/Dockerfile.melodic index 90f6f69..782645a 100644 --- a/Dockerfile.melodic +++ b/Dockerfile.melodic @@ -15,23 +15,20 @@ FROM osrf/ros:melodic-desktop ARG CARTOGRAPHER_VERSION=master - -# We require a GitHub access token to be passed. -ARG github_token +ARG CARTOGRAPHER_SHA=LATEST # Bionic's base image doesn't ship with sudo. RUN apt-get update && apt-get install -y sudo -# First, we invalidate the entire cache if cartographer-project/cartographer has -# changed. This file's content changes whenever master changes. See: -# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone -ADD https://api.github.com/repos/cartographer-project/cartographer/git/refs/heads/master?access_token=$github_token \ - cartographer_ros/cartographer_version.json - # wstool needs the updated rosinstall file to clone the correct repos. COPY cartographer_ros.rosinstall cartographer_ros/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ -RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ + +# First, we invalidate the entire cache if cartographer-project/cartographer has +# changed. CARTOGRAPHER_SHA ARG content changes whenever master changes. See: +# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone +RUN CARTOGRAPHER_SHA=$CARTOGRAPHER_SHA \ + CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ cartographer_ros/scripts/prepare_catkin_workspace.sh && \ sed -i -e "s%libabsl-dev%<\!--libabsl-dev-->%g" catkin_ws/src/cartographer/package.xml diff --git a/Dockerfile.noetic b/Dockerfile.noetic index 18eded2..aaceb19 100644 --- a/Dockerfile.noetic +++ b/Dockerfile.noetic @@ -15,9 +15,7 @@ FROM osrf/ros:noetic-desktop ARG CARTOGRAPHER_VERSION=master - -# We require a GitHub access token to be passed. -ARG github_token +ARG CARTOGRAPHER_SHA=LATEST # Prevent any interaction required by apt-get. # https://stackoverflow.com/questions/22466255 @@ -26,16 +24,15 @@ ARG DEBIAN_FRONTEND=noninteractive # ROS Noetic's base image doesn't ship with sudo and git. RUN apt-get update && apt-get install -y sudo git -# First, we invalidate the entire cache if cartographer-project/cartographer has -# changed. This file's content changes whenever master changes. See: -# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone -ADD https://api.github.com/repos/cartographer-project/cartographer/git/refs/heads/master?access_token=$github_token \ - cartographer_ros/cartographer_version.json - # wstool needs the updated rosinstall file to clone the correct repos. COPY cartographer_ros.rosinstall cartographer_ros/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ -RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ + +# First, we invalidate the entire cache if cartographer-project/cartographer has +# changed. CARTOGRAPHER_SHA ARG content changes whenever master changes. See: +# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone +RUN CARTOGRAPHER_SHA=$CARTOGRAPHER_SHA \ + CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \ cartographer_ros/scripts/prepare_catkin_workspace.sh && \ sed -i -e "s%libabsl-dev%<\!--libabsl-dev-->%g" catkin_ws/src/cartographer/package.xml diff --git a/README.rst b/README.rst index fb72eb6..04e2d87 100644 --- a/README.rst +++ b/README.rst @@ -45,10 +45,10 @@ at `our Contribution page`_. .. _our Contribution page: https://github.com/cartographer-project/cartographer_ros/blob/master/CONTRIBUTING.md -.. |build| image:: https://travis-ci.org/cartographer-project/cartographer_ros.svg?branch=master +.. |build| image:: https://app.travis-ci.com/cartographer-project/cartographer_ros.svg?branch=master :alt: Build Status :scale: 100% - :target: https://travis-ci.org/cartographer-project/cartographer_ros + :target: https://app.travis-ci.com/cartographer-project/cartographer_ros .. |docs| image:: https://readthedocs.org/projects/google-cartographer-ros/badge/?version=latest :alt: Documentation Status :scale: 100% diff --git a/docs/source/compilation.rst b/docs/source/compilation.rst index ace433f..9addba5 100644 --- a/docs/source/compilation.rst +++ b/docs/source/compilation.rst @@ -23,7 +23,6 @@ The Cartographer ROS requirements are the same as `the ones from Cartographer`_. The following `ROS distributions`_ are currently supported: -* Kinetic * Melodic * Noetic @@ -71,8 +70,6 @@ The command 'sudo rosdep init' will print an error if you have already executed rosdep update rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y - # Only on Ubuntu 16 / ROS Kinetic: src/cartographer/scripts/install_proto3.sh - Cartographer uses the `abseil-cpp`_ library that needs to be manually installed using this script: .. code-block:: bash diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh new file mode 100755 index 0000000..6541583 --- /dev/null +++ b/scripts/build_docker.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright 2016 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Cache intermediate Docker layers. For a description of how this works, see: +# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html + +set -o errexit +set -o verbose +set -o pipefail + +if [ "$#" -ne 1 ]; then + echo "Please provide an access token to $0" 1>&2 + exit 1 +fi +token=$1 + +CARTOGRAPHER_SHA=$(curl -s -H 'Authorization: token ${token}' https://api.github.com/repos/cartographer-project/cartographer/git/refs/heads/master | jq -j '.object.sha') + +docker build ${TRAVIS_BUILD_DIR} -t cartographer_ros:${ROS_RELEASE} -f Dockerfile.${ROS_RELEASE} --build-arg CARTOGRAPHER_SHA=${CARTOGRAPHER_SHA} diff --git a/scripts/install_debs.sh b/scripts/install_debs.sh index 0af4648..33c3a8f 100755 --- a/scripts/install_debs.sh +++ b/scripts/install_debs.sh @@ -34,6 +34,3 @@ cd catkin_ws # Install rosdep dependencies. rosdep update rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y - -# Update rosconsole-bridge to fix build issue with Docker image for Kinetic -sudo apt-get install ros-${ROS_DISTRO}-rosconsole-bridge -y