Skip to content

Commit 97b34d7

Browse files
azure-sdkscbedd
andauthored
Sync eng/common directory with azure-sdk-tools for PR 7877 (#34774)
* create necessary eng/common changes to allow proxy to be shut down --------- Co-authored-by: Scott Beddall (from Dev Box) <[email protected]>
1 parent 138fdde commit 97b34d7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
steps:
2+
- pwsh: |
3+
Stop-Process -Id $(PROXY_PID)
4+
displayName: 'Shut down the testproxy - windows'
5+
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
6+
7+
- bash: |
8+
kill -9 $(PROXY_PID)
9+
displayName: "Shut down the testproxy - linux/mac"
10+
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))

eng/common/testproxy/test-proxy-tool.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# This template sets variable PROXY_PID to be used for shutdown later.
12
parameters:
23
rootFolder: '$(Build.SourcesDirectory)'
34
runProxy: true
@@ -42,15 +43,20 @@ steps:
4243
condition: and(succeeded(), ${{ parameters.condition }})
4344
4445
- pwsh: |
45-
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
46+
$Process = Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
4647
-ArgumentList "start --storage-location ${{ parameters.rootFolder }} -U" `
4748
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log
49+
50+
Write-Host "##vso[task.setvariable variable=PROXY_PID]$($Process.Id)"
4851
displayName: 'Run the testproxy - windows'
4952
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
5053
5154
# nohup does NOT continue beyond the current session if you use it within powershell
5255
- bash: |
5356
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy &>$(Build.SourcesDirectory)/test-proxy.log &
57+
58+
echo $! > $(Build.SourcesDirectory)/test-proxy.pid
59+
echo "##vso[task.setvariable variable=PROXY_PID]$(cat $(Build.SourcesDirectory)/test-proxy.pid)"
5460
displayName: "Run the testproxy - linux/mac"
5561
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
5662
workingDirectory: "${{ parameters.rootFolder }}"

0 commit comments

Comments
 (0)