Write a 'latest.coherent.version' file at blob storage so users have a 'coherent' option to SDK installations.

This commit is contained in:
John Beisner 2017-06-13 16:45:29 -07:00
parent 3a5612f153
commit c497bf498f
5 changed files with 103 additions and 26 deletions

View file

@ -32,6 +32,8 @@
<PropertyGroup>
<AspNetCoreRuntimeInstallerBlobRootUrl>$(CoreSetupBlobRootUrl)aspnetcore/store/$(AspNetCoreRuntimeVersion)</AspNetCoreRuntimeInstallerBlobRootUrl>
<AspNetCoreSharedRuntimeVersionFileName>runtime.version</AspNetCoreSharedRuntimeVersionFileName>
<AspNetCoreSharedRuntimeVersionFile Condition=" '$(AspNetCoreSharedRuntimeVersionFileName)' != '' ">$(PackagesDirectory)/$(AspNetCoreSharedRuntimeVersionFileName)</AspNetCoreSharedRuntimeVersionFile>
<!-- Examples: Build.RS.linux.zip Build.RS.winx86.zip AspNetCorePackageStoreLibx64.wixlib -->
<AspNetCoreRuntimeInstallerArchiveFileNameOSToken Condition=" '$(HostOSName)' == 'win' ">$(HostOSName)$(Architecture)</AspNetCoreRuntimeInstallerArchiveFileNameOSToken>
@ -90,5 +92,12 @@
<ExtractDestination>$(AspNetRuntimePackageStorePublishDirectory)</ExtractDestination>
</_DownloadAndExtractItem>
<_DownloadAndExtractItem Include="AspNetCoreSharedRuntimeVersionFile"
Condition="!Exists('$(AspNetCoreSharedRuntimeVersionFile)')">
<Url>$(AspNetCoreRuntimeInstallerBlobRootUrl)/$(AspNetCoreSharedRuntimeVersionFileName)</Url>
<DownloadFileName>$(AspNetCoreSharedRuntimeVersionFile)</DownloadFileName>
<ExtractDestination></ExtractDestination>
</_DownloadAndExtractItem>
</ItemGroup>
</Project>

View file

@ -2,6 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="FinishBuild"
DependsOnTargets="CheckIfAllBuildsHavePublished;
EvaluateRuntimeCoherence;
FinalizeBuild" />
<Target Name="CheckIfAllBuildsHavePublished">
@ -14,6 +15,27 @@
</CheckIfAllBuildsHavePublished>
</Target>
<Target Name="EvaluateRuntimeCoherence"
DependsOnTargets="ReadAspNetCoreSharedRuntimeVersionFile"
BeforeTargets="FinalizeBuild">
<PropertyGroup>
<Coherent>false</Coherent>
<Coherent Condition=" '$(CLI_SharedFrameworkVersion)' == '@(AspNetCoreSharedRuntimeVersion)' ">true</Coherent>
</PropertyGroup>
</Target>
<Target Name="ReadAspNetCoreSharedRuntimeVersionFile"
DependsOnTargets="DownloadHostAndSharedFxArtifacts">
<ItemGroup>
<File Include="$(AspNetCoreSharedRuntimeVersionFile)" />
</ItemGroup>
<ReadLinesFromFile File="@(File)">
<Output
TaskParameter="Lines"
ItemName="AspNetCoreSharedRuntimeVersion"/>
</ReadLinesFromFile>
</Target>
<Target Name="FinalizeBuild"
Condition=" '$(HaveAllBuildsPublished)' == 'True' ">
<CopyBlobsToLatest AccountName="$(ArtifactCloudDropAccountName)"
@ -21,14 +43,16 @@
ContainerName="$(ArtifactContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)" />
CommitHash="$(CommitHash)"
Coherent="$(Coherent)" />
<CopyBlobsToLatest AccountName="$(ChecksumCloudDropAccountName)"
AccountKey="$(ChecksumCloudDropAccessToken)"
ContainerName="$(ChecksumContainerName)"
NugetVersion="$(FullNugetVersion)"
Channel="$(Channel)"
CommitHash="$(CommitHash)" />
CommitHash="$(CommitHash)"
Coherent="$(Coherent)" />
<UpdateVersionsRepo BranchName="$(BranchName)"
PackagesDirectory="$(PackagesDirectory)"

