Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 9 additions & 61 deletions .docker/ci-testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,68 +1,16 @@
# ghcr.io/moveit/moveit2:${OUR_ROS_DISTRO}-ci-testing
# ghcr.io/moveit/moveit2:${ROS_DISTRO}-ci-testing
# CI image using the ROS testing repository

FROM osrf/ros2:testing
ARG ROS_DISTRO=rolling
FROM moveit/moveit2:${ROS_DISTRO}-ci
LABEL maintainer="Robert Haschke rhaschke@techfak.uni-bielefeld.de"

ENV TERM=xterm

# Overwrite the ROS_DISTRO set in osrf/ros2:testing to the distro tied to this Dockerfile (OUR_ROS_DISTRO).
# In case ROS_DISTRO is now different from what was set in osrf/ros2:testing, run `rosdep update` again
# to get any missing dependencies.
# https://docs.docker.com/engine/reference/builder/#using-arg-variables explains why ARG and ENV can't have
# the same name (ROS_DISTRO is an ENV in the osrf/ros2:testing image).
ARG OUR_ROS_DISTRO=rolling
ENV ROS_DISTRO=${OUR_ROS_DISTRO}
RUN rosdep update --rosdistro $ROS_DISTRO

# Install ROS 2 base packages and build tools
# We are installing ros-<distro>-ros-base here to mimic the behavior of the ros:<distro>-ros-base images.
# This step is split into a separate layer so that we can rely on cached dependencies instead of having
# to install them with every new build. The testing image and packages will only update every couple weeks.
RUN \
# Update apt package list as previous containers clear the cache
apt-get -q update && \
apt-get -q -y upgrade && \
#
# Install base dependencies
apt-get -q install --no-install-recommends -y \
# Some basic requirements
wget git sudo curl \
# Preferred build tools
clang clang-format-14 clang-tidy clang-tools \
ccache \
ros-"$ROS_DISTRO"-ros-base && \
#
# Clear apt-cache to reduce image size
rm -rf /var/lib/apt/lists/*

# Setup (temporary) ROS workspace
WORKDIR /root/ws_moveit

# Copy MoveIt sources from docker context
COPY . src/moveit2

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN \
# Update apt package list as previous containers clear the cache
apt-get -q update && \
apt-get -q -y upgrade && \
#
# Globally disable git security
# https://github.blog/2022-04-12-git-security-vulnerability-announced
git config --global --add safe.directory "*" && \
#
# Fetch all dependencies from moveit2.repos
vcs import src < src/moveit2/moveit2.repos && \
if [ -r src/moveit2/moveit2_"$ROS_DISTRO".repos ] ; then vcs import src < src/moveit2/moveit2_"$ROS_DISTRO".repos ; fi && \
#
# Download all dependencies of MoveIt
rosdep update && \
DEBIAN_FRONTEND=noninteractive \
rosdep install -y --from-paths src --ignore-src --rosdistro "$ROS_DISTRO" --as-root=apt:false && \
# Remove the source code from this container
rm -rf src && \
# Switch to ros-testing
RUN apt-get update && \

Check failure on line 9 in .docker/ci-testing/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfiles (ci-testing)

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`
apt-get install -y ros2-testing-apt-source && \
# Upgrade packages to ros-testing and clean apt-cache within one RUN command
apt-get update && \
apt-get -qq -y dist-upgrade && \
#
# Clear apt-cache to reduce image size
rm -rf /var/lib/apt/lists/*
2 changes: 1 addition & 1 deletion .docker/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN \

Check failure on line 18 in .docker/ci/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfiles (ci)

SC2086 info: Double quote to prevent globbing and word splitting.
# Update apt package list as previous containers clear the cache
apt-get -q update && \
apt-get -q -y upgrade && \
Expand All @@ -39,7 +39,7 @@
# Download all dependencies of MoveIt
rosdep update && \
DEBIAN_FRONTEND=noninteractive \
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false && \
rosdep install -y -r --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false || true && \
# Remove the source code from this container
rm -rf src && \
#
Expand Down
2 changes: 1 addition & 1 deletion .docker/source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Downloads the moveit source code and install remaining debian dependencies

ARG ROS_DISTRO=rolling
FROM moveit/moveit2:${ROS_DISTRO}-ci
FROM moveit/moveit2:${ROS_DISTRO}-ci-testing
LABEL maintainer="Robert Haschke rhaschke@techfak.uni-bielefeld.de"

# Export ROS_UNDERLAY for downstream docker containers
Expand All @@ -16,7 +16,7 @@

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN --mount=type=cache,target=/root/.ccache/ \

Check failure on line 19 in .docker/source/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfiles (source)

SC2086 info: Double quote to prevent globbing and word splitting.
# Enable ccache
PATH=/usr/lib/ccache:$PATH && \
# Fetch required upstream sources for building
Expand Down
11 changes: 1 addition & 10 deletions .docker/tutorial-source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,9 @@
ARG ROS_DISTRO=rolling
ARG GZ_VERSION=ionic

FROM moveit/moveit2:${ROS_DISTRO}-ci
FROM moveit/moveit2:${ROS_DISTRO}-source
LABEL maintainer="Tyler Weaver tyler@picknik.ai"

ARG GZ_VERSION

# Export ROS_UNDERLAY for downstream docker containers
ENV ROS_UNDERLAY=/root/ws_moveit/install
WORKDIR $ROS_UNDERLAY/..

# Copy MoveIt sources from docker context
COPY . src/moveit2

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN --mount=type=cache,target=/root/.ccache/,sharing=locked \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
ROS_DISTRO: humble
- IMAGE: jazzy-ci
ROS_DISTRO: jazzy
- IMAGE: lyrical-ci
- IMAGE: lyrical-ci-testing
ROS_DISTRO: lyrical
env:
# TODO(andyz): When this clang-tidy issue is fixed, remove -Wno-unknown-warning-option
Expand Down
149 changes: 128 additions & 21 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ jobs:
packages: write
contents: read
env:
GH_IMAGE: ghcr.io/moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
DH_IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2') }}

steps:
- uses: rhaschke/docker-run-action@v5
- uses: rhaschke/docker-run-action@main
name: Check for apt updates
continue-on-error: true
id: apt
Expand Down Expand Up @@ -62,11 +61,11 @@ jobs:
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: ${{ env.PUSH }}
no-cache: ${{ steps.apt.outputs.no_cache || github.event_name == 'workflow_dispatch' }}
cache-from: type=registry,ref=${{ env.GH_IMAGE }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE }}
cache-to: type=inline
tags: |
${{ env.GH_IMAGE }}
${{ env.DH_IMAGE }}
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}

ci:
strategy:
Expand All @@ -78,12 +77,11 @@ jobs:
packages: write
contents: read
env:
GH_IMAGE: ghcr.io/moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
DH_IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2') }}

steps:
- uses: rhaschke/docker-run-action@v5
- uses: rhaschke/docker-run-action@main
name: Check for apt updates
continue-on-error: true
id: apt
Expand Down Expand Up @@ -115,15 +113,13 @@ jobs:
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: ${{ env.PUSH }}
no-cache: ${{ steps.apt.outputs.no_cache || github.event_name == 'workflow_dispatch' }}
cache-from: type=registry,ref=${{ env.GH_IMAGE }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE }}
cache-to: type=inline
tags: |
${{ env.GH_IMAGE }}
${{ env.GH_IMAGE }}-testing
${{ env.DH_IMAGE }}
${{ env.DH_IMAGE }}-testing
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}

source:
ci-testing:
needs: ci
strategy:
fail-fast: false
Expand All @@ -134,8 +130,60 @@ jobs:
packages: write
contents: read
env:
GH_IMAGE: ghcr.io/moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
DH_IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2') }}

steps:
- uses: rhaschke/docker-run-action@main
name: Check for apt updates
continue-on-error: true
id: apt
with:
image: ${{ env.IMAGE }}
run: |
apt-get update
have_updates=$(apt-get --simulate upgrade | grep -q "^0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.$" && echo false || echo true)
echo "no_cache=$have_updates" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Github Container Registry
if: env.PUSH == 'true'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: env.PUSH == 'true'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v7
with:
file: .docker/${{ github.job }}/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: ${{ env.PUSH }}
no-cache: ${{ steps.apt.outputs.no_cache || github.event_name == 'workflow_dispatch' }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE }}
cache-to: type=inline
tags: |
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}

source:
needs: ci-testing
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [lyrical, rolling]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2') }}

steps:
Expand Down Expand Up @@ -164,21 +212,80 @@ jobs:
file: .docker/${{ github.job }}/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: ${{ env.PUSH }}
cache-from: type=registry,ref=${{ env.GH_IMAGE }}
cache-from: type=registry,ref=ghcr.io/${{ env.IMAGE }}
cache-to: type=inline
tags: |
${{ env.GH_IMAGE }}
${{ env.DH_IMAGE }}
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}

tutorial-source:
needs: source
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [lyrical, rolling]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE: moveit/moveit2:main-${{ matrix.ROS_DISTRO }}-${{ github.job }}
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2') }}

steps:
- uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Github Container Registry
if: env.PUSH == 'true'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: env.PUSH == 'true'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Remove .dockerignore"
run: rm .dockerignore # enforce full source context
- name: Cache ccache
uses: actions/cache@v5
with:
path: .ccache
key: docker-tutorial-ccache-${{ matrix.ROS_DISTRO }}-${{ hashFiles( '.docker/tutorial-source/Dockerfile' ) }}
- name: inject ccache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.3.0
with:
cache-map: |
{
".ccache": "/root/.ccache/"
}
- name: Build and Push
uses: docker/build-push-action@v7
with:
context: .
file: .docker/${{ github.job }}/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: ${{ env.PUSH }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ env.IMAGE }}
ghcr.io/${{ env.IMAGE }}

delete_untagged:
runs-on: ubuntu-latest
needs:
- release
- source
- tutorial-source
steps:
- name: Delete Untagged Images
if: (github.event_name != 'pull_request') && (github.repository == 'moveit/moveit2')
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
github-token: ${{ secrets.DELETE_PACKAGES_TOKEN }}
script: |
Expand Down
Loading
Loading