-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Sync eng/common directory with azure-sdk-tools for PR 14420 #48401
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
base: main
Are you sure you want to change the base?
Changes from all commits
8a19c3c
6f13349
1850561
40b8ee1
c665e73
c110a8a
1246dae
da907cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| parameters: | ||
| - name: BenchmarkProject | ||
| type: string | ||
| default: 'tools/azsdk-cli/Azure.Sdk.Tools.Cli.Benchmarks' | ||
| - name: ScenarioName | ||
| type: string | ||
| default: ' ' | ||
| - name: Tags | ||
| type: string | ||
| default: ' ' | ||
| - name: Model | ||
| type: string | ||
| default: ' ' | ||
| - name: Parallelism | ||
| type: number | ||
| default: 5 | ||
|
|
||
| jobs: | ||
| - job: Run_Benchmark | ||
| variables: | ||
| - template: /eng/pipelines/templates/variables/globals.yml | ||
| - template: /eng/pipelines/templates/variables/image.yml | ||
| - group: 'AzSDK_Eval_Variable_group' | ||
|
||
| displayName: 'Run Benchmark' | ||
| pool: | ||
| name: $(LINUXPOOL) | ||
| image: $(LINUXVMIMAGE) | ||
| os: linux | ||
|
|
||
| steps: | ||
| - checkout: none | ||
|
|
||
| - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml | ||
| parameters: | ||
| SkipCheckoutNone: true | ||
| Repositories: | ||
| - Name: $(Build.Repository.Name) | ||
| Commitish: $(Build.SourceVersion) | ||
| WorkingDirectory: $(System.DefaultWorkingDirectory)/$(Build.Repository.Name) | ||
| Paths: | ||
| - '${{ parameters.BenchmarkProject }}/**' | ||
| - 'eng/common/**' | ||
|
|
||
| - template: /eng/pipelines/templates/steps/install-dotnet.yml | ||
|
|
||
| - task: PowerShell@2 | ||
| displayName: 'Run benchmarks' | ||
| condition: succeeded() | ||
| inputs: | ||
| targetType: 'inline' | ||
| workingDirectory: '$(System.DefaultWorkingDirectory)/$(Build.Repository.Name)/${{ parameters.BenchmarkProject }}' | ||
| pwsh: true | ||
| script: | | ||
| $cliArgs = @("run") | ||
|
|
||
| # Determine scenario selection: name, tags, or all | ||
| if ("${{ parameters.ScenarioName }}".Trim()) { | ||
| $cliArgs += "${{ parameters.ScenarioName }}".Trim() | ||
| } elseif ("${{ parameters.Tags }}".Trim()) { | ||
| $cliArgs += "--tags", "${{ parameters.Tags }}".Trim() | ||
| } else { | ||
| $cliArgs += "--all" | ||
| } | ||
|
|
||
| # Optional model override | ||
| if ("${{ parameters.Model }}".Trim()) { | ||
| $cliArgs += "--model", "${{ parameters.Model }}".Trim() | ||
| } | ||
|
|
||
| $cliArgs += "--parallel", "${{ parameters.Parallelism }}" | ||
| $cliArgs += "--cleanup", "always" | ||
|
|
||
| Write-Host "Running: dotnet run -- $($cliArgs -join ' ')" | ||
| dotnet run -- @cliArgs | ||
| env: | ||
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_MULTILEVEL_LOOKUP: 0 | ||
| COPILOT_GITHUB_TOKEN: $(azuresdk-copilot-github-pat) | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These parameters default to a single space (
' ') and then rely on.Trim()in the script. Using an empty string default ('') avoids surprising whitespace behavior and removes the need for trimming to detect “unset” values (same applies to Tags/Model).