Sync eng/common directory with azure-sdk-tools for PR 7459 (#5237)

* 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) <scbedd@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-01-09 12:31:31 -08:00 committed by GitHub
parent cb73bbd62c
commit 7950e388fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View File

@ -11,6 +11,7 @@ This script merely allows the abstraction of some of this "combination" work.
### PreReqs
- Must have []`pshell 6+`](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows)
- Must have `git` available on your PATH
- Must have the `test-proxy` available on your PATH
- `test-proxy` is honored when the proxy is installed as a `dotnet tool`

View File

@ -1,3 +1,6 @@
#Requires -Version 6.0
#Requires -PSEdition Core
<#
.SYNOPSIS
Merge multiple asset tagss worth of content into a single asset tag.
@ -66,9 +69,6 @@ function Git-Command($CommandString, $WorkingDirectory, $HardExit=$true) {
}
function Resolve-Proxy {
# this script requires the presence of git
Test-Exe-In-Path -ExeToLookFor "git" | Out-Null
$testProxyExe = "test-proxy"
# this script requires the presence of the test-proxy on the PATH
$proxyToolPresent = Test-Exe-In-Path -ExeToLookFor "test-proxy" -ExitOnError $false
@ -184,7 +184,13 @@ function Start-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDire
function Finish-Message($AssetsJson, $TargetTags, $AssetsRepoLocation, $MountDirectory) {
$len = $TargetTags.Length
Write-Host "`nSuccessfully combined $len tags. Invoke `"test-proxy push " -NoNewLine
if ($TargetTags.GetType().Name -eq "String") {
$len = 1
}
$suffix = if ($len -gt 1) { "s" } else { "" }
Write-Host "`nSuccessfully combined $len tag$suffix. Invoke `"test-proxy push " -NoNewLine
Write-Host $AssetsJson -ForegroundColor Green -NoNewLine
Write-Host "`" to push the results as a new tag."
}
@ -270,12 +276,22 @@ function Combine-Tags($RemainingTags, $AssetsRepoLocation, $MountDirectory){
# if we have successfully gotten to the end without any non-zero exit codes...delete the mergeprogress file, we're g2g
Cleanup-Incomplete-Progress $MountDirectory
return $pushedTags
return @($pushedTags)
}
$ErrorActionPreference = "Stop"
# resolve the proxy location so that we can invoke it easily
# this script requires the presence of git
Test-Exe-In-Path -ExeToLookFor "git" | Out-Null
# this script expects at least powershell 6 (core)
if ($PSVersionTable["PSVersion"].Major -lt 6) {
Write-Error "This script requires a version of powershell newer than 6. See http://aka.ms/powershell for resolution."
exit 1
}
# resolve the proxy location so that we can invoke it easily, if not present we exit here.
$proxyExe = Resolve-Proxy
$AssetsJson = Resolve-Path $AssetsJson