From 810b20c293ca693533b27d650d7f0b30e3d0ef6f Mon Sep 17 00:00:00 2001 From: Scott Fryer <60462088+steelhead31@users.noreply.github.com> Date: Wed, 26 Jun 2024 11:36:44 +0100 Subject: [PATCH] WinPB: Update Wix Installation To Install SDK (#3624) * WinPB: Update Wix Installation To Install SDK and use correct windows become method. * Linter Fix. * Linter Fix: FQ Run As Method * WindowsPB: Remove redundant output var * WinPB: Update VS2022 CE Download Checksum --- .../roles/MSVS_2022/tasks/main.yml | 2 +- .../roles/WiX/tasks/main.yml | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2022/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2022/tasks/main.yml index 1d1638e9c6..52ae7f602f 100644 --- a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2022/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2022/tasks/main.yml @@ -94,7 +94,7 @@ - name: Download Visual Studio Community 2022 win_get_url: url: 'https://aka.ms/vs/17/release/vs_Community.exe' - checksum: d757db0e5ac12b73d1f1bad8f0de05f0974a268c6a720324ea93239c6872a94e + checksum: 5d75942b56df540a0325e764e7eb46498ec12e15b73adea05d8aa58d323efd90 checksum_algorithm: sha256 dest: 'C:\temp\vs_community22.exe' force: no diff --git a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/WiX/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/WiX/tasks/main.yml index d638610305..2b09eff7c9 100644 --- a/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/WiX/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/WiX/tasks/main.yml @@ -13,11 +13,38 @@ register: wix_installed tags: Wix +- name: Test if DotNet SDK is already installed + win_stat: + path: 'C:\\Program Files\dotnet\dotnet.exe' + register: dotnet_installed + tags: Wix + +- name: Download .NET Installer + win_get_url: + url: https://download.visualstudio.microsoft.com/download/pr/b6f19ef3-52ca-40b1-b78b-0712d3c8bf4d/426bd0d376479d551ce4d5ac0ecf63a5/dotnet-sdk-8.0.302-win-x64.exe + dest: 'C:\temp\dotnet-install.exe' + checksum: bc6019e0192edd180ca7b299a16b95327941b0b53806cdb125be194aea12492d + checksum_algorithm: sha256 + when: (not dotnet_installed.stat.exists) + tags: Wix + +- name: Install .NET SDK If dotnet not installed + raw: C:\temp\dotnet-install.exe /quiet + when: (not dotnet_installed.stat.exists) + tags: Wix + +- name: Test if WiX is already installed + win_stat: + path: 'C:\\Users\{{ Jenkins_Username }}\.dotnet/tools/wix' + register: wix_installed + tags: Wix + - name: Test WiX version # generates an output like 5.0.0+41e11442 win_shell: wix --version register: installed_wix_version become_user: "{{ Jenkins_Username }}" + become_method: ansible.builtin.runas become: true when: wix_installed.stat.exists tags: Wix @@ -25,6 +52,13 @@ - name: Install Wix Toolset when not installed or version is not correct win_shell: dotnet tool install --global wix --version {{ wix_version }} become_user: "{{ Jenkins_Username }}" + become_method: ansible.builtin.runas become: true when: (not wix_installed.stat.exists) or (installed_wix_version.stdout.find(wix_version) == -1) tags: Wix + +- name: Delete downloaded .NET installer + win_file: + path: 'C:\temp\dotnet-install.exe' + state: absent + tags: Wix