Skip to content

Commit c9950b0

Browse files
Robert HoltTylerLeonhardt
Robert Holt
authored andcommitted
Add ADS insiders gallery file to update script (#2038)
1 parent 90e9e24 commit c9950b0

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

tools/GitHubTools.psm1

+13-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ function Copy-GitRepository
6868
$Remotes,
6969

7070
[switch]
71-
$Clobber
71+
$Clobber,
72+
73+
[switch]
74+
$PullUpstream,
75+
76+
[switch]
77+
$UpdateOrigin
7278
)
7379

7480
$Destination = $PSCmdlet.GetUnresolvedProviderPathFromPSPath($Destination)
@@ -101,9 +107,14 @@ function Copy-GitRepository
101107
Exec { git remote add $remote $Remotes[$remote] }
102108
}
103109

104-
if ($remote['upstream'])
110+
if ($PullUpstream -and $remote['upstream'])
105111
{
106112
Exec { git pull upstream $CloneBranch }
113+
114+
if ($UpdateOrigin)
115+
{
116+
Exec { git push origin "+$CloneBranch"}
117+
}
107118
}
108119

109120
if ($CheckoutBranch)

tools/postReleaseScripts/updateAzureDataStudio.ps1

+28-18
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ param(
1313
$ExtensionVersion,
1414

1515
[Parameter()]
16-
[string]
17-
$GalleryFileName = 'extensionsGallery.json',
16+
[string[]]
17+
$GalleryFileName = ('extensionsGallery.json','extensionsGallery-insider.json'),
1818

1919
[Parameter()]
2020
[string]
@@ -213,26 +213,32 @@ function UpdateGalleryFile
213213
[version]
214214
$ExtensionVersion,
215215

216-
[Parameter()]
217-
[string]
218-
$GalleryFilePath = './extensionsGallery-insider.json'
216+
[Parameter(Mandatory, ValueFromPipeline)]
217+
[string[]]
218+
$GalleryFilePath
219219
)
220220

221-
# Create a new PowerShell extension entry
222-
$powershellEntry = NewPowerShellExtensionEntry -ExtensionVersion $ExtensionVersion
223-
$entryStr = ConvertTo-IndentedJson $powershellEntry -IndentChar "`t" -IndentWidth 1
221+
process
222+
{
223+
foreach ($galleryFile in $GalleryFilePath)
224+
{
225+
# Create a new PowerShell extension entry
226+
$powershellEntry = NewPowerShellExtensionEntry -ExtensionVersion $ExtensionVersion
227+
$entryStr = ConvertTo-IndentedJson $powershellEntry -IndentChar "`t" -IndentWidth 1
224228

225-
# Find the position in the existing file where the PowerShell extension should go
226-
$galleryFileContent = Get-Content -Raw $GalleryFilePath
227-
$span = FindPSExtensionJsonSpan -GalleryExtensionFileContent $galleryFileContent
228-
$startOffset = Get-StringOffsetFromSpan -String $galleryFileContent -EndLine $span.Start.Line -Column $span.Start.Column
229-
$endOffset = Get-StringOffsetFromSpan -String $galleryFileContent -EndLine $span.End.Line -StartLine $span.Start.Line -Column $span.End.Column -InitialOffset $startOffset
229+
# Find the position in the existing file where the PowerShell extension should go
230+
$galleryFileContent = Get-Content -Raw $GalleryFilePath
231+
$span = FindPSExtensionJsonSpan -GalleryExtensionFileContent $galleryFileContent
232+
$startOffset = Get-StringOffsetFromSpan -String $galleryFileContent -EndLine $span.Start.Line -Column $span.Start.Column
233+
$endOffset = Get-StringOffsetFromSpan -String $galleryFileContent -EndLine $span.End.Line -StartLine $span.Start.Line -Column $span.End.Column -InitialOffset $startOffset
230234

231-
# Create the new file contents with the inserted segment
232-
$newGalleryFileContent = New-StringWithSegment -String $galleryFileContent -NewSegment $entryStr -StartIndex $startOffset -EndIndex ($endOffset+1) -AutoIndent
235+
# Create the new file contents with the inserted segment
236+
$newGalleryFileContent = New-StringWithSegment -String $galleryFileContent -NewSegment $entryStr -StartIndex $startOffset -EndIndex ($endOffset+1) -AutoIndent
233237

234-
# Write out the new entry
235-
Set-Content -Path $GalleryFilePath -Value $newGalleryFileContent -Encoding utf8NoBOM -NoNewline
238+
# Write out the new entry
239+
Set-Content -Path $GalleryFilePath -Value $newGalleryFileContent -Encoding utf8NoBOM -NoNewline
240+
}
241+
}
236242
}
237243

238244
$repoLocation = Join-Path ([System.IO.Path]::GetTempPath()) 'ads-temp-checkout'
@@ -243,13 +249,17 @@ $cloneParams = @{
243249
CloneBranch = 'release/extensions'
244250
CheckoutBranch = $branchName
245251
Clobber = $true
252+
PullUpstream = $true
253+
UpdateOrigin = $true
246254
Remotes = @{
247255
upstream = 'https://github.com/Microsoft/AzureDataStudio'
248256
}
249257
}
250258
Copy-GitRepository @cloneParams
251259

252-
UpdateGalleryFile -ExtensionVersion $ExtensionVersion -GalleryFilePath "$repoLocation/$GalleryFileName"
260+
$GalleryFileName |
261+
ForEach-Object { "$repoLocation/$_" } |
262+
UpdateGalleryFile -ExtensionVersion $ExtensionVersion
253263

254264
Submit-GitChanges -RepositoryLocation $repoLocation -File $GalleryFileName -Branch $branchName -Message "Update PS extension to v$ExtensionVersion"
255265

0 commit comments

Comments
 (0)