Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 9, 2024
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
1 change: 1 addition & 0 deletions eng/common/testproxy/scripts/tag-merge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
28 changes: 22 additions & 6 deletions eng/common/testproxy/scripts/tag-merge/merge-proxy-tags.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#Requires -Version 6.0
#Requires -PSEdition Core

<#
.SYNOPSIS
Merge multiple asset tagss worth of content into a single asset tag.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
}
Expand Down Expand Up @@ -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
Expand Down