From 6db22aa946d3edd6cd1a1e5460d282999afa7e9c Mon Sep 17 00:00:00 2001 From: Michael Wrock Date: Fri, 15 Jul 2022 02:02:30 -0700 Subject: [PATCH] Test docker (#3) * renamed cartesian limits file (#472) * Tutorial dockerfiles (#463) Build and push docker images for tutorials * fixed clang complaints * removed dockerhub pushes * successfully ran htmlproofer * removed chomp tutorial commits * removed accidental commits * Update CMakeLists.txt * renamed mtc tutorial cpp file * updated cmakelists * updated cmakelists * removed vscode * refactored docker * skipping base image * added conditions on building base image * added conditions on building base image * added conditions on building base image * ran pre commit * Update .docker/Dockerfile Co-authored-by: Robert Haschke * Update .docker/Dockerfile Co-authored-by: Robert Haschke * resolved comments * updated location to check for changes * test change to dockerfile * test change to dockerfile * test change to dockerfile * updated scripts to run only when dockerfile changes * fixed syntax * chaged to ros base image * chaged to ros base image * update * removed ccache and change repo names * removed ccache and change repo names Co-authored-by: Henry Moore <44307180+henrygerardmoore@users.noreply.github.com> Co-authored-by: Robert Haschke --- .github/workflows/docker-base.yml | 16 ++++++++++++++-- .github/workflows/docker-images.yml | 16 +++++++++++++--- .github/workflows/docker.yml | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-base.yml b/.github/workflows/docker-base.yml index 18a9a900ea..838e1e8702 100644 --- a/.github/workflows/docker-base.yml +++ b/.github/workflows/docker-base.yml @@ -22,19 +22,20 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - since_last_remote_commit: true - name: Get changed files id: changed-files uses: tj-actions/changed-files@v23.1 with: + since_last_remote_commit: true files: | .docker/Dockerfile moveit2_tutorials.repos + doc/tutorials/* - name: Set up Docker Buildx if: steps.changed-files.outputs.any_changed == 'true' uses: docker/setup-buildx-action@v2 - name: Login to Github Container Registry - if: steps.changed-files.outputs.any_changed == 'true' && env.PUSH == 'true' + if: steps.changed-files.outputs.any_changed == 'true' uses: docker/login-action@v2 with: registry: ghcr.io @@ -58,3 +59,14 @@ jobs: tags: | ${{ env.GH_IMAGE }} # ${{ env.DH_IMAGE }} + - name: Build and Push PR Image + uses: docker/build-push-action@v3 + if: steps.changed-files.outputs.any_changed == 'true' && env.PUSH == 'false' && github.event_name == 'pull_request' + with: + file: .docker/Dockerfile + build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + target: base_image + push: true + no-cache: false + tags: | + ${{ env.GH_IMAGE }}-PR-${{ github.head_ref }} diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml index 61b940bc70..f85cd74e63 100644 --- a/.github/workflows/docker-images.yml +++ b/.github/workflows/docker-images.yml @@ -19,6 +19,10 @@ jobs: PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'ros-planning/moveit2_tutorials') }} steps: + - name: Add -PR- to base image if this is a PR + if: github.event_name == 'pull_request' + run: | + echo "BASE_IMAGE_BRANCH=-PR-${{ github.head_ref }}" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Github Container Registry @@ -38,7 +42,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: hello_world_image push: ${{ env.PUSH }} no-cache: false @@ -49,7 +55,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: planning_around_objects_image push: ${{ env.PUSH }} no-cache: false @@ -60,7 +68,9 @@ jobs: uses: docker/build-push-action@v3 with: file: .docker/Dockerfile - build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }} + build-args: | + ROS_DISTRO=${{ matrix.ROS_DISTRO }} + BASE_BRANCH=${{ env.BASE_IMAGE_BRANCH }} target: pick_and_place_image push: ${{ env.PUSH }} no-cache: false diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 4904fb4fe1..07c4c1e405 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ on: paths: - moveit2_tutorials.repos - .docker/** - - doc/** + - doc/tutorials/** jobs: call-docker-base: