From 2ab4f1cfaaf4027f748cd5d36edfd2eb7e0156a9 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 15 Oct 2024 06:31:44 +0900 Subject: [PATCH 01/20] chore(docker): remove `/autoware/log` after `colcon build` (#5329) --- docker/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 82e2ccaf9e0..eda2e415942 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -223,7 +223,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -255,7 +255,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -287,7 +287,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -319,7 +319,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log FROM universe-common-devel AS universe-planning-control-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -353,7 +353,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -387,7 +387,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -430,7 +430,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --install-base /opt/autoware \ --mixin release compile-commands ccache \ && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && rm -rf /autoware/build /autoware/log ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] From 71d2f316818576987c2015971ab72731c470fb13 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Mon, 21 Oct 2024 18:27:02 +0900 Subject: [PATCH 02/20] chore(.github): always run `Show disk space` (#5354) always show disk space Signed-off-by: Yutaka Kondo --- .github/workflows/docker-build-and-push-arm64.yaml | 1 + .github/workflows/docker-build-and-push.yaml | 1 + .github/workflows/health-check-arm64.yaml | 1 + .github/workflows/health-check.yaml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index c262f0944a1..75a51b48581 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -83,5 +83,6 @@ jobs: tag-suffix: ${{ matrix.tag-suffix }} - name: Show disk space + if: always() run: | df -h diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index a321bfe5ddc..d81db3f4a19 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -78,5 +78,6 @@ jobs: tag-suffix: ${{ matrix.tag-suffix }} - name: Show disk space + if: always() run: | df -h diff --git a/.github/workflows/health-check-arm64.yaml b/.github/workflows/health-check-arm64.yaml index baf58b00d3b..eca18a45bd3 100644 --- a/.github/workflows/health-check-arm64.yaml +++ b/.github/workflows/health-check-arm64.yaml @@ -58,5 +58,6 @@ jobs: LIB_DIR=${{ matrix.lib_dir }} - name: Show disk space + if: always() run: | df -h diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 80163069c68..9a54be6cb77 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -68,5 +68,6 @@ jobs: LIB_DIR=${{ matrix.lib_dir }} - name: Show disk space + if: always() run: | df -h From 99dd3de66c8d50bc8445cafbdd0f72e0bb63b0c5 Mon Sep 17 00:00:00 2001 From: chgyg <99009754+ChgygLin@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:53:44 +0800 Subject: [PATCH 03/20] build(autoware.repos): remove ament_cmake fork repository (#5360) Signed-off-by: Chengyong Lin --- autoware.repos | 4 ---- 1 file changed, 4 deletions(-) diff --git a/autoware.repos b/autoware.repos index bd3b94c0240..68d623199ee 100644 --- a/autoware.repos +++ b/autoware.repos @@ -75,10 +75,6 @@ repositories: type: git url: https://github.com/MapIV/llh_converter.git version: ros2 - universe/external/ament_cmake: # TODO(mitsudome-r): remove when https://github.com/ament/ament_cmake/pull/448 is merged - type: git - url: https://github.com/autowarefoundation/ament_cmake.git - version: feat/faster_ament_libraries_deduplicate universe/external/glog: # TODO(Horibe): to use isGoogleInitialized() API in v0.6.0. Remove when the rosdep glog version is updated to v0.6.0 (already updated in Ubuntu 24.04) type: git url: https://github.com/tier4/glog.git From 71c87896fb06cb929f7d0d4f1f65cb0b3a19c9e1 Mon Sep 17 00:00:00 2001 From: SakodaShintaro Date: Wed, 6 Nov 2024 14:04:32 +0900 Subject: [PATCH 04/20] fix: remove `ndt_omp` (#5390) Removed ndt_omp Signed-off-by: Shintaro Sakoda --- autoware.repos | 4 ---- 1 file changed, 4 deletions(-) diff --git a/autoware.repos b/autoware.repos index 68d623199ee..65425f55b93 100644 --- a/autoware.repos +++ b/autoware.repos @@ -55,10 +55,6 @@ repositories: type: git url: https://github.com/tier4/muSSP.git version: tier4/main - universe/external/ndt_omp: - type: git - url: https://github.com/tier4/ndt_omp.git - version: tier4/main universe/external/pointcloud_to_laserscan: type: git url: https://github.com/tier4/pointcloud_to_laserscan.git From 4db1eff03cdd4dc5616d4bff994ecfc9b88e7d5f Mon Sep 17 00:00:00 2001 From: SakodaShintaro Date: Thu, 7 Nov 2024 14:11:53 +0900 Subject: [PATCH 05/20] fix: change the organization of `awsim_sensor_kit_launch` from RobotecAI to tier4 (#5403) Fixed organization of `awsim_sensor_kit_launch` from RobotecAI to tier4 Signed-off-by: Shintaro Sakoda --- autoware.repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoware.repos b/autoware.repos index 65425f55b93..66feaa178b2 100644 --- a/autoware.repos +++ b/autoware.repos @@ -110,7 +110,7 @@ repositories: version: main sensor_kit/external/awsim_sensor_kit_launch: # TODO: Integrate into sample_sensor_kit_launch type: git - url: https://github.com/RobotecAI/awsim_sensor_kit_launch.git + url: https://github.com/tier4/awsim_sensor_kit_launch.git version: main sensor_kit/awsim_labs_sensor_kit_launch: type: git From 06d386abd9423482de838d28e8d53741807fead8 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Thu, 7 Nov 2024 17:30:08 +0900 Subject: [PATCH 06/20] chore(.devcontainer): rename `.devcontainer` directories (#5407) rename .devcontainer dirs Signed-off-by: Yutaka Kondo --- .devcontainer/{cuda => universe-devel-cuda}/devcontainer.json | 0 .devcontainer/{base => universe-devel}/devcontainer.json | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .devcontainer/{cuda => universe-devel-cuda}/devcontainer.json (100%) rename .devcontainer/{base => universe-devel}/devcontainer.json (100%) diff --git a/.devcontainer/cuda/devcontainer.json b/.devcontainer/universe-devel-cuda/devcontainer.json similarity index 100% rename from .devcontainer/cuda/devcontainer.json rename to .devcontainer/universe-devel-cuda/devcontainer.json diff --git a/.devcontainer/base/devcontainer.json b/.devcontainer/universe-devel/devcontainer.json similarity index 100% rename from .devcontainer/base/devcontainer.json rename to .devcontainer/universe-devel/devcontainer.json From 9dca3044ef48fc5913d9d5cd23aff9b68313671d Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 8 Nov 2024 07:39:44 +0900 Subject: [PATCH 07/20] feat(docker): integrate `cuda`/`no-cuda` jobs into single job (#5363) --- .../docker-build-and-push-cuda/action.yaml | 121 ++++ .../actions/docker-build-and-push/action.yaml | 60 +- .github/actions/docker-build/action.yaml | 25 +- .../docker-build-and-push-arm64.yaml | 54 +- .github/workflows/docker-build-and-push.yaml | 54 +- .github/workflows/health-check-arm64.yaml | 24 +- .github/workflows/health-check.yaml | 22 +- docker/Dockerfile | 145 ++++- docker/Dockerfile.svg | 531 ++++++++++-------- docker/docker-bake-cuda.hcl | 38 ++ 10 files changed, 673 insertions(+), 401 deletions(-) create mode 100644 .github/actions/docker-build-and-push-cuda/action.yaml create mode 100644 docker/docker-bake-cuda.hcl diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml new file mode 100644 index 00000000000..59f5ccc3569 --- /dev/null +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -0,0 +1,121 @@ +name: docker-build-and-push-cuda +description: Workflow do build and push CUDA images to registry. + +inputs: + platform: + description: "" + required: true + bake-target: + description: "" + required: true + build-args: + description: "" + required: false + +runs: + using: composite + steps: + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Restore ccache + uses: actions/cache/restore@v4 + with: + path: | + root-ccache + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} + restore-keys: | + ccache-${{ inputs.platform }}- + + - name: Restore apt-get + uses: actions/cache/restore@v4 + with: + path: | + var-cache-apt + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} + restore-keys: | + apt-get-${{ inputs.platform }}- + + - name: Inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.2 + with: + cache-map: | + { + "root-ccache": "/root/.ccache", + "var-cache-apt": "/var/cache/apt" + } + skip-extraction: true + + - name: Get current date + id: date + run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT + shell: bash + + - name: Docker meta for autoware:universe-sensing-perception-devel-cuda + id: meta-universe-sensing-perception-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-devel-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-sensing-perception-cuda + id: meta-universe-sensing-perception-cuda + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-devel-cuda + id: meta-universe-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-devel-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-cuda + id: meta-universe-cuda + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-cuda-${{ inputs.platform }} + type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-cuda + flavor: | + latest=auto + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + + - name: Build and Push to GitHub Container Registry + uses: docker/bake-action@v5 + with: + push: true + files: | + docker/docker-bake-cuda.hcl + ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} + ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} + ${{ steps.meta-universe-cuda.outputs.bake-file }} + provenance: false + set: | + ${{ inputs.build-args }} diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 728d52b9376..0a064ee1acf 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -2,9 +2,6 @@ name: docker-build-and-push description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -14,9 +11,6 @@ inputs: build-args: description: "" required: false - tag-suffix: - description: "" - required: false runs: using: composite @@ -42,9 +36,8 @@ runs: with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get @@ -52,9 +45,8 @@ runs: with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -78,8 +70,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=base${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=base${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=base-${{ inputs.platform }} + type=raw,value=base-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-base flavor: | latest=false @@ -90,8 +82,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=core-devel-${{ inputs.platform }} + type=raw,value=core-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-core-devel flavor: | latest=false @@ -102,8 +94,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception-devel flavor: | latest=false @@ -114,8 +106,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception flavor: | latest=false @@ -126,8 +118,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping-devel flavor: | latest=false @@ -138,8 +130,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping flavor: | latest=false @@ -150,8 +142,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control-devel flavor: | latest=false @@ -162,8 +154,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control flavor: | latest=false @@ -174,8 +166,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system-devel flavor: | latest=false @@ -186,8 +178,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system flavor: | latest=false @@ -198,8 +190,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-devel-${{ inputs.platform }} + type=raw,value=universe-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-devel flavor: | latest=false @@ -210,8 +202,8 @@ runs: with: images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-${{ inputs.platform }} + type=raw,value=universe-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe flavor: | latest=auto diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index de582611886..bfb6383c208 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -2,9 +2,6 @@ name: docker-build description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -36,48 +33,44 @@ runs: - name: Cache ccache uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-ccache with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Cache apt-get uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-apt-get with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Restore ccache uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -104,4 +97,4 @@ runs: context: . push: false build-args: ${{ inputs.build-args }} - cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ inputs.name }}-${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} + cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 75a51b48581..01d6be45f59 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: [self-hosted, linux, ARM64] - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - tag-suffix: -cuda steps: # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace @@ -62,25 +44,39 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' + - name: Build 'Autoware' without CUDA if: ${{ steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/arm64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - *.args.SETUP_ARGS=${{ matrix.setup-args }} - *.args.LIB_DIR=${{ matrix.lib_dir }} - *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }} - *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=aarch64 + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-${{ github.ref_name }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-main + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-${{ github.ref_name }},mode=max + + - name: Build 'Autoware' with CUDA + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} + uses: ./.github/actions/docker-build-and-push-cuda + with: + platform: arm64 + bake-target: autoware + build-args: | + *.platform=linux/arm64 + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=aarch64 + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-${{ github.ref_name }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-main + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-${{ github.ref_name }},mode=max - name: Show disk space if: always() diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index d81db3f4a19..232b78c6569 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - tag-suffix: -cuda steps: - name: Check out repository uses: actions/checkout@v4 @@ -57,25 +39,39 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' + - name: Build 'Autoware' without CUDA if: ${{ steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/amd64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - *.args.SETUP_ARGS=${{ matrix.setup-args }} - *.args.LIB_DIR=${{ matrix.lib_dir }} - *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }} - *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-${{ github.ref_name }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-main + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-${{ github.ref_name }},mode=max + + - name: Build 'Autoware' with CUDA + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} + uses: ./.github/actions/docker-build-and-push-cuda + with: + platform: amd64 + bake-target: autoware + build-args: | + *.platform=linux/amd64 + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-${{ github.ref_name }} + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-main + *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-${{ github.ref_name }},mode=max - name: Show disk space if: always() diff --git a/.github/workflows/health-check-arm64.yaml b/.github/workflows/health-check-arm64.yaml index eca18a45bd3..d487e3c6ffd 100644 --- a/.github/workflows/health-check-arm64.yaml +++ b/.github/workflows/health-check-arm64.yaml @@ -12,22 +12,6 @@ jobs: docker-build: needs: load-env runs-on: [self-hosted, linux, ARM64] - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 steps: # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace @@ -48,14 +32,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=aarch64 - name: Show disk space if: always() diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 9a54be6cb77..55894881a4d 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -29,20 +29,6 @@ jobs: runs-on: ubuntu-22.04 strategy: fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 steps: - name: Check out repository uses: actions/checkout@v4 @@ -58,14 +44,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=x86_64 - name: Show disk space if: always() diff --git a/docker/Dockerfile b/docker/Dockerfile index eda2e415942..19bb14cf97d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,6 @@ ARG BASE_IMAGE FROM $BASE_IMAGE AS base SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS # Install apt packages and add GitHub to known hosts for private repositories RUN rm -f /etc/apt/apt.conf.d/docker-clean \ @@ -25,7 +24,7 @@ WORKDIR /autoware # Set up base environment RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module base ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache \ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc @@ -193,13 +192,12 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ FROM base AS core-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS ENV CCACHE_DIR="/root/.ccache" # Set up development environment and tools RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers openadkit \ && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache @@ -292,6 +290,47 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception-devel AS universe-sensing-perception-devel-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + # TODO(youtalk): Move CUDA related packages into a dedicated directory + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation,target=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/autoware_cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/autoware_cuda_utils \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && colcon build --cmake-args \ + " -Wno-dev" \ + " --no-warn-unused-cli" \ + --merge-install \ + --install-base /opt/autoware \ + --mixin release compile-commands ccache \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && rm -rf /autoware/build + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-localization-mapping-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -435,18 +474,32 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-devel AS universe-devel-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-sensing-perception SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -455,8 +508,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -469,18 +521,43 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception AS universe-sensing-perception-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-localization-mapping SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-exec-depend-packages.txt /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -507,14 +584,13 @@ FROM base AS universe-planning-control SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-exec-depend-packages.txt /tmp/rosdep-universe-planning-control-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-planning-control-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -541,14 +617,13 @@ FROM base AS universe-vehicle-system SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-exec-depend-packages.txt /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -575,14 +650,13 @@ FROM base AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -591,8 +665,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -604,3 +677,29 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] + +FROM universe AS universe-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-devel-cuda /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index a8d5d4e1d37..5d983ab1436 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -1,414 +1,485 @@ - - - + + G - + cluster_legend - + key -FROM ...  -COPY --from=...  -RUN --mount=(.*)from=...  +FROM ...  +COPY --from=...  +RUN --mount=(.*)from=...  key2 -  -  -  +  +  +  key:e->key2:w - - + + key:e->key2:w - - + + key:e->key2:w - - + + external_image_0 - -$BASE_IMAGE + +$BASE_IMAGE stage_0 - -base + +base external_image_0->stage_0 - - + + stage_1 - -rosdep-depend + +rosdep-depend external_image_0->stage_1 - - + + stage_7 - -core-devel + +core-devel stage_0->stage_7 - - + + - + -stage_14 - -universe-sensing-perception +stage_16 + +universe-sensing-perception - + -stage_0->stage_14 - - - +stage_0->stage_16 + + - + -stage_15 - -universe-localization-mapping +stage_18 + +universe-localization-mapping - + -stage_0->stage_15 - - +stage_0->stage_18 + + - + -stage_16 - -universe-planning-control +stage_19 + +universe-planning-control - + -stage_0->stage_16 - - - - +stage_0->stage_19 + + - + -stage_17 - -universe-vehicle-system +stage_20 + +universe-vehicle-system - + -stage_0->stage_17 - +stage_0->stage_20 + + - + -stage_18 - -universe +stage_21 + +universe - + -stage_0->stage_18 - - +stage_0->stage_21 + + + + + stage_1->stage_7 - - + + stage_2 - -rosdep-universe-sensing-perception-depend + +rosdep-universe-sensing-perception-depend stage_1->stage_2 - - + + stage_3 - -rosdep-universe-localization-mapping-depend + +rosdep-universe-localization-mapping-depend stage_1->stage_3 - - + + + stage_4 - -rosdep-universe-planning-control-depend + +rosdep-universe-planning-control-depend stage_1->stage_4 - - - + + stage_5 - -rosdep-universe-vehicle-system-depend + +rosdep-universe-vehicle-system-depend stage_1->stage_5 - - + + stage_6 - -rosdep-universe-depend + +rosdep-universe-depend stage_1->stage_6 - - - + + stage_8 - -universe-common-devel + +universe-common-devel stage_1->stage_8 - - + + - + stage_7->stage_8 - - + + - - -stage_2->stage_14 - - + + +stage_17 + +universe-sensing-perception-cuda + + + +stage_16->stage_17 + + + + + +stage_22 + +universe-cuda + + + +stage_21->stage_22 + + + + + +stage_2->stage_16 + + stage_9 - -universe-sensing-perception-devel + +universe-sensing-perception-devel stage_2->stage_9 - - - - - -stage_3->stage_15 - - + + stage_10 - -universe-localization-mapping-devel + +universe-sensing-perception-devel-cuda - - -stage_3->stage_10 - - + + +stage_2->stage_10 + + + - - -stage_4->stage_16 - - + + +stage_3->stage_18 + + stage_11 - -universe-planning-control-devel - - - -stage_4->stage_11 - - - - - -stage_5->stage_17 - - - + +universe-localization-mapping-devel + + + +stage_3->stage_11 + + + + + +stage_4->stage_19 + + stage_12 - -universe-vehicle-system-devel + +universe-planning-control-devel - - -stage_5->stage_12 - - + + +stage_4->stage_12 + + - + -stage_6->stage_18 - - +stage_5->stage_20 + + stage_13 - -universe-devel + +universe-vehicle-system-devel + + + +stage_5->stage_13 + + + + + +stage_6->stage_21 + - - -stage_6->stage_13 - - + + +stage_14 + +universe-devel + + + +stage_6->stage_14 + + - + stage_8->stage_9 - - - - - -stage_8->stage_10 - - + + - + stage_8->stage_11 - - + + - + stage_8->stage_12 - - + + - + stage_8->stage_13 - - + + + + + +stage_8->stage_14 + + + + + +stage_9->stage_16 + + + + + +stage_9->stage_10 + + - + stage_9->stage_14 - - + + - - -stage_9->stage_13 - - + + +stage_15 + +universe-devel-cuda - + stage_10->stage_15 - - - - - -stage_10->stage_13 - - - - - -stage_11->stage_16 - - - - - -stage_11->stage_13 - - - - - -stage_12->stage_17 - - - - - -stage_12->stage_13 - - - - - -stage_13->stage_18 - - + + + + + +stage_10->stage_17 + + + + + +stage_11->stage_18 + + + + + +stage_11->stage_14 + + + + + +stage_12->stage_19 + + + + + +stage_12->stage_14 + + + + + +stage_13->stage_20 + + + + + +stage_13->stage_14 + + + + + +stage_14->stage_21 + + + + + +stage_14->stage_15 + + + + + +stage_15->stage_22 + + diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl new file mode 100644 index 00000000000..87aa27df879 --- /dev/null +++ b/docker/docker-bake-cuda.hcl @@ -0,0 +1,38 @@ +group "default" { + targets = [ + "universe-sensing-perception-devel-cuda", + "universe-sensing-perception-cuda", + "universe-devel-cuda", + "universe-cuda" + ] +} + +// For docker/metadata-action +target "docker-metadata-action-universe-sensing-perception-devel-cuda" {} +target "docker-metadata-action-universe-sensing-perception-cuda" {} +target "docker-metadata-action-universe-devel-cuda" {} +target "docker-metadata-action-universe-cuda" {} + +target "universe-sensing-perception-devel-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-devel-cuda" +} + +target "universe-sensing-perception-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-cuda" +} + +target "universe-devel-cuda" { + inherits = ["docker-metadata-action-universe-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-devel-cuda" +} + +target "universe-cuda" { + inherits = ["docker-metadata-action-universe-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-cuda" +} From a0d3fca30590e1172fb63fda2c0acfadb296770b Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Mon, 11 Nov 2024 22:29:11 +0900 Subject: [PATCH 08/20] chore(.github): rename `bake-target` to `target-image` and add descriptions to args (#5413) * rename target-image and add descriptions Signed-off-by: Yutaka Kondo * fix feedback Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .../docker-build-and-push-cuda/action.yaml | 18 +++++----- .../actions/docker-build-and-push/action.yaml | 34 +++++++++---------- .github/actions/docker-build/action.yaml | 10 +++--- .../docker-build-and-push-arm64.yaml | 4 +-- .github/workflows/docker-build-and-push.yaml | 4 +-- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml index 59f5ccc3569..5bf46d0cc17 100644 --- a/.github/actions/docker-build-and-push-cuda/action.yaml +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -1,15 +1,15 @@ name: docker-build-and-push-cuda -description: Workflow do build and push CUDA images to registry. +description: Composite action to build and push CUDA images to registry. inputs: platform: - description: "" + description: Target platform. required: true - bake-target: - description: "" + target-image: + description: Target docker image name in the registry. required: true build-args: - description: "" + description: Additional build args. required: false runs: @@ -55,7 +55,7 @@ runs: id: meta-universe-sensing-perception-devel-cuda uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -67,7 +67,7 @@ runs: id: meta-universe-sensing-perception-cuda uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -79,7 +79,7 @@ runs: id: meta-universe-devel-cuda uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-devel-cuda-${{ inputs.platform }} type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -91,7 +91,7 @@ runs: id: meta-universe-cuda uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-cuda-${{ inputs.platform }} type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 0a064ee1acf..3e3bc857fea 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -1,15 +1,15 @@ name: docker-build-and-push -description: "" +description: Composite action to build and push non CUDA images to registry. inputs: platform: - description: "" + description: Target platform. required: true - bake-target: - description: "" + target-image: + description: Target docker image name in the registry. required: true build-args: - description: "" + description: Additional build args. required: false runs: @@ -68,7 +68,7 @@ runs: id: meta-base uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=base-${{ inputs.platform }} type=raw,value=base-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -80,7 +80,7 @@ runs: id: meta-core-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=core-devel-${{ inputs.platform }} type=raw,value=core-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -92,7 +92,7 @@ runs: id: meta-universe-sensing-perception-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-sensing-perception-devel-${{ inputs.platform }} type=raw,value=universe-sensing-perception-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -104,7 +104,7 @@ runs: id: meta-universe-sensing-perception uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-sensing-perception-${{ inputs.platform }} type=raw,value=universe-sensing-perception-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -116,7 +116,7 @@ runs: id: meta-universe-localization-mapping-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-localization-mapping-devel-${{ inputs.platform }} type=raw,value=universe-localization-mapping-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -128,7 +128,7 @@ runs: id: meta-universe-localization-mapping uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-localization-mapping-${{ inputs.platform }} type=raw,value=universe-localization-mapping-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -140,7 +140,7 @@ runs: id: meta-universe-planning-control-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-planning-control-devel-${{ inputs.platform }} type=raw,value=universe-planning-control-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -152,7 +152,7 @@ runs: id: meta-universe-planning-control uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-planning-control-${{ inputs.platform }} type=raw,value=universe-planning-control-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -164,7 +164,7 @@ runs: id: meta-universe-vehicle-system-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-vehicle-system-devel-${{ inputs.platform }} type=raw,value=universe-vehicle-system-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -176,7 +176,7 @@ runs: id: meta-universe-vehicle-system uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-vehicle-system-${{ inputs.platform }} type=raw,value=universe-vehicle-system-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -188,7 +188,7 @@ runs: id: meta-universe-devel uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-devel-${{ inputs.platform }} type=raw,value=universe-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} @@ -200,7 +200,7 @@ runs: id: meta-universe uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=universe-${{ inputs.platform }} type=raw,value=universe-${{ steps.date.outputs.date }}-${{ inputs.platform }} diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index bfb6383c208..9a6a6e7e140 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -1,16 +1,16 @@ name: docker-build -description: "" +description: Composite action to build images only. inputs: platform: - description: "" + description: Target platform. required: true cache-tag-suffix: - description: "" + description: Suffix of the target cache tag. required: true build-args: - description: "" - required: true + description: Additional build args. + required: false runs: using: composite diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 01d6be45f59..5fd899aaac1 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -51,7 +51,7 @@ jobs: uses: ./.github/actions/docker-build-and-push with: platform: arm64 - bake-target: autoware + target-image: autoware build-args: | *.platform=linux/arm64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} @@ -68,7 +68,7 @@ jobs: uses: ./.github/actions/docker-build-and-push-cuda with: platform: arm64 - bake-target: autoware + target-image: autoware build-args: | *.platform=linux/arm64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 232b78c6569..9815aa170f3 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -46,7 +46,7 @@ jobs: uses: ./.github/actions/docker-build-and-push with: platform: amd64 - bake-target: autoware + target-image: autoware build-args: | *.platform=linux/amd64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} @@ -63,7 +63,7 @@ jobs: uses: ./.github/actions/docker-build-and-push-cuda with: platform: amd64 - bake-target: autoware + target-image: autoware build-args: | *.platform=linux/amd64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} From 21aa0693d1e5b5856e3095f81536531c273fff5e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 12 Nov 2024 13:19:59 +0900 Subject: [PATCH 09/20] feat(docker): install CUDA development/runtime libraries only 1 time (#5419) * add base-cuda Signed-off-by: Yutaka Kondo * update svg Signed-off-by: Yutaka Kondo * not cache cuda packages Signed-off-by: Yutaka Kondo * push base-cuda image Signed-off-by: Yutaka Kondo * Update docker-build-and-push.yaml * Update docker-build-and-push-arm64.yaml * separate jobs Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .../docker-build-and-push-cuda/action.yaml | 26 + .../docker-build-and-push-arm64.yaml | 33 + .github/workflows/docker-build-and-push.yaml | 33 + docker/Dockerfile | 76 +- docker/Dockerfile.svg | 704 ++++++++++-------- docker/docker-bake-cuda.hcl | 8 + 6 files changed, 536 insertions(+), 344 deletions(-) diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml index 5bf46d0cc17..c64be7e3786 100644 --- a/.github/actions/docker-build-and-push-cuda/action.yaml +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -15,6 +15,19 @@ inputs: runs: using: composite steps: + - name: Install jq and vcstool + run: | + sudo apt-get -y update + sudo apt-get -y install jq python3-pip + pip install --no-cache-dir vcstool + shell: bash + + - name: Run vcs import + run: | + mkdir src + vcs import src < autoware.repos + shell: bash + - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 @@ -51,6 +64,18 @@ runs: run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT shell: bash + - name: Docker meta for autoware:base-cuda + id: meta-base-cuda + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=base-cuda-${{ inputs.platform }} + type=raw,value=base-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-base-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe-sensing-perception-devel-cuda id: meta-universe-sensing-perception-devel-cuda uses: docker/metadata-action@v5 @@ -112,6 +137,7 @@ runs: push: true files: | docker/docker-bake-cuda.hcl + ${{ steps.meta-base-cuda.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 5fd899aaac1..e8eba9440fe 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -61,6 +61,39 @@ jobs: *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-main *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:arm64-${{ github.ref_name }},mode=max + - name: Show disk space + if: always() + run: | + df -h + + docker-build-and-push-cuda: + needs: [load-env, docker-build-and-push] + runs-on: [self-hosted, linux, ARM64] + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Free disk space + uses: ./.github/actions/free-disk-space + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: | + *.env + *.repos + .github/actions/docker-build-and-push/action.yaml + .github/workflows/docker-build-and-push*.yaml + ansible-galaxy-requirements.yaml + ansible/** + docker/** + - name: Build 'Autoware' with CUDA if: ${{ steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 9815aa170f3..ad185aac5c5 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -56,6 +56,39 @@ jobs: *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-main *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:amd64-${{ github.ref_name }},mode=max + - name: Show disk space + if: always() + run: | + df -h + + docker-build-and-push-cuda: + needs: [load-env, docker-build-and-push] + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Free disk space + uses: ./.github/actions/free-disk-space + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: | + *.env + *.repos + .github/actions/docker-build-and-push/action.yaml + .github/workflows/docker-build-and-push*.yaml + ansible-galaxy-requirements.yaml + ansible/** + docker/** + - name: Build 'Autoware' with CUDA if: ${{ steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || diff --git a/docker/Dockerfile b/docker/Dockerfile index 19bb14cf97d..e5025e5d38a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,16 @@ RUN chmod +x /ros_entrypoint.sh ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM base AS base-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + ./setup-dev-env.sh -y --module base --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + # hadolint ignore=DL3006 FROM $BASE_IMAGE AS rosdep-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -258,6 +268,19 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-common-devel AS universe-common-devel-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Set up CUDA development environment +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-sensing-perception-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -290,17 +313,18 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe-sensing-perception-devel AS universe-sensing-perception-devel-cuda +FROM universe-common-devel-cuda AS universe-sensing-perception-devel-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" -# Set up CUDA development environment +# Install rosdep dependencies +COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt +# hadolint ignore=SC2002 RUN --mount=type=ssh \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ - && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + apt-get update \ + && cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -328,6 +352,8 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && du -sh ${CCACHE_DIR} && ccache -s \ && rm -rf /autoware/build +COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware + ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -474,17 +500,19 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe-devel AS universe-devel-cuda +FROM universe-common-devel-cuda AS universe-devel-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] -# Set up CUDA development environment +# Install rosdep dependencies +COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt +# hadolint ignore=SC2002 RUN --mount=type=ssh \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ - && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + apt-get update \ + && cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware +COPY --from=universe-devel /opt/autoware /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -508,7 +536,8 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -521,17 +550,20 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe-sensing-perception AS universe-sensing-perception-cuda +FROM base-cuda AS universe-sensing-perception-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up CUDA runtime environment and artifacts +# Set up runtime environment +COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ + && apt-get update \ + && cat /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ && apt-get autoremove -y && rm -rf "$HOME"/.cache \ && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ && find / -name "*.o" -type f -delete \ @@ -665,7 +697,8 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -678,17 +711,20 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe AS universe-cuda +FROM base-cuda AS universe-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up CUDA runtime environment and artifacts +# Set up runtime environment +COPY --from=rosdep-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ + && apt-get update \ + && cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ && apt-get autoremove -y && rm -rf "$HOME"/.cache \ && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ && find / -name "*.o" -type f -delete \ diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index 5d983ab1436..7ad00076c97 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -4,482 +4,538 @@ - - + + G - + cluster_legend - + key -FROM ...  -COPY --from=...  -RUN --mount=(.*)from=...  +FROM ...  +COPY --from=...  +RUN --mount=(.*)from=...  key2 -  -  -  +  +  +  key:e->key2:w - - + + key:e->key2:w - - + + key:e->key2:w - - + + external_image_0 - -$BASE_IMAGE + +$BASE_IMAGE stage_0 - -base + +base external_image_0->stage_0 - - + + - + -stage_1 - -rosdep-depend +stage_2 + +rosdep-depend - + -external_image_0->stage_1 - - +external_image_0->stage_2 + + - + -stage_7 - -core-devel +stage_1 + +base-cuda - + -stage_0->stage_7 - - +stage_0->stage_1 + + - + -stage_16 - -universe-sensing-perception +stage_8 + +core-devel - + -stage_0->stage_16 - - +stage_0->stage_8 + + stage_18 - -universe-localization-mapping + +universe-sensing-perception stage_0->stage_18 - - - - - -stage_19 - -universe-planning-control - - - -stage_0->stage_19 - - + + + - + stage_20 - -universe-vehicle-system + +universe-localization-mapping - + stage_0->stage_20 - - + - + stage_21 - -universe + +universe-planning-control - + stage_0->stage_21 - - - - - + + - - -stage_1->stage_7 - - + + +stage_22 + +universe-vehicle-system - + + +stage_0->stage_22 + + + + -stage_2 - -rosdep-universe-sensing-perception-depend +stage_23 + +universe - + -stage_1->stage_2 - - +stage_0->stage_23 + + + + + + +stage_2->stage_8 + + - + stage_3 - -rosdep-universe-localization-mapping-depend + +rosdep-universe-sensing-perception-depend - - -stage_1->stage_3 - - - + + +stage_2->stage_3 + + - + stage_4 - -rosdep-universe-planning-control-depend + +rosdep-universe-localization-mapping-depend - - -stage_1->stage_4 - - + + +stage_2->stage_4 + + - + stage_5 - -rosdep-universe-vehicle-system-depend + +rosdep-universe-planning-control-depend - - -stage_1->stage_5 - - + + +stage_2->stage_5 + + - + stage_6 - -rosdep-universe-depend + +rosdep-universe-vehicle-system-depend - - -stage_1->stage_6 - - + + +stage_2->stage_6 + + - - -stage_8 - -universe-common-devel + + +stage_7 + +rosdep-universe-depend - + -stage_1->stage_8 - - - - - -stage_7->stage_8 - - - - - -stage_17 - -universe-sensing-perception-cuda - - - -stage_16->stage_17 - - - - - -stage_22 - -universe-cuda - - - -stage_21->stage_22 - - - - - -stage_2->stage_16 - - +stage_2->stage_7 + + + - + stage_9 - -universe-sensing-perception-devel + +universe-common-devel stage_2->stage_9 - - + + - - -stage_10 - -universe-sensing-perception-devel-cuda + + +stage_19 + +universe-sensing-perception-cuda - - -stage_2->stage_10 - - - + + +stage_1->stage_19 + + + + + +stage_24 + +universe-cuda + + + +stage_1->stage_24 + + + + + +stage_8->stage_9 + + stage_3->stage_18 - - + + + + + +stage_3->stage_19 + + - + stage_11 - -universe-localization-mapping-devel + +universe-sensing-perception-devel - + stage_3->stage_11 - - - - - -stage_4->stage_19 - - + + - + stage_12 - -universe-planning-control-devel - - - -stage_4->stage_12 - - - - - -stage_5->stage_20 - - + +universe-sensing-perception-devel-cuda + + + +stage_3->stage_12 + + + + + + +stage_4->stage_20 + + + - + stage_13 - -universe-vehicle-system-devel + +universe-localization-mapping-devel - - -stage_5->stage_13 - - + + +stage_4->stage_13 + + - - -stage_6->stage_21 - + + +stage_5->stage_21 + + - + stage_14 - -universe-devel + +universe-planning-control-devel + + + +stage_5->stage_14 + + + + + +stage_6->stage_22 + + + - - -stage_6->stage_14 - - + + +stage_15 + +universe-vehicle-system-devel - - -stage_8->stage_9 - - - - - -stage_8->stage_11 - - - - - -stage_8->stage_12 - - - - - -stage_8->stage_13 - - + + +stage_6->stage_15 + + - + -stage_8->stage_14 - - +stage_7->stage_23 + + - - -stage_9->stage_16 - - - - + -stage_9->stage_10 - - +stage_7->stage_24 + + + - - -stage_9->stage_14 - - + + +stage_16 + +universe-devel - - -stage_15 - -universe-devel-cuda + + +stage_7->stage_16 + + - + + +stage_17 + +universe-devel-cuda + + + +stage_7->stage_17 + + + + -stage_10->stage_15 - - +stage_9->stage_11 + + - + -stage_10->stage_17 - - +stage_9->stage_13 + + - + + +stage_9->stage_14 + + + + +stage_9->stage_15 + + + + + +stage_9->stage_16 + + + + + +stage_10 + +universe-common-devel-cuda + + + +stage_9->stage_10 + + + + + stage_11->stage_18 - - + + - - -stage_11->stage_14 - - + + +stage_11->stage_12 + + + + + +stage_11->stage_16 + + - + stage_12->stage_19 - - + + - - -stage_12->stage_14 - - + + +stage_12->stage_17 + + - + stage_13->stage_20 - - + + - - -stage_13->stage_14 - - + + +stage_13->stage_16 + + - + stage_14->stage_21 - - + + - - -stage_14->stage_15 - - + + +stage_14->stage_16 + + - + stage_15->stage_22 - - + + + + + +stage_15->stage_16 + + + + + +stage_16->stage_23 + + + + + +stage_16->stage_17 + + + + + +stage_17->stage_24 + + + + + +stage_10->stage_12 + + + + + +stage_10->stage_17 + + diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl index 87aa27df879..44ec1142178 100644 --- a/docker/docker-bake-cuda.hcl +++ b/docker/docker-bake-cuda.hcl @@ -1,5 +1,6 @@ group "default" { targets = [ + "base-cuda", "universe-sensing-perception-devel-cuda", "universe-sensing-perception-cuda", "universe-devel-cuda", @@ -8,11 +9,18 @@ group "default" { } // For docker/metadata-action +target "docker-metadata-action-base-cuda" {} target "docker-metadata-action-universe-sensing-perception-devel-cuda" {} target "docker-metadata-action-universe-sensing-perception-cuda" {} target "docker-metadata-action-universe-devel-cuda" {} target "docker-metadata-action-universe-cuda" {} +target "base-cuda" { + inherits = ["docker-metadata-action-base-cuda"] + dockerfile = "docker/Dockerfile" + target = "base-cuda" +} + target "universe-sensing-perception-devel-cuda" { inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] dockerfile = "docker/Dockerfile" From e637867f30c970358abba99e8f058a2ad696d04d Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 12 Nov 2024 17:23:04 +0900 Subject: [PATCH 10/20] refactor(docker): replace the multiple `rosdep` commands with `resolve_rosdep_keys.sh`. (#5424) * run resolve_rosdep_keys.sh Signed-off-by: Yutaka Kondo * style(pre-commit): autofix * update .dockerignore Signed-off-by: Yutaka Kondo * chmod +x Signed-off-by: Yutaka Kondo * fix location Signed-off-by: Yutaka Kondo * remove rosdep update Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .dockerignore | 1 + docker/Dockerfile | 74 +++++---------------------- docker/scripts/resolve_rosdep_keys.sh | 14 +++++ 3 files changed, 29 insertions(+), 60 deletions(-) create mode 100755 docker/scripts/resolve_rosdep_keys.sh diff --git a/.dockerignore b/.dockerignore index ac26bde50a1..679e11b25ef 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ # Ignore Docker files docker !docker/etc +!docker/scripts # Ignore a part of files under src src/**/.* diff --git a/docker/Dockerfile b/docker/Dockerfile index e5025e5d38a..846b8e63d7b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,6 +52,8 @@ ARG ROS_DISTRO COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ COPY ansible/ /autoware/ansible/ +COPY docker/scripts/resolve_rosdep_keys.sh /autoware/resolve_rosdep_keys.sh +RUN chmod +x /autoware/resolve_rosdep_keys.sh WORKDIR /autoware RUN rm -f /etc/apt/apt.conf.d/docker-clean \ @@ -64,21 +66,13 @@ RUN --mount=type=ssh \ # Generate install package lists COPY src/core /autoware/src/core -RUN rosdep update && rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN rosdep update && /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-core-depend-packages.txt \ && cat /rosdep-core-depend-packages.txt COPY src/universe/external /autoware/src/universe/external COPY src/universe/autoware.universe/common /autoware/src/universe/autoware.universe/common -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-common-depend-packages.txt \ && cat /rosdep-universe-common-depend-packages.txt @@ -88,18 +82,10 @@ ARG ROS_DISTRO COPY src/universe/autoware.universe/perception /autoware/src/universe/autoware.universe/perception COPY src/universe/autoware.universe/sensing /autoware/src/universe/autoware.universe/sensing -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-sensing-perception-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-depend-packages.txt -RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-sensing-perception-exec-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-exec-depend-packages.txt @@ -109,18 +95,10 @@ ARG ROS_DISTRO COPY src/universe/autoware.universe/localization /autoware/src/universe/autoware.universe/localization COPY src/universe/autoware.universe/map /autoware/src/universe/autoware.universe/map -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-localization-mapping-depend-packages.txt \ && cat /rosdep-universe-localization-mapping-depend-packages.txt -RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-localization-mapping-exec-depend-packages.txt \ && cat /rosdep-universe-localization-mapping-exec-depend-packages.txt @@ -135,18 +113,10 @@ COPY src/universe/autoware.universe/map/map_loader /autoware/src/universe/autowa COPY src/universe/autoware.universe/map/autoware_map_projection_loader /autoware/src/universe/autoware.universe/map/autoware_map_projection_loader COPY src/universe/autoware.universe/sensing/autoware_pcl_extensions /autoware/src/universe/autoware.universe/sensing/autoware_pcl_extensions COPY src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor /autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-planning-control-depend-packages.txt \ && cat /rosdep-universe-planning-control-depend-packages.txt -RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-planning-control-exec-depend-packages.txt \ && cat /rosdep-universe-planning-control-exec-depend-packages.txt @@ -158,18 +128,10 @@ COPY src/universe/autoware.universe/vehicle /autoware/src/universe/autoware.univ COPY src/universe/autoware.universe/system /autoware/src/universe/autoware.universe/system COPY src/universe/autoware.universe/map/autoware_map_height_fitter /autoware/src/universe/autoware.universe/map/autoware_map_height_fitter COPY src/universe/autoware.universe/localization/autoware_pose2twist /autoware/src/universe/autoware.universe/localization/autoware_pose2twist -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-vehicle-system-depend-packages.txt \ && cat /rosdep-universe-vehicle-system-depend-packages.txt -RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-vehicle-system-exec-depend-packages.txt \ && cat /rosdep-universe-vehicle-system-exec-depend-packages.txt @@ -183,19 +145,11 @@ COPY src/sensor_component /autoware/src/sensor_component COPY src/sensor_kit /autoware/src/sensor_kit COPY src/universe /autoware/src/universe COPY src/vehicle /autoware/src/vehicle -RUN rosdep keys --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-depend-packages.txt \ && cat /rosdep-universe-depend-packages.txt -RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ - | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ - | grep -v '^#' \ - | sed 's/ \+/\n/g'\ - | sort \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-exec-depend-packages.txt \ && cat /rosdep-exec-depend-packages.txt diff --git a/docker/scripts/resolve_rosdep_keys.sh b/docker/scripts/resolve_rosdep_keys.sh new file mode 100755 index 00000000000..1615e9f68fe --- /dev/null +++ b/docker/scripts/resolve_rosdep_keys.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +function resolve_rosdep_keys() { + local src_path=$1 + local ros_distro=$2 + + rosdep keys --ignore-src --from-paths "$src_path" | + xargs rosdep resolve --rosdistro "$ros_distro" | + grep -v '^#' | + sed 's/ \+/\n/g' | + sort +} + +resolve_rosdep_keys "$@" From 7aed5b59a40dd2c1e963df3e26d752c8cc4efe7e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 12 Nov 2024 18:14:01 +0900 Subject: [PATCH 11/20] refactor(docker): replace the multiple `colcon` commands with `build_and_clean.sh`. (#5425) * run resolve_rosdep_keys.sh Signed-off-by: Yutaka Kondo * style(pre-commit): autofix * update .dockerignore Signed-off-by: Yutaka Kondo * chmod +x Signed-off-by: Yutaka Kondo * fix location Signed-off-by: Yutaka Kondo * remove rosdep update Signed-off-by: Yutaka Kondo * run build_and_clean.sh Signed-off-by: Yutaka Kondo * style(pre-commit): autofix --------- Signed-off-by: Yutaka Kondo Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docker/Dockerfile | 83 ++++--------------------------- docker/scripts/build_and_clean.sh | 18 +++++++ 2 files changed, 29 insertions(+), 72 deletions(-) create mode 100755 docker/scripts/build_and_clean.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 846b8e63d7b..40165e5c5f8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -158,6 +158,9 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" +COPY docker/scripts/build_and_clean.sh /autoware/build_and_clean.sh +RUN chmod +x /autoware/build_and_clean.sh + # Set up development environment and tools RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ @@ -177,15 +180,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -209,15 +204,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/external,target=/autoware/src/universe/external \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -254,15 +241,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing,target=/autoware/src/universe/autoware.universe/sensing \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -296,15 +275,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/autoware_cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/autoware_cuda_utils \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware @@ -330,15 +301,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-localization-mapping-depend,source=/autoware/src/universe/autoware.universe/map,target=/autoware/src/universe/autoware.universe/map \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware FROM universe-common-devel AS universe-planning-control-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -364,15 +327,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor,target=/autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -398,15 +353,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-vehicle-system-depend,source=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist,target=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -441,15 +388,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/vehicle,target=/autoware/src/vehicle \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && colcon build --cmake-args \ - " -Wno-dev" \ - " --no-warn-unused-cli" \ - --merge-install \ - --install-base /opt/autoware \ - --mixin release compile-commands ccache \ - && du -sh ${CCACHE_DIR} && ccache -s \ - && rm -rf /autoware/build /autoware/log + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] diff --git a/docker/scripts/build_and_clean.sh b/docker/scripts/build_and_clean.sh new file mode 100755 index 00000000000..53c968ef722 --- /dev/null +++ b/docker/scripts/build_and_clean.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +function build_and_clean() { + local ccache_dir=$1 + local install_base=$2 + + du -sh "$ccache_dir" && ccache -s && + colcon build --cmake-args \ + " -Wno-dev" \ + " --no-warn-unused-cli" \ + --merge-install \ + --install-base "$install_base" \ + --mixin release compile-commands ccache && + du -sh "$ccache_dir" && ccache -s && + rm -rf /autoware/build /autoware/log +} + +build_and_clean "$@" From fb38f169b2d9b3b514f1ee10599882c06be56c76 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 12 Nov 2024 20:11:50 +0900 Subject: [PATCH 12/20] refactor(docker): replace the multiple `rm -rf` commands with `cleanup_system.sh`. (#5426) --- docker/Dockerfile | 72 ++++---------------------------- docker/scripts/cleanup_system.sh | 18 ++++++++ 2 files changed, 27 insertions(+), 63 deletions(-) create mode 100755 docker/scripts/cleanup_system.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 40165e5c5f8..5534205363e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,6 +19,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ # Copy files COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ COPY ansible/ /autoware/ansible/ +COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh +RUN chmod +x /autoware/cleanup_system.sh WORKDIR /autoware # Set up base environment @@ -424,15 +426,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware @@ -457,15 +451,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware @@ -486,15 +472,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware @@ -519,15 +497,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-planning-control-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-planning-control-devel /opt/autoware /opt/autoware @@ -552,15 +522,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-vehicle-system-devel /opt/autoware /opt/autoware @@ -585,15 +547,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-devel /opt/autoware /opt/autoware @@ -618,15 +572,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get update \ && cat /tmp/rosdep-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ - && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ - && find / -name "*.o" -type f -delete \ - && find / -name "*.h" -type f -delete \ - && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ - /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ - /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO COPY --from=universe-devel-cuda /opt/autoware /opt/autoware diff --git a/docker/scripts/cleanup_system.sh b/docker/scripts/cleanup_system.sh new file mode 100755 index 00000000000..1e8d911becc --- /dev/null +++ b/docker/scripts/cleanup_system.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +function cleanup_system() { + local lib_dir=$1 + local ros_distro=$2 + + apt-get autoremove -y && rm -rf "$HOME"/.cache && + find /usr/lib/"$lib_dir"-linux-gnu -name "*.a" -type f -delete && + find / -name "*.o" -type f -delete && + find / -name "*.h" -type f -delete && + find / -name "*.hpp" -type f -delete && + rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ros_distro"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* +} + +cleanup_system "$@" From 98a9ab5417f5b800508d001316c82776d09565af Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 12 Nov 2024 21:11:02 +0900 Subject: [PATCH 13/20] fix(.github): fix `target-image` (#5428) fix target-image Signed-off-by: Yutaka Kondo --- .github/actions/docker-build-and-push-cuda/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml index c64be7e3786..fc28683d892 100644 --- a/.github/actions/docker-build-and-push-cuda/action.yaml +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -68,7 +68,7 @@ runs: id: meta-base-cuda uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.target-image }} tags: | type=raw,value=base-cuda-${{ inputs.platform }} type=raw,value=base-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} From 4408c542be1d6b0d40fb6ab7247850dbc7ac670f Mon Sep 17 00:00:00 2001 From: Esteve Fernandez <33620+esteve@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:15:28 +0100 Subject: [PATCH 14/20] chore: remove tvm_utility artifacts from Ansible tasks (#5427) Signed-off-by: Esteve Fernandez --- ansible/roles/artifacts/tasks/main.yaml | 26 ------------------------- 1 file changed, 26 deletions(-) diff --git a/ansible/roles/artifacts/tasks/main.yaml b/ansible/roles/artifacts/tasks/main.yaml index 02825a0d041..c4f7ede0089 100644 --- a/ansible/roles/artifacts/tasks/main.yaml +++ b/ansible/roles/artifacts/tasks/main.yaml @@ -402,29 +402,3 @@ dest: "{{ data_dir }}/traffic_light_fine_detector/tlr_labels.txt" mode: "644" checksum: sha256:a2a91f5fe9c2e68e3e3647a272bb9bb25cd07631a1990a3fb15efddce7691131 - -# tvm_utility -- name: Create tvm_utility/models directory inside {{ data_dir }} - ansible.builtin.file: - path: "{{ data_dir }}/tvm_utility/models" - mode: "755" - state: directory - -- name: Download yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz - become: true - ansible.builtin.get_url: - url: https://autoware-modelzoo.s3.us-east-2.amazonaws.com/models/3.0.0-20221221/yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz - dest: "{{ data_dir }}/tvm_utility/yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz" - mode: "644" - checksum: sha256:66b3ca668e577393b657fbe1ed626538d89ca3adccd5862de6c7fa190238dbca - -- name: Create yolo_v2_tiny folder in tvm_utility/models of {{ data_dir }} - ansible.builtin.file: - path: "{{ data_dir }}/tvm_utility/models/yolo_v2_tiny" - mode: "755" - state: directory - -- name: Extract yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz - ansible.builtin.unarchive: - src: "{{ data_dir }}/tvm_utility/yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz" - dest: "{{ data_dir }}/tvm_utility/models/yolo_v2_tiny" From 35911067370ca0130608f1fec3eafaab2a4ce8e6 Mon Sep 17 00:00:00 2001 From: Yukinari Hisaki <42021302+yhisaki@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:17:28 +0900 Subject: [PATCH 15/20] feat(.clang-tidy): add ExtraArgs (#5439) Signed-off-by: Y.Hisaki --- .clang-tidy | 3 +++ .clang-tidy-ci | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index 06c54854b5d..f5eccdf3cc7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -202,6 +202,9 @@ WarningsAsErrors: " HeaderFilterRegex: ^(?!\/usr)(?!\/opt) +ExtraArgs: + - -std=c++17 + FormatStyle: none CheckOptions: diff --git a/.clang-tidy-ci b/.clang-tidy-ci index 04a9f8bacce..c6dfcdb37c7 100644 --- a/.clang-tidy-ci +++ b/.clang-tidy-ci @@ -225,6 +225,9 @@ WarningsAsErrors: " HeaderFilterRegex: ^(?!\/usr)(?!\/opt) +ExtraArgs: + - -std=c++17 + CheckOptions: - key: bugprone-argument-comment.CommentBoolLiterals value: "0" From d1cae7e0a35bdead9619a859738be17d1387f148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Mon, 18 Nov 2024 12:01:17 +0300 Subject: [PATCH 16/20] docs(ansible): update role readme files (#5443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- ansible/roles/cuda/README.md | 34 +++++++++++++++++++++++-------- ansible/roles/dev_tools/README.md | 25 ++++++++--------------- ansible/roles/tensorrt/README.md | 22 +++++++------------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/ansible/roles/cuda/README.md b/ansible/roles/cuda/README.md index 57d638d1187..d669c573e91 100644 --- a/ansible/roles/cuda/README.md +++ b/ansible/roles/cuda/README.md @@ -1,6 +1,6 @@ # cuda -This role installs [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) following [this page](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network) and [this page](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions). +This role installs [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) following [this page](https://developer.nvidia.com/cuda-12-3-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network) and [this page](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions). This role also registers Vulkan, OpenGL, and OpenCL GPU vendors for future use. @@ -13,22 +13,36 @@ This role also registers Vulkan, OpenGL, and OpenCL GPU vendors for future use. ## Manual Installation -Follow these instructions to download and install the CUDA Toolkit and the corresponding NVIDIA Driver for Ubuntu 20.04. +### Version compatibility -For Universe, the `cuda_version` version can also be found in: -[../../playbooks/universe.yaml](../../playbooks/universe.yaml) +Autoware currently uses CUDA `12.3` and from this [CUDA Application Compatibility Support Matrix](https://docs.nvidia.com/deploy/cuda-compatibility/#use-the-right-compat-package) that only the NVIDIA driver version `545` is compatible with this version of CUDA. + +#### 🛠️ For Advanced Users + +⚠️ **Proceed with caution**: Avoid removing essential system components. + +To prevent conflicts during NVIDIA installation, we recommend completely removing old NVIDIA Drivers and CUDA by following this guide: [How can I uninstall a NVIDIA driver completely?](https://askubuntu.com/a/206289/761440). + +- **Important**: If you remove the previous NVIDIA drivers, ensure you install the recommended versions listed below **before restarting your system**. + +Once the drivers are installed correctly, you may safely restart your system. + +### CUDA Toolkit and Driver + +Follow these instructions to download and install the CUDA Toolkit. + +From: ```bash wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env -# From: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#network-repo-installation-for-ubuntu - os=ubuntu2204 wget https://developer.download.nvidia.com/compute/cuda/repos/$os/$(uname -m)/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update cuda_version_dashed=$(eval sed -e "s/[.]/-/g" <<< "${cuda_version}") -sudo apt-get -y install cuda-${cuda_version_dashed} +sudo apt-get -y install cuda-toolkit-${cuda_version_dashed} +sudo apt-get install -y cuda-drivers-545 ``` Perform the post installation actions: @@ -37,9 +51,13 @@ Perform the post installation actions: # Taken from: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc +``` + +### GPU Vendors -# Register Vulkan, OpenGL, and OpenCL GPU vendors +Register Vulkan, OpenGL, and OpenCL GPU vendors following the instructions below. +```bash # Create Vulkan directory sudo mkdir -p /etc/vulkan/icd.d sudo chmod 0755 /etc/vulkan/icd.d diff --git a/ansible/roles/dev_tools/README.md b/ansible/roles/dev_tools/README.md index 145c70f020b..89d51fbdc3b 100644 --- a/ansible/roles/dev_tools/README.md +++ b/ansible/roles/dev_tools/README.md @@ -12,34 +12,27 @@ This role installs optional development tools for Autoware. ## Inputs -| Name | Required | Description | -| ------------- | -------- | --------------------------------------- | -| clang-version | true | The version of clang-format to install. | -| ros-distro | true | The ROS distribution. | +| Name | Required | Description | +| ------------------------------- | -------- | --------------------------------------- | +| pre_commit_clang_format_version | true | The version of clang-format to install. | +| rosdistro | true | The ROS distribution. | ## Manual Installation ```bash -#!/bin/bash +# For the environment variables +wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env -# Update package lists sudo apt-get update -# Install Git LFS +sudo apt install python3-pip +sudo apt-get install -y golang +sudo apt-get install -y ros-${rosdistro}-plotjuggler-ros sudo apt-get install -y git-lfs # Setup Git LFS git lfs install -# Install pre-commit using pip3 pip3 install pre-commit - -# Install a specific version of clang-format using pip3 pip3 install clang-format==${pre_commit_clang_format_version} - -# Install Go -sudo apt-get install -y golang - -# Install PlotJuggler -sudo apt-get install -y ros-${ROS_DISTRO}-plotjuggler-ros ``` diff --git a/ansible/roles/tensorrt/README.md b/ansible/roles/tensorrt/README.md index 1df87cad89e..2a6c7d39232 100644 --- a/ansible/roles/tensorrt/README.md +++ b/ansible/roles/tensorrt/README.md @@ -1,6 +1,6 @@ # tensorrt -This role installs TensorRT and cuDNN following [this page](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing). +This role installs TensorRT and cuDNN following [the official NVIDIA TensorRT Installation Guide](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing). ## Inputs @@ -11,29 +11,16 @@ This role installs TensorRT and cuDNN following [this page](https://docs.nvidia. ## Manual Installation -For Universe, the `cudnn_version` and `tensorrt_version` variables should be copied from -[amd64.env](../../../amd64.env) or [arm64.env](../../../arm64.env) depending on the architecture used. - ```bash +# For the environment variables wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env -# Can also be found at: https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing - sudo apt-get install -y \ libcudnn8=${cudnn_version} \ libnvinfer8=${tensorrt_version} \ libnvinfer-plugin8=${tensorrt_version} \ libnvparsers8=${tensorrt_version} \ libnvonnxparsers8=${tensorrt_version} \ - -sudo apt-mark hold \ -libcudnn8 \ -libnvinfer8 \ -libnvinfer-plugin8 \ -libnvparsers8 \ -libnvonnxparsers8 - -sudo apt-get install -y \ libcudnn8-dev=${cudnn_version} \ libnvinfer-dev=${tensorrt_version} \ libnvinfer-plugin-dev=${tensorrt_version} \ @@ -43,6 +30,11 @@ libnvparsers-dev=${tensorrt_version} \ libnvonnxparsers-dev=${tensorrt_version} sudo apt-mark hold \ +libcudnn8 \ +libnvinfer8 \ +libnvinfer-plugin8 \ +libnvparsers8 \ +libnvonnxparsers8 \ libcudnn8-dev \ libnvinfer-dev \ libnvinfer-plugin-dev \ From ef7a992c52f54269a8b7773f6d26c218ec6081dd Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Mon, 18 Nov 2024 18:14:38 +0900 Subject: [PATCH 17/20] refactor(docker): replace the multiple `apt-get autoremove` commands with `cleanup_apt.sh`. (#5447) --- docker/Dockerfile | 56 +++++++++++++++++++++-------------- docker/scripts/cleanup_apt.sh | 11 +++++++ 2 files changed, 45 insertions(+), 22 deletions(-) create mode 100755 docker/scripts/cleanup_apt.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 5534205363e..1bf5b246c4b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,15 @@ FROM $BASE_IMAGE AS base SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO +# Copy files +COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ +COPY ansible/ /autoware/ansible/ +COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh +RUN chmod +x /autoware/cleanup_apt.sh +COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh +RUN chmod +x /autoware/cleanup_system.sh +WORKDIR /autoware + # Install apt packages and add GitHub to known hosts for private repositories RUN rm -f /etc/apt/apt.conf.d/docker-clean \ && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache @@ -12,23 +21,16 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ gosu \ ssh \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && /autoware/cleanup_apt.sh \ && mkdir -p ~/.ssh \ && ssh-keyscan github.com >> ~/.ssh/known_hosts -# Copy files -COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ -COPY ansible/ /autoware/ansible/ -COPY docker/scripts/cleanup_system.sh /autoware/cleanup_system.sh -RUN chmod +x /autoware/cleanup_system.sh -WORKDIR /autoware - # Set up base environment RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ ./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && /autoware/cleanup_apt.sh \ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc # Create entrypoint @@ -45,7 +47,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN --mount=type=ssh \ ./setup-dev-env.sh -y --module base --download-artifacts --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && /autoware/cleanup_apt.sh true # hadolint ignore=DL3006 FROM $BASE_IMAGE AS rosdep-depend @@ -54,6 +56,8 @@ ARG ROS_DISTRO COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ COPY ansible/ /autoware/ansible/ +COPY docker/scripts/cleanup_apt.sh /autoware/cleanup_apt.sh +RUN chmod +x /autoware/cleanup_apt.sh COPY docker/scripts/resolve_rosdep_keys.sh /autoware/resolve_rosdep_keys.sh RUN chmod +x /autoware/resolve_rosdep_keys.sh WORKDIR /autoware @@ -64,7 +68,7 @@ RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ ./setup-dev-env.sh -y rosdep \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && /autoware/cleanup_apt.sh # Generate install package lists COPY src/core /autoware/src/core @@ -169,7 +173,7 @@ RUN --mount=type=ssh \ ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers openadkit \ && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && /autoware/cleanup_apt.sh # Install rosdep dependencies COPY --from=rosdep-depend /rosdep-core-depend-packages.txt /tmp/rosdep-core-depend-packages.txt @@ -177,7 +181,7 @@ COPY --from=rosdep-depend /rosdep-core-depend-packages.txt /tmp/rosdep-core-depe RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-core-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && /autoware/cleanup_apt.sh RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \ @@ -196,9 +200,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-depend /rosdep-universe-common-depend-packages.txt /tmp/rosdep-universe-common-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-common-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -219,7 +224,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN --mount=type=ssh \ ./setup-dev-env.sh -y --module all --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && rm -rf "$HOME"/.cache + && /autoware/cleanup_apt.sh true ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -233,9 +238,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -257,9 +263,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -293,9 +300,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-depend-packages.txt /tmp/rosdep-universe-localization-mapping-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-localization-mapping-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -314,9 +322,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-depend-packages.txt /tmp/rosdep-universe-planning-control-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-planning-control-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -343,9 +352,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-depend-packages.txt /tmp/rosdep-universe-vehicle-system-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-vehicle-system-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ @@ -369,9 +379,10 @@ ENV CCACHE_DIR="/root/.ccache" COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware @@ -402,9 +413,10 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ && cat /tmp/rosdep-universe-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + && /autoware/cleanup_apt.sh COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware COPY --from=universe-devel /opt/autoware /opt/autoware diff --git a/docker/scripts/cleanup_apt.sh b/docker/scripts/cleanup_apt.sh new file mode 100755 index 00000000000..883df9ba8af --- /dev/null +++ b/docker/scripts/cleanup_apt.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +function cleanup() { + local remove_var_lib_apt_lists=false + apt-get autoremove -y && rm -rf "$HOME"/.cache + if "$remove_var_lib_apt_lists"; then + rm -rf /var/lib/apt/lists/* + fi +} + +cleanup "$@" From 0dd08838d0ebc154bf698ee1b8d157a456eb044f Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Mon, 18 Nov 2024 16:49:04 +0300 Subject: [PATCH 18/20] fix(docker): add autoware prefix to map_loader (#5451) add autoware prefix to map_loader Signed-off-by: Oguz Ozturk --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1bf5b246c4b..f6338b4a171 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -115,7 +115,7 @@ ARG ROS_DISTRO COPY src/universe/autoware.universe/control /autoware/src/universe/autoware.universe/control COPY src/universe/autoware.universe/planning /autoware/src/universe/autoware.universe/planning # TODO(youtalk): Remove COPYs when https://github.com/autowarefoundation/autoware.universe/issues/8805 is resolved -COPY src/universe/autoware.universe/map/map_loader /autoware/src/universe/autoware.universe/map/map_loader +COPY src/universe/autoware.universe/map/autoware_map_loader /autoware/src/universe/autoware.universe/map/autoware_map_loader COPY src/universe/autoware.universe/map/autoware_map_projection_loader /autoware/src/universe/autoware.universe/map/autoware_map_projection_loader COPY src/universe/autoware.universe/sensing/autoware_pcl_extensions /autoware/src/universe/autoware.universe/sensing/autoware_pcl_extensions COPY src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor /autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor @@ -332,7 +332,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/control,target=/autoware/src/universe/autoware.universe/control \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/planning,target=/autoware/src/universe/autoware.universe/planning \ # TODO(youtalk): Remove --mount options when https://github.com/autowarefoundation/autoware.universe/issues/8805 is resolved - --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/map/map_loader,target=/autoware/src/universe/autoware.universe/map/map_loader \ + --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/map/autoware_map_loader,target=/autoware/src/universe/autoware.universe/map/autoware_map_loader \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/map/autoware_map_projection_loader,target=/autoware/src/universe/autoware.universe/map/autoware_map_projection_loader \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/sensing/autoware_pcl_extensions,target=/autoware/src/universe/autoware.universe/sensing/autoware_pcl_extensions \ --mount=type=bind,from=rosdep-universe-planning-control-depend,source=/autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor,target=/autoware/src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor \ From 39f266a55269e8cfa1ad7d04d8495bded13da48a Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 19 Nov 2024 11:56:12 +0900 Subject: [PATCH 19/20] fix(docker): install CUDA developement libraries into `-devel-cuda` images (#5446) * remove --runtime option Signed-off-by: Yutaka Kondo * add cleanup_aptget Signed-off-by: Yutaka Kondo * chmod +x Signed-off-by: Yutaka Kondo * use script Signed-off-by: Yutaka Kondo * style(pre-commit): autofix * install to rosdep stage Signed-off-by: Yutaka Kondo * fix spell check Signed-off-by: Yutaka Kondo * MUST REVERT Signed-off-by: Yutaka Kondo * change order Signed-off-by: Yutaka Kondo * Revert "MUST REVERT" This reverts commit 3fb57f620876b2a7f8f00a797370d52eaa25d1dd. --------- Signed-off-by: Yutaka Kondo Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f6338b4a171..8e9c9532a98 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -222,7 +222,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Set up CUDA development environment # hadolint ignore=SC2002 RUN --mount=type=ssh \ - ./setup-dev-env.sh -y --module all --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ && pip uninstall -y ansible ansible-core \ && /autoware/cleanup_apt.sh true @@ -268,6 +268,8 @@ RUN --mount=type=ssh \ && cat /tmp/rosdep-universe-sensing-perception-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ && /autoware/cleanup_apt.sh +COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware + # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ # TODO(youtalk): Move CUDA related packages into a dedicated directory @@ -286,8 +288,6 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ && source /opt/autoware/setup.bash \ && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware -COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware - ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] From abb6b8d3061b5416f0b02ec41d57069aca289ef5 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 19 Nov 2024 21:05:57 +0900 Subject: [PATCH 20/20] feat: introduce `autoware-nightly.repos` (#5440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add autoware-nightly.repos Signed-off-by: Yutaka Kondo * add health-check-nightly Signed-off-by: Yutaka Kondo * fix inputs Signed-off-by: Yutaka Kondo * rename Signed-off-by: Yutaka Kondo * change chache condition Signed-off-by: Yutaka Kondo * update .repos Signed-off-by: Yutaka Kondo * vcs import with multiple repos files Signed-off-by: Yutaka Kondo * fix conditions Signed-off-by: Yutaka Kondo * refine Signed-off-by: Yutaka Kondo * style(pre-commit): autofix * remove comment Signed-off-by: Yutaka Kondo * wip Signed-off-by: Yutaka Kondo * Revert "wip" This reverts commit 65e89d1e32a1f591204d5004b1dddd87af99950f. * wip Signed-off-by: Yutaka Kondo * Update action.yaml Co-authored-by: M. Fatih Cırıt --------- Signed-off-by: Yutaka Kondo Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: M. Fatih Cırıt --- .github/actions/docker-build/action.yaml | 18 +++++-- .github/workflows/health-check-nightly.yaml | 58 +++++++++++++++++++++ autoware-nightly.repos | 37 +++++++++++++ 3 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/health-check-nightly.yaml create mode 100644 autoware-nightly.repos diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index 9a6a6e7e140..df338a836d0 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -8,6 +8,10 @@ inputs: cache-tag-suffix: description: Suffix of the target cache tag. required: true + additional-repos: + description: Additional target .repos file. + default: "" + required: false build-args: description: Additional build args. required: false @@ -31,9 +35,15 @@ runs: vcs import src < autoware.repos shell: bash + - name: Import additional repositories + if: ${{ inputs.additional-repos != '' }} + run: | + vcs import src < ${{ inputs.additional-repos }} + shell: bash + - name: Cache ccache uses: actions/cache@v4 - if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' && inputs.additional-repos == '' }} id: cache-ccache with: path: | @@ -44,7 +54,7 @@ runs: - name: Cache apt-get uses: actions/cache@v4 - if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' && inputs.additional-repos == '' }} id: cache-apt-get with: path: | @@ -55,7 +65,7 @@ runs: - name: Restore ccache uses: actions/cache/restore@v4 - if: ${{ github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' || inputs.additional-repos != '' }} with: path: | root-ccache @@ -65,7 +75,7 @@ runs: - name: Restore apt-get uses: actions/cache/restore@v4 - if: ${{ github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' || inputs.additional-repos != '' }} with: path: | var-cache-apt diff --git a/.github/workflows/health-check-nightly.yaml b/.github/workflows/health-check-nightly.yaml new file mode 100644 index 00000000000..f38836e5d1b --- /dev/null +++ b/.github/workflows/health-check-nightly.yaml @@ -0,0 +1,58 @@ +name: health-check-nightly + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + schedule: + - cron: 0 6 * * * + workflow_dispatch: + +jobs: + label-check: + uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1 + with: + label: tag:run-health-check + + load-env: + needs: label-check + if: ${{ needs.label-check.outputs.result == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + uses: ./.github/workflows/load-env.yaml + + docker-build-nightly: + needs: load-env + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Free disk space + uses: ./.github/actions/free-disk-space + + - name: Build 'Autoware' + uses: ./.github/actions/docker-build + with: + platform: amd64 + cache-tag-suffix: nightly + additional-repos: autoware-nightly.repos + build-args: | + ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=x86_64 + + - name: Show disk space + if: always() + run: | + df -h diff --git a/autoware-nightly.repos b/autoware-nightly.repos new file mode 100644 index 00000000000..0b58999fd41 --- /dev/null +++ b/autoware-nightly.repos @@ -0,0 +1,37 @@ +repositories: + core/autoware.core: + type: git + url: https://github.com/autowarefoundation/autoware.core.git + version: main + universe/autoware.universe: + type: git + url: https://github.com/autowarefoundation/autoware.universe.git + version: main + launcher/autoware_launch: + type: git + url: https://github.com/autowarefoundation/autoware_launch.git + version: main + sensor_kit/sample_sensor_kit_launch: + type: git + url: https://github.com/autowarefoundation/sample_sensor_kit_launch.git + version: main + sensor_kit/external/awsim_sensor_kit_launch: # TODO: Integrate into sample_sensor_kit_launch + type: git + url: https://github.com/tier4/awsim_sensor_kit_launch.git + version: main + sensor_kit/awsim_labs_sensor_kit_launch: + type: git + url: https://github.com/autowarefoundation/awsim_labs_sensor_kit_launch.git + version: main + sensor_kit/single_lidar_sensor_kit_launch: + type: git + url: https://github.com/autowarefoundation/single_lidar_sensor_kit_launch.git + version: main + vehicle/sample_vehicle_launch: + type: git + url: https://github.com/autowarefoundation/sample_vehicle_launch.git + version: main + vehicle/awsim_labs_vehicle_launch: + type: git + url: https://github.com/autowarefoundation/awsim_labs_vehicle_launch.git + version: main