Skip to content

Add llm artifact upload step (test results artifacts) #51890

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions eng/pipelines/templates/jobs/ci.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ jobs:
artifactName: "Crash Dump - $(System.JobName) - $(System.JobAttempt)"
condition: eq(variables['uploadDump'], 'true')
sbomEnabled: false
- output: pipelineArtifact
targetPath: '$(Build.ArtifactStagingDirectory)/llm-artifacts'
artifactName: "LLM Artifacts - $(System.JobName) - $(System.JobAttempt)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have this LLM specific artifact? I know we talked about it but don't remember what we decided?

condition: eq(variables['uploadTestResults'], 'true')
sbomEnabled: false

steps:
- ${{ if not(contains(variables['Build.DefinitionName'], '-pr - ')) }}:
Expand Down Expand Up @@ -185,6 +190,7 @@ jobs:
testResultsFormat: "VSTest"
mergeTestResults: true
- template: /eng/pipelines/templates/steps/upload-dumps.yml
- template: /eng/pipelines/templates/steps/upload-llm-artifacts.yml
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@5
condition: and(succeededOrFailed(), eq(variables['CollectCoverage'], 'true'), eq(variables['coverage.collected'], 'true'))
displayName: Generate Code Coverage Reports
Expand Down
29 changes: 29 additions & 0 deletions eng/pipelines/templates/steps/upload-llm-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This template serves as a place to upload artifacts intended to be used by LLMs
# that handle data from the pipeline (for example github copilot).

steps:
- pwsh: |
$artifactsDirectory = "$(Build.ArtifactStagingDirectory)/llm-artifacts"
New-Item $artifactsDirectory -ItemType directory -Force

Write-Host "================="
Get-ChildItem -Path $(TestTargetFramework)*.trx -Recurse -File
Write-Host "================="

foreach($testResultsFile in (Get-ChildItem -Path $(TestTargetFramework)*.trx -Recurse -File))
{
$fileFullName = $testResultsFile.FullName

# Convert a path like
# /mnt/vss/_work/1/s/sdk/template/Azure.Template/tests/TestResults/net8.0.trx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to update the trx file name at the source?

# to
# template-Azure.Template-net8.0.trx
$serviceAndPackage = ($fileFullName -split 'sdk[\\/]|[\\/]tests')[1] -replace '[\\/]', '-'
$trxFile = Split-Path $fileFullName -Leaf
$fileName = "$serviceAndPackage-$trxFile"

Move-Item -Path $fileFullName -Destination "$artifactsDirectory/$fileName" -ErrorAction Continue
Write-Host "##vso[task.setvariable variable=uploadTestResults]true"
}
condition: succeededOrFailed()
displayName: Copy test results files to llm artifacts staging directory