Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit c497bf4

Browse files
author
John Beisner
committed
Write a 'latest.coherent.version' file at blob storage so users have a 'coherent' option to SDK installations.
1 parent 3a5612f commit c497bf4

File tree

5 files changed

+103
-26
lines changed

5 files changed

+103
-26
lines changed

build/BundledRuntimes.props

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
<PropertyGroup>
3434
<AspNetCoreRuntimeInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion)</AspNetCoreRuntimeInstallerBlobRootUrl>
35-
35+
<AspNetCoreSharedRuntimeVersionFileName>runtime.version</AspNetCoreSharedRuntimeVersionFileName>
36+
<AspNetCoreSharedRuntimeVersionFile Condition=" '$(AspNetCoreSharedRuntimeVersionFileName)' != '' ">$(PackagesDirectory)/$(AspNetCoreSharedRuntimeVersionFileName)</AspNetCoreSharedRuntimeVersionFile>
37+
3638
<!-- Examples: Build.RS.linux.zip Build.RS.winx86.zip AspNetCorePackageStoreLibx64.wixlib -->
3739
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'win' ">$(HostOSName)$(Architecture)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
3840
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'osx' ">$(HostOSName)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
@@ -90,5 +92,12 @@
9092
<ExtractDestination>$(AspNetRuntimePackageStorePublishDirectory)</ExtractDestination>
9193
</_DownloadAndExtractItem>
9294

95+
<_DownloadAndExtractItem Include="AspNetCoreSharedRuntimeVersionFile"
96+
Condition="!Exists('$(AspNetCoreSharedRuntimeVersionFile)')">
97+
<Url>$(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreSharedRuntimeVersionFileName)</Url>
98+
<DownloadFileName>$(AspNetCoreSharedRuntimeVersionFile)</DownloadFileName>
99+
<ExtractDestination></ExtractDestination>
100+
</_DownloadAndExtractItem>
101+
93102
</ItemGroup>
94103
</Project>

build/publish/FinishBuild.targets

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Target Name="FinishBuild"
44
DependsOnTargets="CheckIfAllBuildsHavePublished;
5+
EvaluateRuntimeCoherence;
56
FinalizeBuild" />
67

78
<Target Name="CheckIfAllBuildsHavePublished">
@@ -14,21 +15,44 @@
1415
</CheckIfAllBuildsHavePublished>
1516
</Target>
1617

18+
<Target Name="EvaluateRuntimeCoherence"
19+
DependsOnTargets="ReadAspNetCoreSharedRuntimeVersionFile"
20+
BeforeTargets="FinalizeBuild">
21+
<PropertyGroup>
22+
<Coherent>false</Coherent>
23+
<Coherent Condition=" '$(CLI_SharedFrameworkVersion)' == '@(AspNetCoreSharedRuntimeVersion)' ">true</Coherent>
24+
</PropertyGroup>
25+
</Target>
26+
27+
<Target Name="ReadAspNetCoreSharedRuntimeVersionFile"
28+
DependsOnTargets="DownloadHostAndSharedFxArtifacts">
29+
<ItemGroup>
30+
<File Include="$(AspNetCoreSharedRuntimeVersionFile)" />
31+
</ItemGroup>
32+
<ReadLinesFromFile File="@(File)">
33+
<Output
34+
TaskParameter="Lines"
35+
ItemName="AspNetCoreSharedRuntimeVersion"/>
36+
</ReadLinesFromFile>
37+
</Target>
38+
1739
<Target Name="FinalizeBuild"
1840
Condition=" '$(HaveAllBuildsPublished)' == 'True' ">
1941
<CopyBlobsToLatest AccountName="$(ArtifactCloudDropAccountName)"
2042
AccountKey="$(ArtifactCloudDropAccessToken)"
2143
ContainerName="$(ArtifactContainerName)"
2244
NugetVersion="$(FullNugetVersion)"
2345
Channel="$(Channel)"
24-
CommitHash="$(CommitHash)" />
46+
CommitHash="$(CommitHash)"
47+
Coherent="$(Coherent)" />
2548

2649
<CopyBlobsToLatest AccountName="$(ChecksumCloudDropAccountName)"
2750
AccountKey="$(ChecksumCloudDropAccessToken)"
2851
ContainerName="$(ChecksumContainerName)"
2952
NugetVersion="$(FullNugetVersion)"
3053
Channel="$(Channel)"
31-
CommitHash="$(CommitHash)" />
54+
CommitHash="$(CommitHash)"
55+
Coherent="$(Coherent)" />
3256

3357
<UpdateVersionsRepo BranchName="$(BranchName)"
3458
PackagesDirectory="$(PackagesDirectory)"