View file

@ -31,6 +31,8 @@ namespace Microsoft.DotNet.Cli.Build
[Required]
public string NugetVersion { get; set; }
public bool Coherent { get; set; }
private AzurePublisher AzurePublisherTool
{
get
@ -81,6 +83,10 @@ namespace Microsoft.DotNet.Cli.Build
string cliVersion = Utils.GetVersionFileContent(CommitHash, NugetVersion);
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.version", cliVersion);
if (Coherent == true)
{
AzurePublisherTool.PublishStringToBlob($"{targetFolder}/latest.coherent.version", cliVersion);
}
}
finally
{

View file

@ -11,11 +11,19 @@
it will update it only if the requested version differs from the one already installed.
.PARAMETER Channel
Default: LTS
Download from the Channel specified
Download from the Channel specified. Possible values:
- Current - most current release
- LTS - most current supported release
- 2-part version in a format A.B - represents a specific release
examples: 2.0; 1.0
- Branch name
examples: release/2.0.0; Master
.PARAMETER Version
Default: latest
Represents a build version on specific channel. Possible values:
- latest - most latest build on specific channel
- coherent - most latest coherent build on specific channel
coherent applies only to SDK downloads
- 3-part version in a format A.B.C - represents specific version of build
examples: 2.0.0-preview2-006120; 1.1.0
.PARAMETER InstallDir
@ -28,8 +36,6 @@
.PARAMETER SharedRuntime
Default: false
Installs just the shared runtime bits, not the entire SDK
.PARAMETER DebugSymbols
If set the installer will include symbols in the installation.
.PARAMETER DryRun
If set it will not perform installation but instead display what command line to use to consistently install
currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link
@ -60,7 +66,6 @@ param(
[string]$InstallDir="<auto>",
[string]$Architecture="<auto>",
[switch]$SharedRuntime,
[switch]$DebugSymbols, # TODO: Switch does not work yet. Symbols zip is not being uploaded yet.
[switch]$DryRun,
[switch]$NoPath,
[string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet",
@ -207,16 +212,21 @@ function GetHTTPResponse([Uri] $Uri)
}
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel) {
function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Coherent) {
Say-Invocation $MyInvocation
$VersionFileUrl = $null
if ($SharedRuntime) {
$VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version"
}
else {
if ($Coherent) {
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.coherent.version"
}
else {
$VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version"
}
}
$Response = GetHTTPResponse -Uri $VersionFileUrl
$StringContent = $Response.Content.ReadAsStringAsync().Result
@ -239,7 +249,11 @@ function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel,
switch ($Version.ToLower()) {
{ $_ -eq "latest" } {
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $False
return $LatestVersionInfo.Version
}
{ $_ -eq "coherent" } {
$LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $True
return $LatestVersionInfo.Version
}
default { return $Version }
@ -464,14 +478,17 @@ if ($free.Freespace / 1MB -le 100 ) {
}
$ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink"
Say-Verbose "Zip path: $ZipPath"
Say "Downloading link: $DownloadLink"
try {
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
}
catch {
Say "Cannot download: $DownloadLink"
$DownloadLink = $LegacyDownloadLink
$ZipPath = [System.IO.Path]::GetTempFileName()
Say "Downloading $DownloadLink"
Say-Verbose "Legacy zip path: $ZipPath"
Say "Downloading legacy link: $DownloadLink"
DownloadFile -Uri $DownloadLink -OutPath $ZipPath
}

View file

@ -147,7 +147,7 @@ get_distro_specific_os_name() {
fi
fi
say_verbose "Distribution specific OS name + version could not be detected: $ID.$VERSION_ID"
say_verbose "Distribution specific OS name and version could not be detected: $ID.$VERSION_ID"
return 1
}
@ -339,13 +339,18 @@ get_latest_version_info() {
local azure_feed=$1
local channel=$2
local normalized_architecture=$3
local coherent=$4
local version_file_url=null
if [ "$shared_runtime" = true ]; then
version_file_url="$uncached_feed/Runtime/$channel/latest.version"
else
if [ "$coherent" = true ]; then
version_file_url="$uncached_feed/Runtime/$channel/latest.coherent.version"
else
version_file_url="$uncached_feed/Sdk/$channel/latest.version"
fi
fi
say_verbose "get_latest_version_info: latest url: $version_file_url"
download $version_file_url
@ -368,7 +373,14 @@ get_specific_version_from_version() {
case $version in
latest)
local version_info
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture)" || return 1
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture false)" || return 1
say_verbose "get_specific_version_from_version: version_info=$version_info"
echo "$version_info" | get_version_from_version_info
return 0
;;
coherent)
local version_info
version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture true)" || return 1
say_verbose "get_specific_version_from_version: version_info=$version_info"
echo "$version_info" | get_version_from_version_info
return 0
@ -647,13 +659,14 @@ install_dotnet() {
# if the download fails, download the legacy_download_link
if [ "$download_failed" = true ] && [ "$valid_legacy_download_link" = true ]; then
say "Cannot download: $download_link"
download_link=$legacy_download_link
zip_path=$(mktemp $temporary_file_template)
say_verbose "Legacy zip path: $zip_path"
say "Downloading legacy link: $legacy_download_link"
download "$legacy_download_link" $zip_path
say "Downloading legacy link: $download_link"
download "$download_link" $zip_path
fi
say "Extracting zip"
say "Extracting zip from $download_link"
extract_dotnet_package $zip_path $install_root
return 0
@ -667,7 +680,6 @@ channel="LTS"
version="Latest"
install_dir="<auto>"
architecture="<auto>"
debug_symbols=false
dry_run=false
no_path=false
azure_feed="https://dotnetcli.azureedge.net/dotnet"
@ -699,9 +711,6 @@ do
--shared-runtime|-[Ss]hared[Rr]untime)
shared_runtime=true
;;
--debug-symbols|-[Dd]ebug[Ss]ymbols)
debug_symbols=true
;;
--dry-run|-[Dd]ry[Rr]un)
dry_run=true
;;
@ -732,17 +741,29 @@ do
echo "$script_name is a simple command line interface for obtaining dotnet cli."
echo ""
echo "Options:"
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified (default: $channel)."
echo " -c,--channel <CHANNEL> Download from the CHANNEL specified, Defaults to \`$channel\`."
echo " -Channel"
echo " -v,--version <VERSION> Use specific version, or \`latest\`. Defaults to \`latest\`."
echo " Possible values:"
echo " - Current - most current release"
echo " - LTS - most current supported release"
echo " - 2-part version in a format A.B - represents a specific release"
echo " examples: 2.0; 1.0"
echo " - Branch name"
echo " examples: release/2.0.0; Master"
echo " -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
echo " -Version"
echo " Possible values:"
echo " - latest - most latest build on specific channel"
echo " - coherent - most latest coherent build on specific channel"
echo " coherent applies only to SDK downloads"
echo " - 3-part version in a format A.B.C - represents specific version of build"
echo " examples: 2.0.0-preview2-006120; 1.1.0"
echo " -i,--install-dir <DIR> Install under specified location (see Install Location below)"
echo " -InstallDir"
echo " --architecture <ARCHITECTURE> Architecture of .NET Tools. Currently only x64 is supported."
echo " --arch,-Architecture,-Arch"
echo " --shared-runtime Installs just the shared runtime bits, not the entire SDK."
echo " -SharedRuntime"
echo " --debug-symbols,-DebugSymbols Specifies if symbols should be included in the installation."
echo " --dry-run,-DryRun Do not perform installation. Display download link."
echo " --no-path, -NoPath Do not set PATH for the current process."
echo " --verbose,-Verbose Display diagnostics information."