Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
if: failure()
with:
webhook_url: ${{ secrets.PS_BUILD_TEAMS_CHANNEL }}
overwrite: "{title: `Failure in updating .NET build. Look at ${workflow_link}`}"
overwrite: "{title: `Failure in .github/daily.yml updating .NET build. Look at ${workflow_link}`}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cpr
Expand Down
28 changes: 18 additions & 10 deletions tools/UpdateDotnetRuntime.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,36 +189,41 @@ function Get-DotnetUpdate {
try {

try {
$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$quality/productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$URL = "http://aka.ms/dotnet/$channel/$quality/productVersion.txt"
$latestSDKVersionString = Invoke-RestMethod -Uri $URL -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $quality
} catch {
if ($_.exception.Response.StatusCode -eq 'NotFound') {
Write-Verbose "Build not found for Channel: $Channel and Quality: $Quality" -Verbose
Write-Verbose -Verbose -Message "No build at '$URL' found!"
} else {
throw $_
}
}
$latestSDKversion = $latestSDKVersionString -as "System.Management.Automation.SemanticVersion"

if (-not $latestSDKVersionString -or -not $latestSDKVersionString.StartsWith($sdkImageVersion)) {
if (-not $latestSDKVersion) {
# we did not get a version number so fall back to daily
$latestSDKVersionString = Invoke-RestMethod -Uri "http://aka.ms/dotnet/$channel/$qualityFallback/productVersion.txt" -ErrorAction Stop | ForEach-Object { $_.Trim() }
$URL = "http://aka.ms/dotnet/$channel/$qualityFallback/productVersion.txt"
$latestSDKVersionString = Invoke-RestMethod -Uri $URL -ErrorAction Stop | ForEach-Object { $_.Trim() }
$selectedQuality = $qualityFallback

if (-not $latestSDKVersionString.StartsWith($sdkImageVersion)) {
throw "No build found!"
$latestSDKversion = $latestSDKVersionString -as "System.Management.Automation.SemanticVersion"
if (-not $latestSDKVersion) {
throw "No build at '$URL' found!"
}
}

$latestSDKversion = [System.Management.Automation.SemanticVersion] $latestSDKVersionString

$currentVersion = [System.Management.Automation.SemanticVersion] (( Get-Content -Path "$PSScriptRoot/../global.json" -Raw | ConvertFrom-Json).sdk.version)

if ($latestSDKversion -gt $currentVersion) {
if ($latestSDKversion -gt $currentVersion -and $null -ne $latestSDKversion.PreReleaseLabel) {
$shouldUpdate = $true
$newVersion = $latestSDKversion
} else {
$shouldUpdate = $false
$newVersion = $null
$newVersion = $latestSDKVersionString
if ($null -eq $currentVersion.PreReleaseLabel) {
$Message = "$latestSDKversion is not preview, update manually."
}
}
} catch {
Write-Verbose -Verbose "Error occured: $_.message"
Expand Down Expand Up @@ -356,3 +361,6 @@ if ($dotnetUpdate.ShouldUpdate) {

Update-DevContainer
}
else {
Write-Verbose -Verbose -Message $dotnetUpdate.Message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Write-Verbose -Verbose -Message $dotnetUpdate.Message
Write-Verbose -Verbose -Message "No update needed. DotNet update message: $($dotnetUpdate.Message)"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an update may actually be needed, so i wouldn't want to say "update needed" when the update message says "update manually"

}