unixPb: Install packages without using with_items#4368
Conversation
There was a problem hiding this comment.
Pull request overview
Replaces per-package with_items loops in the Common role of the Unix playbook with single calls that pass entire list variables to the package manager, intended to reduce playbook runtime by avoiding one yum/apt/zypper invocation per package (see issue #4367).
Changes:
- Converts most
package: "name={{ item }} state=latest"+with_itemspatterns to inline free-formpackage: "name={{ SomeList }} state=latest"across Linux/BSD task files. - Converts a few package/homebrew tasks to dict form with
name: "{{ SomeList }}"(Wayland tasks, SLES s390x test tools, all macOS Homebrew/Cask installs). - Converts two RHEL8+ and two shared RHEL8+ helper tasks from
command: dnf -y install {{ item }}+with_itemstocommand: dnf -y install {{ SomeList }}.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Ubuntu.yml | Inlines list-based package: calls for OpenJFX, arch-specific, and Ubuntu-version-specific build/test tools. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Debian.yml | Same inline conversion for OpenJFX, gcc, arch-specific, Debian 8 packages. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/SLES.yml | Inline conversion for SLES 11/12/15 build tools and zypper SystemTap; uses dict form for s390x test tools. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/openSUSE.yml | Inline conversion for SUSE12 and SUSE x86 build tools. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/RedHat.yml | Inline package: and command: dnf -y install conversions; dict form for Wayland packages. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/Fedora.yml | Inline conversion for various RHEL/Fedora build tools and Java installs. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/CentOS.yml | Inline conversions for CentOS build/test tools; dict form for Wayland packages. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/FreeBSD.yml | Inline conversion for gcc compiler list. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml | Converts homebrew/homebrew_cask installs to dict form with list name:. |
| ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/build_packages_and_tools.yml | Inline conversion for Build/Test tool installs and RHEL8+ dnf commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Install additional build tools for RHEL8+ on x86 | ||
| command: dnf -y install {{ item }} | ||
| with_items: "{{ Additional_Build_Tools_RHEL_x86 }}" | ||
| command: dnf -y install {{ Additional_Build_Tools_RHEL_x86 }} |
| - name: Install additional build tools for RHEL8 and above | ||
| command: dnf -y install {{ item }} | ||
| with_items: "{{ Additional_Build_Tools_RHEL8Plus }}" | ||
| command: dnf -y install {{ Additional_Build_Tools_RHEL8Plus }} |
| - name: Install Build Tool Packages (RHEL8+) | ||
| command: dnf -y install {{ item }} | ||
| with_items: "{{ Build_Tool_Packages }}" | ||
| command: dnf -y install {{ Build_Tool_Packages }} |
| - name: Install Test Tool Packages ( RHEL8+ ) | ||
| command: dnf -y install {{ item }} | ||
| with_items: "{{ Test_Tool_Packages }}" | ||
| command: dnf -y install {{ Test_Tool_Packages }} |
| package: "name={{ Build_Tool_Packages }} state={{ package_var }}" | ||
| when: | ||
| - ansible_distribution != "RedHat" | ||
| tags: build_tools | ||
|
|
||
| - name: Install Build Tool Packages (Prior To RHEL8) | ||
| package: "name={{ item }} state={{ package_var }}" | ||
| with_items: "{{ Build_Tool_Packages }}" | ||
| package: "name={{ Build_Tool_Packages }} state={{ package_var }}" |
sxa
left a comment
There was a problem hiding this comment.
LGTM - I was hoping there was a more efficient way of doing this.
Not approving as we should ensure we have completed a VPC run first.
|
Theres not as much time saved in the workflow jobs as I thought, but we do skip certain tasks in the workflow jobs. This method saved me around 15mins when I was setting up the 2 new ppc64le linux machines. I ran the playbook with the changes on the second machine and noticed a significant difference in the runtime of the Common role. Ill test this via awx and document the differences |
steelhead31
left a comment
There was a problem hiding this comment.
Looks good, I'll approve once the vpc run/testing is completed
karianna
left a comment
There was a problem hiding this comment.
@Haroon-Khel Not sure if the copilot recommendations make sense but perhaps resolve or close those as well
Re #4367