Skip to content

Commit

Permalink
Add Template for Upload of Proxy Logs (#5224)
Browse files Browse the repository at this point in the history
If you're using a simple invocation of the `test-proxy-tool.yml`, you will be able to call the following before your tests run.

```yml
- template: /eng/common/testproxy/test-proxy-tool.yml
  parameters:
    rootFolder: $(Build.SourcesDirectory)/sdk/core
```

One will be able to call:

```yml
- template: /eng/common/testproxy/publish-proxy-logs.yml
  parameters:
    rootFolder: $(Build.SourcesDirectory)/sdk/core
```

As long as you reflect the same `rootFolder` argument to publish-proxy-logs, they will be picked up and uploaded as artifacts.

[Example Invocation](https://dev.azure.com/azure-sdk/public/_build/results?buildId=2139544)

What the artifacts look like:
![image](https://user-images.githubusercontent.com/45376673/214681466-57ea5311-bc54-44ca-b2b9-acdec929238c.png)

Resolves the other half of #5204
  • Loading branch information
scbedd authored Jan 27, 2023
1 parent c8a92c9 commit 21c4863
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions eng/common/testproxy/publish-proxy-logs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
rootFolder: '$(Build.SourcesDirectory)'

steps:
- pwsh: |
Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy.log" -Destination "${{ parameters.rootFolder }}/proxy.log"
displayName: Copy Log File
- template: ../pipelines/templates/steps/publish-artifact.yml
parameters:
ArtifactName: "$(System.JobName)-proxy-logs"
ArtifactPath: "${{ parameters.rootFolder }}/proxy.log"

- pwsh: |
Remove-Item -Force ${{ parameters.rootFolder }}/proxy.log
displayName: Cleanup Copied Log File
4 changes: 2 additions & 2 deletions eng/common/testproxy/test-proxy-tool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ steps:
- pwsh: |
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
-ArgumentList "--storage-location ${{ parameters.rootFolder }}" `
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.templateRoot }}/test-proxy.log
-NoNewWindow -PassThru -RedirectStandardOutput ${{ parameters.rootFolder }}/test-proxy.log
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 > ${{ parameters.templateRoot }}/test-proxy.log &
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > ${{ parameters.rootFolder }}/test-proxy.log &
displayName: "Run the testproxy - linux/mac"
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'), ${{ parameters.condition }})
workingDirectory: "${{ parameters.rootFolder }}"
Expand Down

0 comments on commit 21c4863

Please sign in to comment.