Skip to content

Commit 0fbeb23

Browse files
azure-sdkscbedd
andauthored
Sync eng/common directory with azure-sdk-tools for PR 7459 (#22222)
* check for the presence of a compatible powershell. ensure that we always return a list of tags * allow the script to require pshell6+ * remove the en-us from the link --------- Co-authored-by: Scott Beddall (from Dev Box) <[email protected]>
1 parent 46b3614 commit 0fbeb23

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

eng/common/testproxy/scripts/tag-merge/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This script merely allows the abstraction of some of this "combination" work.
1111

1212
### PreReqs
1313

14+
- Must have []`pshell 6+`](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows)
1415
- Must have `git` available on your PATH
1516
- Must have the `test-proxy` available on your PATH
1617
- `test-proxy` is honored when the proxy is installed as a `dotnet tool`

eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#Requires -Version 6.0
2+
#Requires -PSEdition Core
3+
14
<#
25
.SYNOPSIS
36
Merge multiple asset tagss worth of content into a single asset tag.
@@ -66,9 +69,6 @@ function Git-Command($CommandString, $WorkingDirectory, $HardExit=$true) {
6669
}
6770

6871
function Resolve-Proxy {
69-
# this script requires the presence of git
70-
Test-Exe-In-Path -ExeToLookFor "git" | Out-Null
71-
7272
$testProxyExe = "test-proxy"
7373
# this script requires the presence of the test-proxy on the PATH
7474
$proxyToolPresent = Test-Exe-In-Path -ExeToLookFor "test-proxy" -ExitOnError $false
@@ -184,7 +184,13 @@ function Start-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDire
184184
function Finish-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDirectory) {
185185
$len = $TargetTags.Length
186186

187-
Write-Host "`nSuccessfully combined $len tags. Invoke `"test-proxy push " -NoNewLine
187+
if ($TargetTags.GetType().Name -eq "String") {
188+
$len = 1
189+
}
190+
191+
$suffix = if ($len -gt 1) { "s" } else { "" }
192+
193+
Write-Host "`nSuccessfully combined $len tag$suffix. Invoke `"test-proxy push " -NoNewLine
188194
Write-Host $AssetsJson -ForegroundColor Green -NoNewLine
189195
Write-Host "`" to push the results as a new tag."
190196
}
@@ -270,12 +276,22 @@ function Combine-Tags($RemainingTags, $AssetsRepoLocation, $MountDirectory){
270276
# if we have successfully gotten to the end without any non-zero exit codes...delete the mergeprogress file, we're g2g
271277
Cleanup-Incomplete-Progress $MountDirectory
272278

273-
return $pushedTags
279+
return @($pushedTags)
274280
}
275281

276282
$ErrorActionPreference = "Stop"
277283

278-
# resolve the proxy location so that we can invoke it easily
284+
# this script requires the presence of git
285+
Test-Exe-In-Path -ExeToLookFor "git" | Out-Null
286+
287+
# this script expects at least powershell 6 (core)
288+
289+
if ($PSVersionTable["PSVersion"].Major -lt 6) {
290+
Write-Error "This script requires a version of powershell newer than 6. See http://aka.ms/powershell for resolution."
291+
exit 1
292+
}
293+
294+
# resolve the proxy location so that we can invoke it easily, if not present we exit here.
279295
$proxyExe = Resolve-Proxy
280296

281297
$AssetsJson = Resolve-Path $AssetsJson

0 commit comments

Comments
 (0)