Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Update dependencies from dotnet/arcade #442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20105.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20106.12">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>b65df96ccb820fd5f7ea226aeba310485f395130</Sha>
<Sha>50f7059d3a7a83ae1919516755b9ca92c67805e8</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ stages:
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PDBArtifacts/**
PdbArtifacts/**
BlobArtifacts/**
downloadPath: '$(Build.ArtifactStagingDirectory)'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ stages:
buildId: $(AzDOBuildId)
downloadType: 'specific'
itemPattern: |
PDBArtifacts/**
PdbArtifacts/**
BlobArtifacts/**
downloadPath: '$(Build.ArtifactStagingDirectory)'

Expand Down
48 changes: 37 additions & 11 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
# The following code block is protecting against concurrent access so that this function can
# be called in parallel.
if ($createSdkLocationFile) {
do {
do {
$sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName())
}
}
until (!(Test-Path $sdkCacheFileTemp))
Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot

try {
Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt'
} catch {
Expand Down Expand Up @@ -188,7 +188,33 @@ function GetDotNetInstallScript([string] $dotnetRoot) {
if (!(Test-Path $installScript)) {
Create-Directory $dotnetRoot
$ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit
Invoke-WebRequest "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" -OutFile $installScript

$maxRetries = 5
$retries = 1

$uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1"

while($true) {
try {
Write-Host "GET $uri"
Invoke-WebRequest $uri -OutFile $installScript
break
}
catch {
Write-Host "Failed to download '$uri'"
Write-Error $_.Exception.Message -ErrorAction Continue
}

if (++$retries -le $maxRetries) {
$delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff
Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)."
Start-Sleep -Seconds $delayInSeconds
}
else {
throw "Unable to download file in $maxRetries attempts."
}

}
}

return $installScript
Expand All @@ -198,12 +224,12 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
InstallDotNet $dotnetRoot $version $architecture
}

function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = '',
[string] $runtime = '',
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = '',
function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = '',
[string] $runtime = '',
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = '',
[string] $runtimeSourceFeedKey = '') {

$installScript = GetDotNetInstallScript $dotnetRoot
Expand Down Expand Up @@ -298,7 +324,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
$vsMajorVersion = $vsMinVersion.Major
$xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha"
}

$vsInstallDir = $null
if ($xcopyMSBuildVersion.Trim() -ine "none") {
$vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install
Expand Down
38 changes: 30 additions & 8 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi
# Configures warning treatment in msbuild.
warn_as_error=${warn_as_error:-true}

# True to attempt using .NET Core already that meets requirements specified in global.json
# True to attempt using .NET Core already that meets requirements specified in global.json
# installed on the machine instead of downloading one.
use_installed_dotnet_cli=${use_installed_dotnet_cli:-true}

Expand Down Expand Up @@ -172,7 +172,7 @@ function InstallDotNetSdk {
function InstallDotNet {
local root=$1
local version=$2

GetDotNetInstallScript "$root"
local install_script=$_GetDotNetInstallScript

Expand Down Expand Up @@ -218,6 +218,28 @@ function InstallDotNet {
}
}

function with_retries {
local maxRetries=5
local retries=1
echo "Trying to run '$@' for maximum of $maxRetries attempts."
while [[ $((retries++)) -le $maxRetries ]]; do
"$@"

if [[ $? == 0 ]]; then
echo "Ran '$@' successfully."
return 0
fi

timeout=$((2**$retries-1))
echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2
sleep $timeout
done

echo "Failed to execute '$@' for $maxRetries times." 1>&2

return 1
}

function GetDotNetInstallScript {
local root=$1
local install_script="$root/dotnet-install.sh"
Expand All @@ -230,13 +252,13 @@ function GetDotNetInstallScript {

# Use curl if available, otherwise use wget
if command -v curl > /dev/null; then
curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || {
with_retries curl "$install_script_url" -isSLv --retry 10 --create-dirs -o "$install_script" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
}
else
wget -q -O "$install_script" "$install_script_url" || {
else
with_retries wget -v -O "$install_script" "$install_script_url" || {
local exit_code=$?
Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')."
ExitWithExitCode $exit_code
Expand All @@ -251,11 +273,11 @@ function InitializeBuildTool {
if [[ -n "${_InitializeBuildTool:-}" ]]; then
return
fi

InitializeDotNetCli $restore

# return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild"
_InitializeBuildToolFramework="netcoreapp2.1"
}
Expand Down Expand Up @@ -319,7 +341,7 @@ function InitializeToolset {
if [[ "$binary_log" == true ]]; then
bl="/bl:$log_dir/ToolsetRestore.binlog"
fi

echo '<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' > "$proj"
MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file"

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"xcopy-msbuild": "16.3.0-alpha"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20105.2"
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20106.12"
}
}