Permalink
Browse files
Update the build scripts to the latest version
- Loading branch information...
Showing
with
45 additions
and
3 deletions.
-
+32
−1
build.ps1
-
+13
−2
build.sh
|
|
@@ -1,3 +1,33 @@ |
|
|
+$ErrorActionPreference = "Stop"
|
|
|
+
|
|
|
+function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
|
|
|
+{
|
|
|
+ while($true)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Invoke-WebRequest $url -OutFile $downloadLocation
|
|
|
+ break
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ $exceptionMessage = $_.Exception.Message
|
|
|
+ Write-Host "Failed to download '$url': $exceptionMessage"
|
|
|
+ if ($retries -gt 0) {
|
|
|
+ $retries--
|
|
|
+ Write-Host "Waiting 10 seconds before retrying. Retries left: $retries"
|
|
|
+ Start-Sleep -Seconds 10
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $exception = $_.Exception
|
|
|
+ throw $exception
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
cd $PSScriptRoot
|
|
|
|
|
|
$repoFolder = $PSScriptRoot
|
|
|
@@ -20,7 +50,8 @@ if (!(Test-Path $buildFolder)) { |
|
|
|
|
|
$localZipFile="$tempFolder\korebuild.zip"
|
|
|
|
|
|
- Invoke-WebRequest $koreBuildZip -OutFile $localZipFile
|
|
|
+ DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6
|
|
|
+
|
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
|
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
|
|
|
|
|
|
|
|
|
@@ -18,7 +18,18 @@ if test ! -d $buildFolder; then |
|
|
|
|
|
localZipFile="$tempFolder/korebuild.zip"
|
|
|
|
|
|
- wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip /dev/null
|
|
|
+ retries=6
|
|
|
+ until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
|
|
|
+ do
|
|
|
+ echo "Failed to download '$koreBuildZip'"
|
|
|
+ if [ "$retries" -le 0 ]; then
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ retries=$((retries - 1))
|
|
|
+ echo "Waiting 10 seconds before retrying. Retries left: $retries"
|
|
|
+ sleep 10s
|
|
|
+ done
|
|
|
+
|
|
|
unzip -q -d $tempFolder $localZipFile
|
|
|
|
|
|
mkdir $buildFolder
|
|
|
@@ -32,4 +43,4 @@ if test ! -d $buildFolder; then |
|
|
fi
|
|
|
fi
|
|
|
|
|
|
-$buildFile -r $repoFolder "$@"
|
|
|
+$buildFile -r $repoFolder "$@"
|
0 comments on commit
1562360