Sync eng/common directory with azure-sdk-tools for PR 7877 (#1735)

* create necessary eng/common changes to allow proxy to be shut down.
---------

Co-authored-by: Scott Beddall (from Dev Box) <scbedd@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-03-14 15:52:21 -04:00 коммит произвёл GitHub
Родитель 8f851d262b
Коммит 92359b74bc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,10 @@
steps:
- pwsh: |
Stop-Process -Id $(PROXY_PID)
displayName: 'Shut down the testproxy - windows'
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
- bash: |
kill -9 $(PROXY_PID)
displayName: "Shut down the testproxy - linux/mac"
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))

Просмотреть файл

@ -1,3 +1,4 @@
# This template sets variable PROXY_PID to be used for shutdown later.
parameters:
rootFolder: '$(Build.SourcesDirectory)'
runProxy: true
@ -42,15 +43,20 @@ steps:
condition: and(succeeded(), ${{ parameters.condition }})
- pwsh: |
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
$Process = Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
-ArgumentList "start --storage-location ${{ parameters.rootFolder }} -U" `
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log
Write-Host "##vso[task.setvariable variable=PROXY_PID]$($Process.Id)"
displayName: 'Run the testproxy - windows'
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
# nohup does NOT continue beyond the current session if you use it within powershell
- bash: |
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy &>$(Build.SourcesDirectory)/test-proxy.log &
echo $! > $(Build.SourcesDirectory)/test-proxy.pid
echo "##vso[task.setvariable variable=PROXY_PID]$(cat $(Build.SourcesDirectory)/test-proxy.pid)"
displayName: "Run the testproxy - linux/mac"
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
workingDirectory: "${{ parameters.rootFolder }}"