From 977c0e749f001422a31a236eea91c14a0e82ac6b Mon Sep 17 00:00:00 2001 From: marqrazz Date: Wed, 4 Oct 2023 07:47:31 -0600 Subject: [PATCH 01/13] Fix Humble CI Docker image build --- .github/workflows/docker-images.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 750b5b2dbd..7c0c340680 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -20,10 +20,13 @@ jobs: steps: - name: Checkout distro branch - if: ${{ matrix.ROS_DISTRO != 'rolling' }} + if: ${{ matrix.ROS_DISTRO }} != 'rolling' uses: actions/checkout@v4 with: ref: ${{ matrix.ROS_DISTRO }} + fetch-depth: 1 + - name: Print current branch + run: git branch --show-current - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From 73c3b1f98b8db24b289454c3e75e03591a0424f2 Mon Sep 17 00:00:00 2001 From: marqrazz Date: Wed, 4 Oct 2023 08:43:30 -0600 Subject: [PATCH 02/13] minimize changes --- .github/workflows/docker-images.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 7c0c340680..0bb4070f42 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -20,13 +20,10 @@ jobs: steps: - name: Checkout distro branch - if: ${{ matrix.ROS_DISTRO }} != 'rolling' + if: ${{ (matrix.ROS_DISTRO != 'rolling') }} uses: actions/checkout@v4 with: ref: ${{ matrix.ROS_DISTRO }} - fetch-depth: 1 - - name: Print current branch - run: git branch --show-current - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From 80e4c4e4218d387c923fcf2372a7577adedceefa Mon Sep 17 00:00:00 2001 From: marqrazz Date: Wed, 4 Oct 2023 09:30:18 -0600 Subject: [PATCH 03/13] explicity checkout humble or main --- .github/workflows/docker-images.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 0bb4070f42..0ede1df018 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -24,6 +24,13 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ matrix.ROS_DISTRO }} + fetch-depth: 1 + - name: Checkout main branch + if: ${{ (matrix.ROS_DISTRO == 'rolling') }} + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 1 - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From 9024937ecd645f358dd452b63c539bffb67c7919 Mon Sep 17 00:00:00 2001 From: marqrazz Date: Wed, 4 Oct 2023 09:31:51 -0600 Subject: [PATCH 04/13] pre-commit --- .github/workflows/docker-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 0ede1df018..6728ef8637 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -30,7 +30,7 @@ jobs: uses: actions/checkout@v4 with: ref: main - fetch-depth: 1 + fetch-depth: 1 - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From e2c5e146b16b4568ae5aaf8903dfc1b451a7fbc9 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 12:53:16 -0400 Subject: [PATCH 05/13] Cleanup --- .github/workflows/docker-images.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 6728ef8637..99213dac32 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -19,17 +19,10 @@ jobs: PUSH: ${{ (github.ref_name == 'main') }} steps: - - name: Checkout distro branch - if: ${{ (matrix.ROS_DISTRO != 'rolling') }} + - name: Checkout branch ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }} uses: actions/checkout@v4 with: - ref: ${{ matrix.ROS_DISTRO }} - fetch-depth: 1 - - name: Checkout main branch - if: ${{ (matrix.ROS_DISTRO == 'rolling') }} - uses: actions/checkout@v4 - with: - ref: main + ref: ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }} fetch-depth: 1 - name: Set lower case for container name run: | From b712b9c4805af7559edda435859336236144f6a2 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 12:56:14 -0400 Subject: [PATCH 06/13] Drop fetch-depth: 1 This is the default anyway: https://github.com/actions/checkout/blob/8ade135a41bc03ea155e62e844d188df1ea18608/README.md#L91-L93 --- .github/workflows/docker-images.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 99213dac32..53d0c7c86e 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -23,7 +23,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }} - fetch-depth: 1 - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From 0c7e1aca8eb179085e8ce9357aa1e33e3271fe6b Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 13:54:00 -0400 Subject: [PATCH 07/13] Cleanup Dockerfile --- .docker/Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 2371c93181..f8abfe8212 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,11 +11,8 @@ LABEL org.opencontainers.image.description "This container has working versions # Copy MoveIt sources from docker context COPY . src/moveit2_tutorials -# 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/ \ - # Fetch required upstream sources for building - vcs import src < /root/ws_moveit/src/moveit2_tutorials/.github/upstream.repos +# Fetch required upstream sources for building +RUN vcs import src < .github/upstream.repos ######################### Hello World Tutorial ######################################### @@ -28,10 +25,7 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" &&\ --dependencies moveit_ros_planning_interface moveit_visual_tools rclcpp \ --node-name hello_moveit hello_moveit -######################### Planning Around Objects ####################################### - -# Remove the hello_world tutorial cpp file and replace it with the planning_around_objects file -RUN rm src/hello_moveit/src/hello_moveit.cpp +# Replace template hello_moveit.cpp with implementation from planning_around_objects COPY ./doc/tutorials/planning_around_objects/hello_moveit.cpp src/hello_moveit/src/hello_moveit.cpp ######################### Pick and Place (MTC) Image ######################################### @@ -58,7 +52,7 @@ RUN sed -i "s|ament_package()|install(DIRECTORY launch DESTINATION share/\${PRO RUN --mount=type=cache,target=/root/.ccache/ \ # Enable ccache . "/opt/ros/${ROS_DISTRO}/setup.sh" &&\ - . "install/setup.sh" &&\ + . "install/setup.sh" &&\ sudo apt update && rosdep install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y && \ sudo apt install -y ros-${ROS_DISTRO}-rmw-cyclonedds-cpp && \ colcon build \ From 40dd10eb0de902b58ed5105d3080d67e40ddc0ff Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 13:56:35 -0400 Subject: [PATCH 08/13] Explicitly set docker context The default git context would use the main branch... --- .github/workflows/docker-images.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 53d0c7c86e..a3d88b769b 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -38,6 +38,7 @@ jobs: uses: docker/build-push-action@v5 with: file: .docker/Dockerfile + context: . build-args: | ROS_DISTRO=${{ matrix.ROS_DISTRO }} target: tutorial_image From f2bd40b19ae7af7c5b9f32c02b86d53467dc4fbe Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 14:23:50 -0400 Subject: [PATCH 09/13] Fix path --- .docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index f8abfe8212..70fab1dff8 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -8,11 +8,11 @@ FROM moveit/moveit2:${ROS_DISTRO}-source as tutorial_image LABEL org.opencontainers.image.description "This container has working versions of the tutorials discussed here: https://moveit.picknik.ai/main/doc/tutorials/tutorials.html" -# Copy MoveIt sources from docker context +# Copy sources from docker context COPY . src/moveit2_tutorials # Fetch required upstream sources for building -RUN vcs import src < .github/upstream.repos +RUN vcs import src < src/moveit2_tutorials/.github/upstream.repos ######################### Hello World Tutorial ######################################### From 89decbc9636aec7932fe153ae85bb22dd20c09fe Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 14:32:38 -0400 Subject: [PATCH 10/13] fixup! Cleanup Dockerfile --- .docker/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 70fab1dff8..662f6fe669 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -39,8 +39,7 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" &&\ --dependencies moveit_task_constructor_core rclcpp \ --node-name mtc_node mtc_tutorial -# Remove the empty cpp file and replace it with the example file -RUN rm src/mtc_tutorial/src/mtc_node.cpp +# Replace template mtc_node.cpp with the example file COPY ./doc/tutorials/pick_and_place_with_moveit_task_constructor/src/mtc_node.cpp src/mtc_tutorial/src/mtc_node.cpp # Add the launch folder to the tutorial package and CMakeLists.txt From 6ec65420681b26efb3b2ee57bce79bfddece9922 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 14:41:51 -0400 Subject: [PATCH 11/13] Drop .github from .dockerignore ... as we want to access the files in there --- .dockerignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index d92773afe6..fde666f2c1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,5 @@ __pycache__ **/.git -**/.github **/_scripts **/_static **/_templates From 4694d329ad03c5dc9736cec2ec8fb22ba40f3fdb Mon Sep 17 00:00:00 2001 From: marqrazz Date: Wed, 4 Oct 2023 15:00:59 -0600 Subject: [PATCH 12/13] only build rolling for main --- .github/workflows/docker-images.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index a3d88b769b..6fdaa472a5 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [humble, rolling] + ROS_DISTRO: rolling runs-on: ubuntu-latest permissions: packages: write @@ -19,10 +19,10 @@ jobs: PUSH: ${{ (github.ref_name == 'main') }} steps: - - name: Checkout branch ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }} + - name: Checkout branch main uses: actions/checkout@v4 with: - ref: ${{ matrix.ROS_DISTRO == 'rolling' && 'main' || matrix.ROS_DISTRO }} + ref: main - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} From 92bffb4461709f4c4bbe1af0feb2b63380528203 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 4 Oct 2023 23:04:45 -0400 Subject: [PATCH 13/13] Revert changes --- .dockerignore | 1 + .github/workflows/docker-images.yml | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index fde666f2c1..d92773afe6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ __pycache__ **/.git +**/.github **/_scripts **/_static **/_templates diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 6fdaa472a5..70776a8fdf 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: rolling + ROS_DISTRO: [rolling] runs-on: ubuntu-latest permissions: packages: write @@ -19,10 +19,6 @@ jobs: PUSH: ${{ (github.ref_name == 'main') }} steps: - - name: Checkout branch main - uses: actions/checkout@v4 - with: - ref: main - name: Set lower case for container name run: | echo "GH_IMAGE_LC=${GH_IMAGE,,}" >>${GITHUB_ENV} @@ -38,7 +34,6 @@ jobs: uses: docker/build-push-action@v5 with: file: .docker/Dockerfile - context: . build-args: | ROS_DISTRO=${{ matrix.ROS_DISTRO }} target: tutorial_image