Răsfoiți Sursa

Fixes CI, correctly uses base image. (#41)

Damon Kohler 8 ani în urmă
părinte
comite
417dafd20c

+ 1 - 0
.travis.yml

@@ -31,5 +31,6 @@ install: true
 script:
 script:
   - git clone https://github.com/googlecartographer/cartographer_ros.git
   - git clone https://github.com/googlecartographer/cartographer_ros.git
   - docker build cartographer_ros -t cartographer_ros:${ROS_RELEASE} -f cartographer_ros/Dockerfile.${ROS_RELEASE}
   - docker build cartographer_ros -t cartographer_ros:${ROS_RELEASE} -f cartographer_ros/Dockerfile.${ROS_RELEASE}
+  - rm -rf cartographer_ros
   - docker build ${TRAVIS_BUILD_DIR} -t cartographer_turtlebot:${ROS_RELEASE} -f Dockerfile.${ROS_RELEASE}
   - docker build ${TRAVIS_BUILD_DIR} -t cartographer_turtlebot:${ROS_RELEASE} -f Dockerfile.${ROS_RELEASE}
   - scripts/save_docker_cache.sh
   - scripts/save_docker_cache.sh

+ 18 - 1
Dockerfile.indigo

@@ -13,6 +13,23 @@
 # limitations under the License.
 # limitations under the License.
 
 
 FROM cartographer_ros:indigo
 FROM cartographer_ros:indigo
+
+# First, we invalidate the entire cache if googlecartographer/cartographer_ros 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/googlecartographer/cartographer_ros/git/refs/heads/master \
+    cartographer_turtlebot/cartographer_ros_version.json
+
 COPY . cartographer_turtlebot
 COPY . cartographer_turtlebot
-RUN cartographer_turtlebot/scripts/install.bash
+
+RUN cartographer_turtlebot/scripts/prepare_catkin_workspace.sh
+RUN cartographer_turtlebot/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/*
+RUN cartographer_turtlebot/scripts/install.sh --pkg cartographer_turtlebot && \
+    cartographer_turtlebot/scripts/install.sh --pkg cartographer_turtlebot \
+        --catkin-make-args run_tests && \
+    cartographer_turtlebot/scripts/catkin_test_results.sh build_isolated/cartographer_turtlebot
+
 COPY scripts/ros_entrypoint.sh /
 COPY scripts/ros_entrypoint.sh /
+# 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_turtlebot catkin_ws || true

+ 18 - 1
Dockerfile.kinetic

@@ -13,6 +13,23 @@
 # limitations under the License.
 # limitations under the License.
 
 
 FROM cartographer_ros:kinetic
 FROM cartographer_ros:kinetic
+
+# First, we invalidate the entire cache if googlecartographer/cartographer_ros 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/googlecartographer/cartographer_ros/git/refs/heads/master \
+    cartographer_turtlebot/cartographer_ros_version.json
+
 COPY . cartographer_turtlebot
 COPY . cartographer_turtlebot
-RUN cartographer_turtlebot/scripts/install.bash
+
+RUN cartographer_turtlebot/scripts/prepare_catkin_workspace.sh
+RUN cartographer_turtlebot/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/*
+RUN cartographer_turtlebot/scripts/install.sh --pkg cartographer_turtlebot && \
+    cartographer_turtlebot/scripts/install.sh --pkg cartographer_turtlebot \
+        --catkin-make-args run_tests && \
+    cartographer_turtlebot/scripts/catkin_test_results.sh build_isolated/cartographer_turtlebot
+
 COPY scripts/ros_entrypoint.sh /
 COPY scripts/ros_entrypoint.sh /
+# 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_turtlebot catkin_ws || true

+ 25 - 0
scripts/catkin_test_results.sh

@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# 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.
+
+set -o errexit
+set -o verbose
+
+. /opt/ros/${ROS_DISTRO}/setup.sh
+. /opt/cartographer_ros/setup.sh
+
+cd catkin_ws
+
+catkin_test_results $@

+ 6 - 23
scripts/install.bash → scripts/install.sh

@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 
 # Copyright 2016 The Cartographer Authors
 # Copyright 2016 The Cartographer Authors
 #
 #
@@ -17,20 +17,10 @@
 set -o errexit
 set -o errexit
 set -o verbose
 set -o verbose
 
 
-sudo apt-get update
+. /opt/ros/${ROS_DISTRO}/setup.sh
+. /opt/cartographer_ros/setup.sh
 
 
-source /ros_entrypoint.sh
-
-# Create a new workspace in 'catkin_ws'.
-mkdir catkin_ws
 cd catkin_ws
 cd catkin_ws
-wstool init src
-
-mv ../cartographer_turtlebot src
-
-# Install rosdep dependencies.
-rosdep update
-rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
 
 
 # Build, install, and test.
 # Build, install, and test.
 #
 #
@@ -38,13 +28,6 @@ rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
 # 'catkin_make_isolated' in order to avoid the use of 'devel_isolated' as the
 # 'catkin_make_isolated' in order to avoid the use of 'devel_isolated' as the
 # 'CMAKE_INSTALL_PREFIX' for non-test targets. This in itself is important to
 # 'CMAKE_INSTALL_PREFIX' for non-test targets. This in itself is important to
 # avoid any issues caused by using 'CMAKE_INSTALL_PREFIX' during the
 # avoid any issues caused by using 'CMAKE_INSTALL_PREFIX' during the
-# configuration phase of the build.
-export BUILD_FLAGS="--use-ninja
-                    --install-space /opt/cartographer_turtlebot
-                    --install"
-catkin_make_isolated ${BUILD_FLAGS}
-catkin_make_isolated ${BUILD_FLAGS} --catkin-make-args run_tests
-
-# Clean up.
-cd ..
-rm -rf catkin_ws /var/lib/apt/lists/*
+# configuration phase of the build (e.g. cartographer/common/config.h.cmake).
+export BUILD_FLAGS="--use-ninja --install-space /opt/cartographer_turtlebot --install"
+catkin_make_isolated ${BUILD_FLAGS} $@

+ 29 - 0
scripts/install_debs.sh

@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# 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.
+
+set -o errexit
+set -o verbose
+
+. /opt/ros/${ROS_DISTRO}/setup.sh
+. /opt/cartographer_ros/setup.sh
+
+cd catkin_ws
+
+apt-get update
+
+# Install rosdep dependencies.
+rosdep update
+rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

+ 26 - 0
scripts/prepare_catkin_workspace.sh

@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# 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.
+
+set -o errexit
+set -o verbose
+
+. /opt/ros/${ROS_DISTRO}/setup.sh
+
+# Create a new workspace in 'catkin_ws'.
+mkdir catkin_ws
+cd catkin_ws
+wstool init src
+ln -s /cartographer_turtlebot src/