diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 88a0679050c..10684147ef7 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -23,7 +23,7 @@ jobs: base_image_env: base_image lib_dir: aarch64 setup-args: --no-nvidia - additional-tag-suffix: -debug + additional-tag-suffix: "" - name: cuda base_image_env: base_image lib_dir: aarch64 diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index 842b1925e47..950a5cc8d90 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -23,7 +23,7 @@ jobs: base_image_env: base_image lib_dir: x86_64 setup-args: --no-nvidia - additional-tag-suffix: -debug + additional-tag-suffix: "" - name: cuda base_image_env: base_image lib_dir: x86_64 diff --git a/.github/workflows/setup-docker.yaml b/.github/workflows/setup-docker.yaml index 515002da06a..caca7bcc9ce 100644 --- a/.github/workflows/setup-docker.yaml +++ b/.github/workflows/setup-docker.yaml @@ -4,13 +4,8 @@ on: pull_request: jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - setup-docker: - needs: load-env runs-on: ubuntu-latest - container: ${{ needs.load-env.outputs.base-image }} steps: - name: Check out repository uses: actions/checkout@v4 diff --git a/.github/workflows/setup-universe.yaml b/.github/workflows/setup-universe.yaml index 1750d34b913..5840c359d52 100644 --- a/.github/workflows/setup-universe.yaml +++ b/.github/workflows/setup-universe.yaml @@ -4,13 +4,8 @@ on: pull_request: jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - setup-universe: - needs: load-env runs-on: ubuntu-latest - container: ${{ needs.load-env.outputs.base-image }} steps: - name: Check out repository uses: actions/checkout@v4 diff --git a/ansible/playbooks/openadk.yaml b/ansible/playbooks/openadk.yaml index b0f821c8323..bdb52e31c11 100644 --- a/ansible/playbooks/openadk.yaml +++ b/ansible/playbooks/openadk.yaml @@ -43,4 +43,4 @@ # ONNX files and other artifacts - role: autoware.dev_env.artifacts - when: module == 'dev-tools' or (module == 'all' and install_devel == 'false') + when: prompt_download_artifacts == 'y' diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index 656810b0e38..0a075de1cfb 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -83,61 +83,61 @@ - name: Create Vulkan directory become: true ansible.builtin.file: - path: "/etc/vulkan/icd.d" + path: /etc/vulkan/icd.d state: directory mode: "0755" - name: Create OpenGL directory become: true ansible.builtin.file: - path: "/etc/glvnd/egl_vendor.d" + path: /etc/glvnd/egl_vendor.d state: directory mode: "0755" - name: Create OpenCL directory become: true ansible.builtin.file: - path: "/etc/OpenCL/vendors" + path: /etc/OpenCL/vendors state: directory mode: "0755" - name: Register Vulkan GPU vendors become: true ansible.builtin.get_url: - url: "https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json" - dest: "/etc/vulkan/icd.d/nvidia_icd.json" + url: https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json + dest: /etc/vulkan/icd.d/nvidia_icd.json mode: "0644" - name: Set permissions for Vulkan GPU vendors become: true ansible.builtin.file: - path: "/etc/vulkan/icd.d/nvidia_icd.json" + path: /etc/vulkan/icd.d/nvidia_icd.json mode: "0644" - name: Register OpenGL GPU vendors become: true ansible.builtin.get_url: - url: "https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json" - dest: "/etc/glvnd/egl_vendor.d/10_nvidia.json" + url: https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json + dest: /etc/glvnd/egl_vendor.d/10_nvidia.json mode: "0644" - name: Set permissions for OpenGL GPU vendors become: true ansible.builtin.file: - path: "/etc/glvnd/egl_vendor.d/10_nvidia.json" + path: /etc/glvnd/egl_vendor.d/10_nvidia.json mode: "0644" - name: Register OpenCL GPU vendors become: true ansible.builtin.file: - path: "/etc/OpenCL/vendors/nvidia.icd" - state: "touch" + path: /etc/OpenCL/vendors/nvidia.icd + state: touch mode: "0644" - name: Set permissions for OpenCL GPU vendors become: true ansible.builtin.lineinfile: - path: "/etc/OpenCL/vendors/nvidia.icd" - line: "libnvidia-opencl.so.1" + path: /etc/OpenCL/vendors/nvidia.icd + line: libnvidia-opencl.so.1 create: true mode: "0644" diff --git a/ansible/roles/geographiclib/defaults/main.yaml b/ansible/roles/geographiclib/defaults/main.yaml index f2b553a52f4..e69de29bb2d 100644 --- a/ansible/roles/geographiclib/defaults/main.yaml +++ b/ansible/roles/geographiclib/defaults/main.yaml @@ -1 +0,0 @@ -module: dev-tools diff --git a/ansible/roles/geographiclib/tasks/main.yaml b/ansible/roles/geographiclib/tasks/main.yaml index e1337284104..c0c2a153eea 100644 --- a/ansible/roles/geographiclib/tasks/main.yaml +++ b/ansible/roles/geographiclib/tasks/main.yaml @@ -1,10 +1,3 @@ -- name: Install libqt5charts5-dev # remove this task after merging https://github.com/ros/rosdistro/pull/39705. - become: true - ansible.builtin.apt: - name: libqt5charts5-dev - state: latest - update_cache: true - - name: Install geographiclib-tools become: true ansible.builtin.apt: @@ -17,4 +10,4 @@ ansible.builtin.command: cmd: geographiclib-get-geoids egm2008-1 creates: /usr/share/GeographicLib/geoids/egm2008-1.pgm - when: module == 'dev-tools' or install_devel== 'false' + when: prompt_download_artifacts == 'y' diff --git a/ansible/roles/nvidia_docker/tasks/main.yaml b/ansible/roles/nvidia_docker/tasks/main.yaml index 4de0b4e30b3..b1197fd21cf 100644 --- a/ansible/roles/nvidia_docker/tasks/main.yaml +++ b/ansible/roles/nvidia_docker/tasks/main.yaml @@ -1,20 +1,17 @@ -# tasks file for nvidia-container-toolkit-installation - name: Add NVIDIA container toolkit GPG key become: true - ansible.builtin.shell: | - curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg + ansible.builtin.apt_key: + url: https://nvidia.github.io/libnvidia-container/gpgkey + state: present + keyring: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg - name: Add NVIDIA container toolkit repository become: true - ansible.builtin.shell: | - curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ - sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ - tee /etc/apt/sources.list.d/nvidia-container-toolkit.list - -- name: Update apt cache - become: true - ansible.builtin.apt: - update_cache: yes + ansible.builtin.apt_repository: + repo: deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) / + state: present + filename: nvidia-container-toolkit + update_cache: true - name: Install NVIDIA Container Toolkit become: true @@ -27,4 +24,11 @@ become: true ansible.builtin.shell: | nvidia-ctk runtime configure --runtime=docker + changed_when: true +- name: Restart docker daemon + become: true + ansible.builtin.systemd: + name: docker + state: restarted + changed_when: true diff --git a/ansible/roles/tensorrt/defaults/main.yaml b/ansible/roles/tensorrt/defaults/main.yaml index 8419eba6fa9..e69de29bb2d 100644 --- a/ansible/roles/tensorrt/defaults/main.yaml +++ b/ansible/roles/tensorrt/defaults/main.yaml @@ -1 +0,0 @@ -install_devel: true diff --git a/ansible/roles/tensorrt/tasks/main.yaml b/ansible/roles/tensorrt/tasks/main.yaml index 9e9d80d05c3..8e01abf1e8c 100644 --- a/ansible/roles/tensorrt/tasks/main.yaml +++ b/ansible/roles/tensorrt/tasks/main.yaml @@ -23,7 +23,7 @@ allow_change_held_packages: true allow_downgrade: true update_cache: true - when: install_devel | bool + when: install_devel == 'true' # apt-mark hold - name: Prevent CUDA-related packages from upgrading @@ -49,4 +49,4 @@ - libnvinfer-plugin-dev - libnvparsers-dev - libnvonnxparsers-dev - when: install_devel | bool + when: install_devel == 'true' diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index 5af80b6fdd3..ac1cb2c6eb2 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -84,7 +84,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Install development tools and artifacts RUN --mount=type=ssh \ - ./setup-dev-env.sh -y --module dev-tools openadk \ + ./setup-dev-env.sh -y --module dev-tools --download-artifacts openadk \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache @@ -108,10 +108,10 @@ ARG ROS_DISTRO ARG LIB_DIR ARG SETUP_ARGS -# Set up runtime environment +# Set up runtime environment and artifacts COPY autoware.repos /autoware/ RUN --mount=type=ssh \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers --runtime openadk \ + ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadk \ && pip uninstall -y ansible ansible-core \ && mkdir src \ && vcs import src < autoware.repos \ diff --git a/docker/autoware-openadk/etc/.bash_aliases b/docker/autoware-openadk/etc/.bash_aliases index 71b6ad2dcb3..f6200449b1c 100644 --- a/docker/autoware-openadk/etc/.bash_aliases +++ b/docker/autoware-openadk/etc/.bash_aliases @@ -1,3 +1,5 @@ +#!/bin/bash + # planning simulation function download_planning_map() { if [ ! -f ~/autoware_map/sample-map-planning.zip ]; then diff --git a/setup-dev-env.sh b/setup-dev-env.sh index 0050d9c13fd..985e51b10dc 100755 --- a/setup-dev-env.sh +++ b/setup-dev-env.sh @@ -5,6 +5,24 @@ set -e +# Function to print help message +print_help() { + echo "Usage: setup-dev-env.sh [OPTIONS]" + echo "Options:" + echo " --help Display this help message" + echo " -h Display this help message" + echo " -y Use non-interactive mode" + echo " -v Enable debug outputs" + echo " --no-nvidia Disable installation of the NVIDIA-related roles ('cuda' and 'tensorrt')" + echo " --no-cuda-drivers Disable installation of 'cuda-drivers' in the role 'cuda'" + echo " --runtime Disable installation dev package of role 'cuda' and 'tensorrt'" + echo " --data-dir Set data directory (default: $HOME/autoware_data)" + echo " --download-artifacts" + echo " Download artifacts" + echo " --module Specify the module (default: all)" + echo "" +} + SCRIPT_DIR=$(readlink -f "$(dirname "$0")") # Parse arguments @@ -13,6 +31,10 @@ option_data_dir="$HOME/autoware_data" while [ "$1" != "" ]; do case "$1" in + --help | -h) + print_help + exit 1 + ;; -y) # Use non-interactive mode. option_yes=true @@ -42,10 +64,6 @@ while [ "$1" != "" ]; do # Set download artifacts option option_download_artifacts=true ;; - --docker) - # Set download artifacts option - option_docker=true - ;; --module) option_module="$2" shift @@ -60,12 +78,6 @@ done # Select installation type target_playbook="autoware.dev_env.universe" # default -# Set-up docker environment -if [ "$option_docker" = "true" ]; then - target_playbook="autoware.dev_env.docker" - ansible_args+=("--extra-vars" "cuda_install_drivers=true") -fi - if [ ${#args[@]} -ge 1 ]; then target_playbook="autoware.dev_env.${args[0]}" fi @@ -115,7 +127,12 @@ else fi # Check downloading artifacts -if [ "$option_yes" = "true" ] || [ "$option_download_artifacts" = "true" ]; then +if [ "$target_playbook" = "autoware.dev_env.openadk" ]; then + if [ "$option_download_artifacts" = "true" ]; then + echo -e "\e[36mArtifacts will be downloaded to $option_data_dir\e[m" + ansible_args+=("--extra-vars" "prompt_download_artifacts=y") + fi +elif [ "$option_yes" = "true" ] || [ "$option_download_artifacts" = "true" ]; then echo -e "\e[36mArtifacts will be downloaded to $option_data_dir\e[m" ansible_args+=("--extra-vars" "prompt_download_artifacts=y") fi