Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 3874 (#25874)
Browse files Browse the repository at this point in the history
* Add sparse checkout to perf template

* Rename base template, add parameters

* Add comment

* Add TODO

* Fix copy/pase bug, add language to artifacts path

* Fix language ref

* Fix python language

* perf.yml extends perf-base.yml

* Remove unnecessary base yml

* Fetch pull request refs

* Fix refs path

* Fetch commitish if matches PR syntax

* Print command before running

* Add PR commitish to remote.origin.fetch

* Add pool and vmimage parameters

* Map ref under "refs/remotes/origin"

* Add ref to refs/remotes/origin

Co-authored-by: Mike Harder <mharder@microsoft.com>
  • Loading branch information
azure-sdk and mikeharder authored Aug 25, 2022
1 parent dc202f9 commit dc1a710
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 26 deletions.
74 changes: 50 additions & 24 deletions eng/common/pipelines/templates/jobs/perf.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
parameters:
- name: JobName
type: string
default: 'Perf'
- name: LinuxPool
type: string
default: 'azsdk-pool-mms-ubuntu-2004-perf'
- name: LinuxVmImage
type: string
default: 'MMSUbuntu20.04'
- name: WindowsPool
type: string
default: 'azsdk-pool-mms-win-2019-perf'
- name: WindowsVmImage
type: string
default: 'MMS2019'
- name: Language
type: string
default: ''
- name: LanguageRepoName
type: string
default: $(Build.Repository.Name)
- name: LanguageRepoCommitish
type: string
default: $(Build.SourceVersion)
- name: ToolsRepoCommitish
type: string
default: 'main'
- name: Variables
type: object
default: []
- name: OperatingSystems
type: string
default: 'Linux'
- name: Language
type: string
default: ''
- name: InstallLanguageSteps
type: stepList
default: []
Expand Down Expand Up @@ -36,41 +60,43 @@ parameters:
type: object
default: {}

resources:
repositories:
- repository: azure-sdk-tools
type: github
endpoint: Azure
name: Azure/azure-sdk-tools
ref: main

variables:
- ${{ parameters.Variables }}

jobs:
- job: Perf
- job: ${{ parameters.JobName }}
timeoutInMinutes: 360
strategy:
matrix:
${{ if contains(parameters.OperatingSystems, 'Linux') }}:
Linux:
Pool: 'azsdk-pool-mms-ubuntu-2004-perf'
OsVmImage: 'MMSUbuntu20.04'
Pool: ${{ parameters.LinuxPool }}
OsVmImage: ${{ parameters.LinuxVmImage }}
MatrixName: 'Linux'
${{ if contains(parameters.OperatingSystems, 'Windows') }}:
Windows:
Pool: 'azsdk-pool-mms-win-2019-perf'
OsVmImage: 'MMS2019'
Pool: ${{ parameters.WindowsPool }}
OsVmImage: ${{ parameters.WindowsVmImage }}
MatrixName: 'Windows'
variables:
- ${{ parameters.Variables }}
pool:
name: $(Pool)
vmImage: $(OSVmImage)
steps:
- checkout: self
path: s

- checkout: azure-sdk-tools
path: s/azure-sdk-tools
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
Paths:
- '/*'
- '!sdk/**/test-recordings/*'
- '!sdk/**/recordings/*'
- '!sdk/**/SessionRecords/*'
- '!sdk/**/session-records/*'
Repositories:
- Name: ${{ parameters.LanguageRepoName }}
Commitish: ${{ parameters.LanguageRepoCommitish }}
WorkingDirectory: $(System.DefaultWorkingDirectory)
- Name: Azure/azure-sdk-tools
Commitish: ${{ parameters.ToolsRepoCommitish }}
WorkingDirectory: $(System.DefaultWorkingDirectory)/azure-sdk-tools

- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
Expand Down Expand Up @@ -133,7 +159,7 @@ jobs:
- task: PublishPipelineArtifact@1
inputs:
targetPath: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
artifactName: results-$(MatrixName)
artifactName: results-${{ parameters.Language }}-$(MatrixName)
condition: always()

- template: /eng/common/TestResources/remove-test-resources.yml
Expand Down
9 changes: 7 additions & 2 deletions eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ steps:
} else {
Write-Host "Repository $($repository.Name) is being initialized."
Write-Host "git clone --no-checkout --filter=tree:0 https://github.com/$($repository.Name) ."
git clone --no-checkout --filter=tree:0 https://github.com/$($repository.Name) .
if ($repository.Commitish -match '^refs/pull/\d+/merge$') {
Write-Host "git clone --no-checkout --filter=tree:0 -c remote.origin.fetch='+$($repository.Commitish):refs/remotes/origin/$($repository.Commitish)' https://github.com/$($repository.Name) ."
git clone --no-checkout --filter=tree:0 -c remote.origin.fetch=''+$($repository.Commitish):refs/remotes/origin/$($repository.Commitish)'' https://github.com/$($repository.Name) .
} else {
Write-Host "git clone --no-checkout --filter=tree:0 https://github.com/$($repository.Name) ."
git clone --no-checkout --filter=tree:0 https://github.com/$($repository.Name) .
}
Write-Host "git sparse-checkout init"
git sparse-checkout init
Expand Down

0 comments on commit dc1a710

Please sign in to comment.