Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI for ROS2 Foxy #1684

Merged
merged 13 commits into from
May 9, 2020
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ references:
rosdep install -q -y \
--from-paths src \
--ignore-src \
--skip-keys " \
gazebo11 \
libgazebo11-dev \
" \
--verbose | \
awk '$1 ~ /^resolution\:/' | \
awk -F'[][]' '{print $2}' | \
Expand Down Expand Up @@ -276,10 +280,6 @@ references:
file: lcov/project_coverage.info
flags: project
when: always
install_deployment_key: &install_deployment_key
add_ssh_keys:
fingerprints:
- "0e:8e:90:bf:3d:a9:04:d9:04:b4:62:38:a5:3b:90:7d"

commands:
<<: *common_commands
Expand Down Expand Up @@ -393,14 +393,14 @@ workflows:
- release_build
nightly:
jobs:
- debug_build
- debug_test:
requires:
- debug_build
# - debug_build
# - debug_test:
# requires:
# - debug_build
- release_build
- test_rmw_connext_cpp:
requires:
- release_build
# - test_rmw_connext_cpp:
# requires:
# - release_build
- test_rmw_cyclonedds_cpp:
requires:
- release_build
Expand Down
82 changes: 49 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,96 +7,112 @@
# --build-arg UNDERLAY_MIXINS \
# --build-arg OVERLAY_MIXINS ./
ARG FROM_IMAGE=osrf/ros2:nightly
ARG UNDERLAY_WS=/opt/underlay_ws
ARG OVERLAY_WS=/opt/overlay_ws

# multi-stage for caching
FROM $FROM_IMAGE AS cache
FROM $FROM_IMAGE AS cacher

# clone underlay source
ENV UNDERLAY_WS /opt/underlay_ws
RUN mkdir -p $UNDERLAY_WS/src
WORKDIR $UNDERLAY_WS
COPY ./tools/ros2_dependencies.repos ./
RUN vcs import src < ros2_dependencies.repos
ARG UNDERLAY_WS
WORKDIR $UNDERLAY_WS/src
COPY ./tools/ros2_dependencies.repos ../
RUN vcs import ./ < ../ros2_dependencies.repos && \
find ./ -name ".git" | xargs rm -rf

# copy overlay source
ENV OVERLAY_WS /opt/overlay_ws
RUN mkdir -p $OVERLAY_WS/src
WORKDIR $OVERLAY_WS
COPY ./ src/navigation2
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS/src
COPY ./ ./navigation2

# copy manifests for caching
WORKDIR /opt
RUN find ./ -name "package.xml" | \
xargs cp --parents -t /tmp && \
RUN mkdir -p /tmp/opt && \
find ./ -name "package.xml" | \
xargs cp --parents -t /tmp/opt && \
find ./ -name "COLCON_IGNORE" | \
xargs cp --parents -t /tmp
xargs cp --parents -t /tmp/opt || true

# multi-stage for building
FROM $FROM_IMAGE AS build
FROM $FROM_IMAGE AS builder

