Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Jul 3, 2024
1 parent 117ca49 commit 7532e28
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 42 deletions.
55 changes: 21 additions & 34 deletions Evergreen/Apps/Get-MicrosoftAzureDataStudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,31 @@ function Get-MicrosoftAzureDataStudio {
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get the commit details
$params = @{
Uri = $res.Get.Update.Version.Uri
ErrorAction = "Stop"
}
$Commit = (Invoke-EvergreenRestMethod @params).($res.Get.Update.Version.Property)

# Walk through each platform
if ([System.String]::IsNullOrEmpty($Commit)) {
throw "$($MyInvocation.MyCommand): No value found for property: $($res.Get.Update.Version.Property)."
}
else {
foreach ($platform in $res.Get.Update.Platform) {
Write-Verbose -Message "$($MyInvocation.MyCommand): Getting release info for $platform."
foreach ($platform in $res.Get.Update.Platform) {
Write-Verbose -Message "$($MyInvocation.MyCommand): Getting release info for $platform."

# Walk through each channel in the platform
foreach ($channel in $res.Get.Update.Channel) {
# Walk through each channel in the platform
foreach ($channel in $res.Get.Update.Channel) {

# Read the version details from the API, format and return to the pipeline
$params = @{
Uri = "$($res.Get.Update.Uri)/$($platform.ToLower())/$($channel.ToLower())/$Commit"
ErrorAction = "Stop"
}
$updateFeed = Invoke-EvergreenRestMethod @params
# Resolve details for the update feed
$params = @{
Uri = $res.Get.Update.Uri -replace "#platform", $platform.ToLower() -replace "#channel", $channel.ToLower()
ErrorAction = "Stop"
}
$UpdateFeed = Invoke-EvergreenRestMethod @params

if ([System.String]::IsNullOrEmpty($updateFeed)) {
throw "$($MyInvocation.MyCommand): No update feed found for $platform and $channel."
}
else {
$PSObject = [PSCustomObject] @{
Version = $updateFeed.productVersion -replace $res.Get.Update.ReplaceText, ""
Platform = $platform
Channel = $channel
Sha256 = $updateFeed.sha256hash
URI = $updateFeed.url
}
Write-Output -InputObject $PSObject
# If we have a valid response, output the details
if ($null -ne $UpdateFeed) {
$Url = $(Resolve-SystemNetWebRequest -Uri $UpdateFeed.url).ResponseUri.AbsoluteUri
$PSObject = [PSCustomObject] @{
Version = $UpdateFeed.productVersion
Channel = $channel
Platform = $platform
Sha256 = $UpdateFeed.sha256hash
Type = Get-FileType -File $Url
URI = $Url
}
Write-Output -InputObject $PSObject
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions Evergreen/Manifests/MicrosoftAzureDataStudio.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
"Source": "https://docs.microsoft.com/en-us/sql/azure-data-studio/",
"Get": {
"Update": {
"Version": {
"Uri": "https://raw.githubusercontent.com/microsoft/azuredatastudio/main/product.json",
"Property": "commit"
},
"Uri": "https://azuredatastudio-update.azurewebsites.net/api/update",
"Uri": "https://azuredatastudio-update.azurewebsites.net/api/update/#platform/#channel/latest",
"Platform": [
"win32-x64",
"win32-x64-user"
],
"Channel": [
"Insider",
"Stable"
],
"ReplaceText": "-insider"
]
}
},
"Install": {
Expand Down

0 comments on commit 7532e28

Please sign in to comment.