aboutsummaryrefslogtreecommitdiffstats
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2020-04-16 23:31:47 +0100
committerDaniel Stone <[email protected]>2020-04-19 12:55:02 +0100
commite6c7bdc85138abe00bc9db355f302778926b38e5 (patch)
treee19de329036826c062aaacfa07c877be6772e581 /.gitlab-ci
parentec1b96fdc8bccaf2c1a4e1e3cca32b4aacbe4f7c (diff)
ci/windows: Make Chocolatey installs more reliable
Chocolatey installs depend on downloading binaries from SourceForge, which is an unreliable host: container builds often fail because it cannot pick up winflexbison. Add a loop to retry chocolatey installs if any installs have failed, and ensure Python is in the accessible PowerShell path rather than relying on the path being externally refreshed. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4631>
Diffstat (limited to '.gitlab-ci')
-rw-r--r--.gitlab-ci/windows/mesa_deps.ps140
1 files changed, 30 insertions, 10 deletions
diff --git a/.gitlab-ci/windows/mesa_deps.ps1 b/.gitlab-ci/windows/mesa_deps.ps1
index d700d3e5d55..28499e484ce 100644
--- a/.gitlab-ci/windows/mesa_deps.ps1
+++ b/.gitlab-ci/windows/mesa_deps.ps1
@@ -4,12 +4,40 @@ Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://cho
Import-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1"
Update-SessionEnvironment
Write-Host "Installing Chocolatey packages"
-choco install --allow-empty-checksums -y cmake --installargs "ADD_CMAKE_TO_PATH=System"
-choco install --allow-empty-checksums -y python3 git git-lfs ninja pkgconfiglite winflexbison
+
+# Chocolatey tries to download winflexbison from SourceForge, which is not super reliable, and has no retry
+# loop of its own - so we give it a helping hand here
+For ($i = 0; $i -lt 5; $i++) {
+ choco install -y python3 --params="/InstallDir:C:\python3"
+ $python_install = $?
+ choco install --allow-empty-checksums -y cmake git git-lfs ninja pkgconfiglite winflexbison
+ $other_install = $?
+ $choco_installed = $other_install -and $python_install
+ if ($choco_installed) {
+ Break
+ }
+}
+
+if (!$choco_installed) {
+ Write-Host "Couldn't install dependencies from Chocolatey"
+ Exit 1
+}
+
+# Add Chocolatey's native install path
Update-SessionEnvironment
+# Python adds itself to the system environment path, which doesn't get refreshed until we start a new shell
+$env:PATH = "C:\python3;C:\python3\scripts;$env:PATH"
Start-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false'
+Get-Date
+Write-Host "Installing Meson and Mako"
+pip3 install meson mako
+if (!$?) {
+ Write-Host "Failed to install dependencies from pip"
+ Exit 1
+}
+
# we want more secure TLS 1.2 for most things, but it breaks SourceForge
# downloads so must be done after Chocolatey use
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
@@ -25,14 +53,6 @@ Get-Date
Write-Host "Installing Visual Studio 2019"
Start-Process -NoNewWindow -Wait C:\vs_buildtools.exe -ArgumentList '--wait --quiet --norestart --nocache --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Graphics.Tools --add Microsoft.VisualStudio.Component.Windows10SDK.18362 --includeRecommended'
Remove-Item C:\vs_buildtools.exe -Force
-Get-Item C:\BuildTools | Out-Host
-
-Get-Date
-Write-Host "Installing Meson"
-Start-Process -NoNewWindow -Wait pip3 -ArgumentList 'install meson'
-
-Write-Host "Installing Mako"
-Start-Process -NoNewWindow -Wait pip3 -ArgumentList 'install mako'
Get-Date
Write-Host "Complete"