diff --git a/images.CI/build-image.ps1 b/images.CI/build-image.ps1 index 24d4a4d54..7592ffd1d 100644 --- a/images.CI/build-image.ps1 +++ b/images.CI/build-image.ps1 @@ -54,6 +54,7 @@ packer build -var "capture_name_prefix=$ResourcesNamePrefix" ` -var "virtual_network_name=$VirtualNetworkName" ` -var "virtual_network_resource_group_name=$VirtualNetworkRG" ` -var "virtual_network_subnet_name=$VirtualNetworkSubnet" ` + -var "run_validation_diskspace=$env:RUN_VALIDATION_FLAG" ` $TemplatePath ` | Where-Object { #Filter sensitive data from Packer logs diff --git a/images/linux/scripts/installers/validate-disk-space.sh b/images/linux/scripts/installers/validate-disk-space.sh index 79a589ddc..ffe366c74 100644 --- a/images/linux/scripts/installers/validate-disk-space.sh +++ b/images/linux/scripts/installers/validate-disk-space.sh @@ -8,6 +8,12 @@ availableSpaceMB=$(df / -hm | sed 1d | awk '{ print $4}') minimumFreeSpaceMB=17800 echo "Available disk space: $availableSpaceMB MB" + +if [ $RUN_VALIDATION != "true" ]; then + echo "Skipping validation disk space..." + exit 0 +fi + if [ $availableSpaceMB -le $minimumFreeSpaceMB ]; then echo "Not enough disk space on the image (minimum available space: $minimumFreeSpaceMB MB)" exit 1 diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index e03b63f54..a493a3302 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -24,6 +24,7 @@ "image_version": "dev", "image_os": "ubuntu16", "github_feed_token": null, + "run_validation_diskspace": "false", "go_default": "1.14", "go_versions": "1.11 1.12 1.13 1.14" }, @@ -344,6 +345,9 @@ "type": "shell", "scripts":[ "{{template_dir}}/scripts/installers/validate-disk-space.sh" + ], + "environment_vars": [ + "RUN_VALIDATION={{user `run_validation_diskspace`}}" ] }, { diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 7ceff4a93..89a024d34 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -24,6 +24,7 @@ "image_version": "dev", "image_os": "ubuntu18", "github_feed_token": null, + "run_validation_diskspace": "false", "go_default": "1.14", "go_versions": "1.11 1.12 1.13 1.14" }, @@ -348,6 +349,9 @@ "type": "shell", "scripts":[ "{{template_dir}}/scripts/installers/validate-disk-space.sh" + ], + "environment_vars": [ + "RUN_VALIDATION={{user `run_validation_diskspace`}}" ] }, { diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 795ebd4b5..6afa6c44d 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -454,6 +454,12 @@ "elevated_user": "{{user `install_user`}}", "elevated_password": "{{user `install_password`}}" }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-VSWhere.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -954,6 +960,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-VSWhere.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index dcf417386..f91f6b3db 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -10,8 +10,11 @@ $origPath = $env:PATH $gitPath = "$env:ProgramFiles\Git" -# get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/ -$msys2Uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" +$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest" + +$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object { + $_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url + $msys2File = "$env:TEMP\msys2.tar.xz" # Download the latest msys2 x86_64 @@ -19,13 +22,17 @@ Write-Host "Starting msys2 download" (New-Object System.Net.WebClient).DownloadFile($msys2Uri, $msys2File) Write-Host "Finished download" -$msys2FileU = "/$msys2File".replace(':', '') +# nix style path for tar +$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/') + +# Git tar needs exe's from mingw64\bin +$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath" $tar = "$gitPath\usr\bin\tar.exe" # extract tar.xz to C:\ -Write-Host "Starting msys2 extraction" -&$tar -Jxf $msys2FileU -C /c/ +Write-Host "Starting msys2 extraction from $msys2FileU" +&$tar -xJf $msys2FileU -C /c/ Remove-Item $msys2File Write-Host "Finished extraction" diff --git a/images/win/scripts/Installers/Validate-Msys2.ps1 b/images/win/scripts/Installers/Validate-Msys2.ps1 index e7d2142a8..d1749c5d8 100644 --- a/images/win/scripts/Installers/Validate-Msys2.ps1 +++ b/images/win/scripts/Installers/Validate-Msys2.ps1 @@ -62,6 +62,8 @@ $gccVersion = Get-ToolVersion -ToolPath "$msys2mingwDir/gcc" -VersionLineNumber $tarVersion = Get-ToolVersion -ToolPath "$msys2BinDir/tar" -VersionLineNumber 0 $Description = @" +> _Note:_ MSYS2 is pre-installed on image but not added to PATH. + _Tool versions_ _pacman:_ $pacmanVersion
_bash:_ $bashVersion
diff --git a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 index 4aeee12bd..08d5e7ea2 100644 --- a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 @@ -94,7 +94,9 @@ $WorkLoads = '--allWorkloads --includeRecommended ' + ` '--add Microsoft.VisualStudio.Workload.Python ' + ` '--remove Component.CPython3.x64 ' + ` '--add Microsoft.VisualStudio.Workload.Universal ' + ` - '--add Microsoft.VisualStudio.Workload.VisualStudioExtension' + '--add Microsoft.VisualStudio.Workload.VisualStudioExtension ' + ` + '--add Component.MDD.Linux ' + ` + '--add Component.MDD.Linux.GCC.arm' $ReleaseInPath = "Enterprise" $BootstrapperUrl = "https://aka.ms/vs/16/release/vs_${ReleaseInPath}.exe"