diff --git a/ansible/pbTestScripts/vagrantPlaybookCheck.sh b/ansible/pbTestScripts/vagrantPlaybookCheck.sh old mode 100755 new mode 100644 index 62a87c2ccf..2a38b17c24 --- a/ansible/pbTestScripts/vagrantPlaybookCheck.sh +++ b/ansible/pbTestScripts/vagrantPlaybookCheck.sh @@ -13,6 +13,7 @@ vmHalt=true cleanWorkspace=false newVagrantFiles=false fastMode=false +useAdopt=false skipFullSetup='' jdkToBuild='' buildHotspot='' @@ -51,6 +52,8 @@ processArgs() newVagrantFiles=true;; "--skip-more" | "-sm" ) fastMode=true;; + "--use-adopt" | "-ua" ) + useAdopt=true;; "--build-fork" | "-bf" ) buildFork="--fork $1"; shift;; "--build-branch" | "-bb" ) @@ -86,6 +89,7 @@ usage() --no-halt | -nh Option to stop the vagrant VMs halting --new-vagrant-files | -nv Use vagrantfiles from the the specified git repository --skip-more | -sm Run playbook faster by excluding things not required by buildJDK + --use-adopt | -ua Use the local Adoptium vagrantfile instead of the standard (.Adopt extension on Vagrantfile) --help | -h Displays this help message -V Apply verbose option to 'ansible-playbook', up to '-VVVV'" } @@ -134,13 +138,43 @@ checkVars() skipFullSetup=",nvidia_cuda_toolkit" case "$jdkToBuild" in "jdk8" ) - skipFullSetup="$skipFullSetup,MSVS_2017"; + skipFullSetup="$skipFullSetup,MSVS_2017,MSVS_2019,MSVS_2022"; if [ "$buildHotspot" != "" ]; then - skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1" + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2017,MSVS_2019,MSVS_2022" + fi + ;; + "jdk11" ) + skipFullSetup="$skipFullSetup,MSVS_2013,MSVS_2019,MSVS_2022"; + if [ "$buildHotspot" != "" ]; then + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013,MSVS_2019,MSVS_2022" + fi + ;; + "jdk17" ) + skipFullSetup="$skipFullSetup,MSVS_2013,MSVS_2017,MSVS_2022"; + if [ "$buildHotspot" != "" ]; then + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013,MSVS_2017,MSVS_2022" + fi + ;; + "jdk21" ) + skipFullSetup="$skipFullSetup,MSVS_2013,MSVS_2017,MSVS_2019"; + if [ "$buildHotspot" != "" ]; then + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013,MSVS_2017,MSVS_2019" + fi + ;; + "jdk22" ) + skipFullSetup="$skipFullSetup,MSVS_2013,MSVS_2017,MSVS_2019"; + if [ "$buildHotspot" != "" ]; then + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013,MSVS_2017,MSVS_2019" + fi + ;; + "jdk" ) + skipFullSetup="$skipFullSetup,MSVS_2013,MSVS_2017,MSVS_2019"; + if [ "$buildHotspot" != "" ]; then + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013,MSVS_2017,MSVS_2019" fi ;; *) - skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1,MSVS_2013";; + skipFullSetup="$skipFullSetup,MSVS_2010,VS2010_SP1";; esac fi jdkToBuild="--version $jdkToBuild" @@ -164,6 +198,7 @@ checkVagrantOS() echo $vagrantOSList exit 1 fi + # The Windows VM is setup to use 5GB of memory, which can be an issue on machines with only 8GB installed. # See: https://github.com/adoptium/infrastructure/pull/1532#issue-481189847 if [[ "$vagrantOS" == "Win2012" && $(free | awk '/Mem:/ { print $2 }') -lt 8000000 ]]; then @@ -220,6 +255,7 @@ startVMPlaybook() else ln -sf ${scriptPath%/*}/../vagrant/Vagrantfile.$OS Vagrantfile fi + # Copy the machine's ssh key for the VMs to use, after removing prior files rm -f id_rsa.pub id_rsa ssh-keygen -q -f $PWD/id_rsa -t rsa -N '' @@ -295,10 +331,21 @@ startVMPlaybookWin() local vagrantPort= cd $WORKSPACE/adoptopenjdkPBTests/${gitFork}-${newGitBranch}/ansible + if [ "$newVagrantFiles" = "true" ]; then - ln -sf vagrant/Vagrantfile.$OS Vagrantfile + if [[ "$useAdopt" == "true" ]] && [[ "$OS" == "Win2022" ]]; then + echo "Use Adoptium Box For Win2022" + ln -sf vagrant/Vagrantfile.$OS.Adopt Vagrantfile + else + ln -sf vagrant/Vagrantfile.$OS Vagrantfile + fi else - ln -sf ${scriptPath%/*}/../vagrant/Vagrantfile.$OS Vagrantfile + if [[ "$useAdopt" == "true" ]] && [[ "$OS" == "Win2022" ]]; then + echo "Use Adoptium Box For Win2022" + ln -sf ${scriptPath%/*}/../vagrant/Vagrantfile.$OS.Adopt Vagrantfile + else + ln -sf ${scriptPath%/*}/../vagrant/Vagrantfile.$OS Vagrantfile + fi fi # Remove the Hosts files if they're found 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 52ae7f602f..b71d52be21 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 @@ -61,6 +61,15 @@ dest: C:\TEMP when: (vs2022_layout_ready.stat.exists) + # When Installing From The Layout, We Need To Ensure the x86 installer is not detected. + - name: Rename x86 Installer When Installing VS2022 from the Adoptium Layout + win_shell: | + Rename-Item -Path "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer" -NewName "Installer.old" + args: + executable: powershell + creates: "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer.old" + when: (vs2022_layout_ready.stat.exists) + - name: Run Visual Studio 2022 Installer From Layout win_shell: | Start-Process -Wait -FilePath 'C:\temp\VSLayout2022\vs_community.exe' -ArgumentList '--nocache --quiet --norestart --wait --noweb --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --includeOptional --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.VisualStudio.Component.VC.MFC.ARM64' diff --git a/ansible/vagrant/Vagrantfile.Win2022.Adopt b/ansible/vagrant/Vagrantfile.Win2022.Adopt new file mode 100644 index 0000000000..c6f43c7426 --- /dev/null +++ b/ansible/vagrant/Vagrantfile.Win2022.Adopt @@ -0,0 +1,53 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Runs Powershell as an administator and does the following: +# - Gets/executes an Ansible provided script that configures WinRM to allow Ansible to communicate over it. +# - Resizes the disk to ~100GB, in line with the 'disksize.size = 100GB' option in the config below + +$script = <