From 439c8cdc03df6fe1944a1868de48610cc6d1be7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Thu, 16 Nov 2023 14:54:25 +0300 Subject: [PATCH] refactor(ansible): rename some variables to conform new lint rules (#3988) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .github/workflows/update-tool-versions.yaml | 4 ++-- ansible/playbooks/docker.yaml | 2 +- ansible/playbooks/universe.yaml | 6 +++--- ansible/roles/cuda/README.md | 2 +- ansible/roles/cuda/defaults/main.yaml | 2 +- ansible/roles/cuda/tasks/main.yaml | 2 +- ansible/roles/pre_commit/README.md | 12 ++++++------ ansible/roles/pre_commit/defaults/main.yaml | 2 +- ansible/roles/pre_commit/tasks/main.yaml | 2 +- ansible/roles/ros2/README.md | 14 +++++++------- ansible/roles/ros2/defaults/main.yaml | 2 +- ansible/roles/ros2/tasks/main.yaml | 4 ++-- ansible/roles/tensorrt/defaults/main.yaml | 2 +- ansible/roles/tensorrt/tasks/main.yaml | 4 ++-- setup-dev-env.sh | 8 ++++---- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/update-tool-versions.yaml b/.github/workflows/update-tool-versions.yaml index d69a3f3d8b0..513289ad93e 100644 --- a/.github/workflows/update-tool-versions.yaml +++ b/.github/workflows/update-tool-versions.yaml @@ -35,8 +35,8 @@ jobs: - name: Update clang-format version run: | - sd '(clang_format_version): .*' '$1: ${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/defaults/main.yaml - sd '(clang_format_version)=.*' '$1=${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/README.md + sd '(pre_commit_clang_format_version): .*' '$1: ${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/defaults/main.yaml + sd '(pre_commit_clang_format_version)=.*' '$1=${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/README.md - name: Create PR id: create-pr diff --git a/ansible/playbooks/docker.yaml b/ansible/playbooks/docker.yaml index 434d800c106..2302909c94b 100644 --- a/ansible/playbooks/docker.yaml +++ b/ansible/playbooks/docker.yaml @@ -21,7 +21,7 @@ when: prompt_install_nvidia != 'y' roles: - role: autoware.dev_env.cuda - when: prompt_install_nvidia == 'y' and install_devel == 'true' + when: prompt_install_nvidia == 'y' and tensorrt_install_devel == 'true' - role: autoware.dev_env.docker_engine - role: autoware.dev_env.nvidia_docker - role: autoware.dev_env.rocker diff --git a/ansible/playbooks/universe.yaml b/ansible/playbooks/universe.yaml index 9ffb57bed3c..3d09c9f259f 100644 --- a/ansible/playbooks/universe.yaml +++ b/ansible/playbooks/universe.yaml @@ -37,10 +37,10 @@ # Core - role: autoware.dev_env.autoware_core - role: autoware.dev_env.ccache - when: install_devel == 'true' + when: tensorrt_install_devel == 'true' - role: autoware.dev_env.plotjuggler - role: autoware.dev_env.pre_commit - when: install_devel == 'true' + when: tensorrt_install_devel == 'true' - role: autoware.dev_env.ros2 - role: autoware.dev_env.ros2_dev_tools - role: autoware.dev_env.rmw_implementation @@ -48,7 +48,7 @@ # Universe - role: autoware.dev_env.autoware_universe - role: autoware.dev_env.cuda - when: prompt_install_nvidia == 'y' and install_devel == 'true' + when: prompt_install_nvidia == 'y' and tensorrt_install_devel == 'true' - role: autoware.dev_env.pacmod when: rosdistro != 'rolling' - role: autoware.dev_env.tensorrt diff --git a/ansible/roles/cuda/README.md b/ansible/roles/cuda/README.md index b5075576055..9264489f701 100644 --- a/ansible/roles/cuda/README.md +++ b/ansible/roles/cuda/README.md @@ -7,7 +7,7 @@ This role installs [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) fol | Name | Required | Description | | -------------------- | -------- | -------------------------------- | | cuda_version | true | The version of CUDA Toolkit. | -| install_cuda_drivers | false | Whether to install cuda-drivers. | +| cuda_install_drivers | false | Whether to install cuda-drivers. | ## Manual Installation diff --git a/ansible/roles/cuda/defaults/main.yaml b/ansible/roles/cuda/defaults/main.yaml index 3488c01e83e..1945f8820bf 100644 --- a/ansible/roles/cuda/defaults/main.yaml +++ b/ansible/roles/cuda/defaults/main.yaml @@ -1 +1 @@ -install_cuda_drivers: true +cuda_install_drivers: true diff --git a/ansible/roles/cuda/tasks/main.yaml b/ansible/roles/cuda/tasks/main.yaml index 81dd8ada902..e4a3c2f4107 100644 --- a/ansible/roles/cuda/tasks/main.yaml +++ b/ansible/roles/cuda/tasks/main.yaml @@ -54,7 +54,7 @@ name: - cuda-drivers update_cache: true - when: install_cuda_drivers | bool + when: cuda_install_drivers | bool - name: Add PATH to .bashrc ansible.builtin.lineinfile: diff --git a/ansible/roles/pre_commit/README.md b/ansible/roles/pre_commit/README.md index 2eebce36c6d..5839f5d08ba 100644 --- a/ansible/roles/pre_commit/README.md +++ b/ansible/roles/pre_commit/README.md @@ -4,18 +4,18 @@ This role installs dependent tools for [pre-commit](https://pre-commit.com/). ## Inputs -| Name | Required | Description | -| -------------------- | -------- | --------------------------- | -| clang_format_version | false | The version of ClangFormat. | +| Name | Required | Description | +| ------------------------------- | -------- | --------------------------- | +| pre_commit_clang_format_version | false | The version of ClangFormat. | ## Manual Installation -The `clang_format_version` variable can also be found in: +The `pre_commit_clang_format_version` variable can also be found in: [./defaults/main.yaml](./defaults/main.yaml) ```bash -clang_format_version=17.0.4 -pip3 install pre-commit clang-format==${clang_format_version} +pre_commit_clang_format_version=17.0.4 +pip3 install pre-commit clang-format==${pre_commit_clang_format_version} sudo apt install golang ``` diff --git a/ansible/roles/pre_commit/defaults/main.yaml b/ansible/roles/pre_commit/defaults/main.yaml index b8afe445d6e..111748d7e90 100644 --- a/ansible/roles/pre_commit/defaults/main.yaml +++ b/ansible/roles/pre_commit/defaults/main.yaml @@ -1 +1 @@ -clang_format_version: 17.0.4 +pre_commit_clang_format_version: 17.0.4 diff --git a/ansible/roles/pre_commit/tasks/main.yaml b/ansible/roles/pre_commit/tasks/main.yaml index 6a69af8db76..bd185cc164e 100644 --- a/ansible/roles/pre_commit/tasks/main.yaml +++ b/ansible/roles/pre_commit/tasks/main.yaml @@ -7,7 +7,7 @@ - name: Install clang-format ansible.builtin.pip: name: clang-format - version: "{{ clang_format_version }}" + version: "{{ pre_commit_clang_format_version }}" executable: pip3 - name: Install Go diff --git a/ansible/roles/ros2/README.md b/ansible/roles/ros2/README.md index 0fd0ce65607..54fb39e0a94 100644 --- a/ansible/roles/ros2/README.md +++ b/ansible/roles/ros2/README.md @@ -16,14 +16,14 @@ $ apt-cache policy | grep universe ## Inputs -| Name | Required | Description | -| ----------------- | -------- | ------------------------------------------------ | -| rosdistro | true | The ROS distro. | -| installation_type | false | The installation type (`desktop` or `ros-base`). | +| Name | Required | Description | +| ---------------------- | -------- | ------------------------------------------------ | +| rosdistro | true | The ROS distro. | +| ros2_installation_type | false | The installation type (`desktop` or `ros-base`). | ## Manual Installation -The `installation_type` variable can also be found in: +The `ros2_installation_type` variable can also be found in: [./defaults/main.yaml](./defaults/main.yaml) For Universe, the `rosdistro` variable can also be found in: @@ -57,8 +57,8 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-a sudo apt update # Desktop Install -installation_type=desktop -sudo apt install ros-${rosdistro}-${installation_type} +ros2_installation_type=desktop +sudo apt install ros-${rosdistro}-${ros2_installation_type} # Environment setup # (Optional) You can source ros2 in the ~/.bashrc file. diff --git a/ansible/roles/ros2/defaults/main.yaml b/ansible/roles/ros2/defaults/main.yaml index fca2d3a0cdd..ad22b88e874 100644 --- a/ansible/roles/ros2/defaults/main.yaml +++ b/ansible/roles/ros2/defaults/main.yaml @@ -1 +1 @@ -installation_type: desktop +ros2_installation_type: desktop diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index 679f5dc4c90..ab77bb632c1 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -34,10 +34,10 @@ state: present update_cache: true -- name: Install ros-{{ rosdistro + '-' + installation_type }} +- name: Install ros-{{ rosdistro + '-' + ros2_installation_type }} become: true ansible.builtin.apt: - name: ros-{{ rosdistro }}-{{ installation_type }} + name: ros-{{ rosdistro }}-{{ ros2_installation_type }} state: latest update_cache: true diff --git a/ansible/roles/tensorrt/defaults/main.yaml b/ansible/roles/tensorrt/defaults/main.yaml index 8419eba6fa9..02edd251d82 100644 --- a/ansible/roles/tensorrt/defaults/main.yaml +++ b/ansible/roles/tensorrt/defaults/main.yaml @@ -1 +1 @@ -install_devel: true +tensorrt_install_devel: true diff --git a/ansible/roles/tensorrt/tasks/main.yaml b/ansible/roles/tensorrt/tasks/main.yaml index 9e9d80d05c3..df85ae75bb5 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: tensorrt_install_devel | bool # 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: tensorrt_install_devel | bool diff --git a/setup-dev-env.sh b/setup-dev-env.sh index 42c714b7b9b..14f215ef6f2 100755 --- a/setup-dev-env.sh +++ b/setup-dev-env.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Set up development environment for Autoware Core/Universe. -# Usage: setup-dev-env.sh [-y] [-v] [--no-nvidia] +# Usage: setup-dev-env.sh [-y] [-v] [--no-nvidia] # Note: -y option is only for CI. set -e @@ -90,11 +90,11 @@ fi # Check installation of dev package if [ "$option_runtime" = "true" ]; then - ansible_args+=("--extra-vars" "install_devel=false") + ansible_args+=("--extra-vars" "tensorrt_install_devel=false") # ROS installation type, default "desktop" - ansible_args+=("--extra-vars" "installation_type=ros-base") + ansible_args+=("--extra-vars" "ros2_installation_type=ros-base") else - ansible_args+=("--extra-vars" "install_devel=true") + ansible_args+=("--extra-vars" "tensorrt_install_devel=true") fi ansible_args+=("--extra-vars" "data_dir=$option_data_dir")