# install CI dependencies
RUN apt-get update && apt-get install -q -y \
ccache \
lcov \
&& rm -rf /var/lib/apt/lists/*

# copy underlay manifests
ENV UNDERLAY_WS /opt/underlay_ws
COPY --from=cache /tmp/underlay_ws $UNDERLAY_WS
WORKDIR $UNDERLAY_WS
# TODO: clean up once libgazebo11-dev released into ros2 repo
# https://github.com/ros-infrastructure/reprepro-updater/pull/75
# https://github.com/ros/rosdistro/pull/24646
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
# setup sources.list
RUN . /etc/os-release \
&& echo "deb http://packages.osrfoundation.org/gazebo/$ID-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-latest.list
# install gazebo packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
libgazebo11-dev \
&& rm -rf /var/lib/apt/lists/*

# install underlay dependencies
ARG UNDERLAY_WS
WORKDIR $UNDERLAY_WS
COPY --from=cacher /tmp/$UNDERLAY_WS ./
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
apt-get update && rosdep install -q -y \
--from-paths src \
--ignore-src \
--skip-keys " \
gazebo11 \
libgazebo11-dev \
" \
&& rm -rf /var/lib/apt/lists/*

# copy underlay source
COPY --from=cache $UNDERLAY_WS ./

# build underlay source
COPY --from=cacher $UNDERLAY_WS ./
ARG UNDERLAY_MIXINS="release ccache"
ARG FAIL_ON_BUILD_FAILURE=True
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--symlink-install \
--mixin \
$UNDERLAY_MIXINS \
--mixin $UNDERLAY_MIXINS \
--event-handlers console_direct+ \
|| touch build_failed && \
if [ -f build_failed ] && [ -n "$FAIL_ON_BUILD_FAILURE" ]; then \
exit 1; \
fi

# copy overlay manifests
ENV OVERLAY_WS /opt/overlay_ws
COPY --from=cache /tmp/overlay_ws $OVERLAY_WS
WORKDIR $OVERLAY_WS

# install overlay dependencies
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS
COPY --from=cacher /tmp/$OVERLAY_WS ./
RUN . $UNDERLAY_WS/install/setup.sh && \
apt-get update && rosdep install -q -y \
--from-paths src \
$UNDERLAY_WS/src \
--ignore-src \
--skip-keys " \
gazebo11 \
libgazebo11-dev \
" \
&& rm -rf /var/lib/apt/lists/*

# copy overlay source
COPY --from=cache $OVERLAY_WS ./

# build overlay source
COPY --from=cacher $OVERLAY_WS ./
ARG OVERLAY_MIXINS="release ccache"
RUN . $UNDERLAY_WS/install/setup.sh && \
colcon build \
--symlink-install \
--mixin \
$OVERLAY_MIXINS \
--mixin $OVERLAY_MIXINS \
|| touch build_failed && \
if [ -f build_failed ] && [ -n "$FAIL_ON_BUILD_FAILURE" ]; then \
exit 1; \
fi

# source overlay from entrypoint
ENV UNDERLAY_WS $UNDERLAY_WS
ENV OVERLAY_WS $OVERLAY_WS
RUN sed --in-place \
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
/ros_entrypoint.sh
43 changes: 0 additions & 43 deletions release_branch.Dockerfile

This file was deleted.

102 changes: 102 additions & 0 deletions tools/release.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# syntax=docker/dockerfile:experimental

# Use experimental buildkit for faster builds
# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md
# Use `--progress=plain` to use plane stdout for docker build
#
# Example build command:
# export DOCKER_BUILDKIT=1
# export FROM_IMAGE="ros:eloquent"
# export OVERLAY_MIXINS="release ccache"
# docker build -t nav2:release_branch \
# --build-arg FROM_IMAGE \
# --build-arg OVERLAY_MIXINS \
# -f release_branch.Dockerfile ./

ARG FROM_IMAGE=ros:eloquent
ARG OVERLAY_WS=/opt/overlay_ws

# multi-stage for caching
FROM $FROM_IMAGE AS cacher

# copy overlay source
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS/src
RUN echo "\
repositories: \n\
ros-planning/navigation2: \n\
type: git \n\
url: https://github.com/ros-planning/navigation2.git \n\
version: ${ROS_DISTRO}-devel \n\
" > ../overlay.repos
RUN vcs import ./ < ../overlay.repos && \
find ./ -name ".git" | xargs rm -rf
# COPY ./ ./ros-planning/navigation2

# copy manifests for caching
WORKDIR /opt
RUN mkdir -p /tmp/opt && \
find ./ -name "package.xml" | \
xargs cp --parents -t /tmp/opt && \
find ./ -name "COLCON_IGNORE" | \
xargs cp --parents -t /tmp/opt || true

# multi-stage for building
FROM $FROM_IMAGE AS builder

# edit apt for caching
RUN cp /etc/apt/apt.conf.d/docker-clean /etc/apt/ && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \
> /etc/apt/apt.conf.d/docker-clean

# install CI dependencies
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
apt-get update && apt-get install -q -y \
ccache \
lcov \
&& rosdep update

# install overlay dependencies
ARG OVERLAY_WS
WORKDIR $OVERLAY_WS
COPY --from=cacher /tmp/$OVERLAY_WS/src ./src
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
. /opt/ros/$ROS_DISTRO/setup.sh && \
apt-get update && rosdep install -q -y \
--from-paths src \
--ignore-src \
&& rm -rf /var/lib/apt/lists/*

# build overlay source
COPY --from=cacher $OVERLAY_WS/src ./src
ARG OVERLAY_MIXINS="release ccache"
RUN --mount=type=cache,target=/root/.ccache \
. /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--symlink-install \
--mixin $OVERLAY_MIXINS

# restore apt for docker
RUN mv /etc/apt/docker-clean /etc/apt/apt.conf.d/ && \
rm -rf /var/lib/apt/lists/

# source overlay from entrypoint
ENV OVERLAY_WS $OVERLAY_WS
RUN sed --in-place \
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
/ros_entrypoint.sh

# ARG RUN_TESTS
# ARG FAIL_ON_TEST_FAILURE
# RUN if [ -z "$RUN_TESTS" ]; then \
# colcon test \
# --mixin $OVERLAY_MIXINS \
# --ctest-args --test-regex "test_.*"; \
# if [ -z "$FAIL_ON_TEST_FAILURE" ]; then \
# colcon test-result; \
# else \
# colcon test-result || true; \
# fi \
# fi
15 changes: 9 additions & 6 deletions tools/ros2_dependencies.repos
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
repositories:
BehaviorTree.CPP:
BehaviorTree/BehaviorTree.CPP:
type: git
url: https://github.com/BehaviorTree/BehaviorTree.CPP.git
version: master
angles:
ros/angles:
type: git
url: https://github.com/ros/angles.git
version: ros2
gazebo_ros_pkgs:
ros-simulation/gazebo_ros_pkgs:
type: git
url: https://github.com/ros-simulation/gazebo_ros_pkgs.git
version: ros2
image_common:
# TODO: Revert after support for Gazebo v11 is merged
# https://github.com/ros-simulation/gazebo_ros_pkgs/pull/1093
# version: ros2
version: gazebo11_foxy
ros-perception/image_common:
type: git
url: https://github.com/ros-perception/image_common.git
version: ros2
vision_opencv:
ros-perception/vision_opencv:
type: git
url: https://github.com/ros-perception/vision_opencv.git
version: ros2
File renamed without changes.