build_projects/dotnet-cli-build/CopyBlobsToLatest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class CopyBlobsToLatest : Task
3131
[Required]
3232
public string NugetVersion { get; set; }
3333

34+
public bool Coherent { get; set; }
35+
3436
private AzurePublisher AzurePublisherTool
3537
{
3638
get
@@ -81,6 +83,10 @@ public override bool Execute()
8183

8284
string cliVersion = Utils.GetVersionFileContent(CommitHash, NugetVersion);
8385
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.version", cliVersion);
86+
if (Coherent == true)
87+
{
88+
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.coherent.version", cliVersion);
89+
}
8490
}
8591
finally
8692
{

scripts/obtain/dotnet-install.ps1

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@
1111
it will update it only if the requested version differs from the one already installed.
1212
.PARAMETER Channel
1313
Default: LTS
14-
Download from the Channel specified
14+
Download from the Channel specified. Possible values:
15+
- Current - most current release
16+
- LTS - most current supported release
17+
- 2-part version in a format A.B - represents a specific release
18+
examples: 2.0; 1.0
19+
- Branch name
20+
examples: release/2.0.0; Master
1521
.PARAMETER Version
1622
Default: latest
1723
Represents a build version on specific channel. Possible values:
1824
- latest - most latest build on specific channel
25+
- coherent - most latest coherent build on specific channel
26+
coherent applies only to SDK downloads
1927
- 3-part version in a format A.B.C - represents specific version of build
20-
examples: 2.0.0-preview2-006120; 1.1.0
28+
examples: 2.0.0-preview2-006120; 1.1.0
2129
.PARAMETER InstallDir
2230
Default: %LocalAppData%\Microsoft\dotnet
2331
Path to where to install dotnet. Note that binaries will be placed directly in a given directory.
@@ -28,8 +36,6 @@
2836
.PARAMETER SharedRuntime
2937
Default: false
3038
Installs just the shared runtime bits, not the entire SDK
31-
.PARAMETER DebugSymbols
32-
If set the installer will include symbols in the installation.
3339
.PARAMETER DryRun
3440
If set it will not perform installation but instead display what command line to use to consistently install
3541
currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link
@@ -60,7 +66,6 @@ param(
6066
[string]$InstallDir="<auto>",
6167
[string]$Architecture="<auto>",
6268
[switch]$SharedRuntime,
63-
[switch]$DebugSymbols, # TODO: Switch does not work yet. Symbols zip is not being uploaded yet.
6469
[switch]$DryRun,
6570
[switch]$NoPath,
6671
[string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet",
@@ -207,15 +212,20 @@ function GetHTTPResponse([Uri] $Uri)
207212
}
208213

209214

210-
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel) {
215+
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Coherent) {
211216
Say-Invocation $MyInvocation
212217

213218
$VersionFileUrl = $null
214219
if ($SharedRuntime) {
215220
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
216221
}
217222
else {
218-
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
223+
if ($Coherent) {
224+
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.coherent.version"
225+
}
226+
else {
227+
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
228+
}
219229
}
220230

221231
$Response = GetHTTPResponse -Uri $VersionFileUrl
@@ -239,7 +249,11 @@ function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel,
239249

240250
switch ($Version.ToLower()) {
241251
{ $_ -eq "latest" } {
242-
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel
252+
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $False
253+
return $LatestVersionInfo.Version
254+
}
255+
{ $_ -eq "coherent" } {
256+
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $True
243257
return $LatestVersionInfo.Version
244258
}
245259
default { return $Version }
@@ -464,14 +478,17 @@ if ($free.Freespace / 1MB -le 100 ) {
464478
}
465479

466480
$ZipPath = [System.IO.Path]::GetTempFileName()
467-
Say "Downloading $DownloadLink"
481+
Say-Verbose "Zip path: $ZipPath"
482+
Say "Downloading link: $DownloadLink"
468483
try {
469484
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
470485
}
471486
catch {
487+
Say "Cannot download: $DownloadLink"
472488
$DownloadLink = $LegacyDownloadLink
473489
$ZipPath = [System.IO.Path]::GetTempFileName()
474-
Say "Downloading $DownloadLink"
490+
Say-Verbose "Legacy zip path: $ZipPath"
491+
Say "Downloading legacy link: $DownloadLink"
475492
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
476493
}
477494

scripts/obtain/dotnet-install.sh

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ get_distro_specific_os_name() {
147147
fi
148148
fi
149149

150-
say_verbose "Distribution specific OS name + version could not be detected: $ID.$VERSION_ID"
150+
say_verbose "Distribution specific OS name and version could not be detected: $ID.$VERSION_ID"
151151
return 1
152152
}
153153

@@ -339,12 +339,17 @@ get_latest_version_info() {
339339
local azure_feed=$1
340340
local channel=$2
341341
local normalized_architecture=$3
342+
local coherent=$4
342343

343344
local version_file_url=null
344345
if [ "$shared_runtime" = true ]; then
345346
version_file_url="$uncached_feed/Runtime/$channel/latest.version"
346347
else
347-
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
348+
if [ "$coherent" = true ]; then
349+
version_file_url="$uncached_feed/Runtime/$channel/latest.coherent.version"
350+
else
351+
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
352+
fi
348353
fi
349354
say_verbose "get_latest_version_info: latest url: $version_file_url"
350355

@@ -368,7 +373,14 @@ get_specific_version_from_version() {
368373
case $version in
369374
latest)
370375
local version_info
371-
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture)" || return 1
376+
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture false)" || return 1
377+
say_verbose "get_specific_version_from_version: version_info=$version_info"
378+
echo "$version_info" | get_version_from_version_info
379+
return 0
380+
;;
381+
coherent)
382+
local version_info
383+
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture true)" || return 1
372384
say_verbose "get_specific_version_from_version: version_info=$version_info"
373385
echo "$version_info" | get_version_from_version_info
374386
return 0
@@ -647,13 +659,14 @@ install_dotnet() {
647659
# if the download fails, download the legacy_download_link
648660
if [ "$download_failed" = true ] && [ "$valid_legacy_download_link" = true ]; then
649661
say "Cannot download: $download_link"
662+
download_link=$legacy_download_link
650663
zip_path=$(mktemp $temporary_file_template)
651664
say_verbose "Legacy zip path: $zip_path"
652-
say "Downloading legacy link: $legacy_download_link"
653-
download "$legacy_download_link" $zip_path
665+
say "Downloading legacy link: $download_link"
666+
download "$download_link" $zip_path
654667
fi
655668

656-
say "Extracting zip"
669+
say "Extracting zip from $download_link"
657670
extract_dotnet_package $zip_path $install_root
658671

659672
return 0
@@ -667,7 +680,6 @@ channel="LTS"
667680
version="Latest"
668681
install_dir="<auto>"
669682
architecture="<auto>"
670-
debug_symbols=false
671683
dry_run=false
672684
no_path=false
673685
azure_feed="https://dotnetcli.azureedge.net/dotnet"
@@ -699,9 +711,6 @@ do
699711
--shared-runtime|-[Ss]hared[Rr]untime)
700712
shared_runtime=true
701713
;;
702-
--debug-symbols|-[Dd]ebug[Ss]ymbols)
703-
debug_symbols=true
704-
;;
705714
--dry-run|-[Dd]ry[Rr]un)
706715
dry_run=true
707716
;;
@@ -732,17 +741,29 @@ do
732741
echo "$script_name is a simple command line interface for obtaining dotnet cli."
733742
echo ""
734743
echo "Options:"
735-
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified (default: $channel)."
744+
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified, Defaults to \`$channel\`."
736745
echo " -Channel"
737-
echo " -v,--version <VERSION> Use specific version, or \`latest\`. Defaults to \`latest\`."
746+
echo " Possible values:"
747+
echo " - Current - most current release"
748+
echo " - LTS - most current supported release"
749+
echo " - 2-part version in a format A.B - represents a specific release"
750+
echo " examples: 2.0; 1.0"
751+
echo " - Branch name"
752+
echo " examples: release/2.0.0; Master"
753+
echo " -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
738754
echo " -Version"
755+
echo " Possible values:"
756+
echo " - latest - most latest build on specific channel"
757+
echo " - coherent - most latest coherent build on specific channel"
758+
echo " coherent applies only to SDK downloads"
759+
echo " - 3-part version in a format A.B.C - represents specific version of build"
760+
echo " examples: 2.0.0-preview2-006120; 1.1.0"
739761
echo " -i,--install-dir <DIR> Install under specified location (see Install Location below)"
740762
echo " -InstallDir"
741763
echo " --architecture <ARCHITECTURE> Architecture of .NET Tools. Currently only x64 is supported."
742764
echo " --arch,-Architecture,-Arch"
743765
echo " --shared-runtime Installs just the shared runtime bits, not the entire SDK."
744766
echo " -SharedRuntime"
745-
echo " --debug-symbols,-DebugSymbols Specifies if symbols should be included in the installation."
746767
echo " --dry-run,-DryRun Do not perform installation. Display download link."
747768
echo " --no-path, -NoPath Do not set PATH for the current process."
748769
echo " --verbose,-Verbose Display diagnostics information."

0 commit comments

Comments
 (0)