Skip to content

Commit cbdac33

Browse files
benbpscbedd
authored andcommitted
Support dynamic+hardcode matrix pool hybrid
1 parent 704a6ba commit cbdac33

File tree

10 files changed

+244
-170
lines changed

10 files changed

+244
-170
lines changed

eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml

Lines changed: 70 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ parameters:
2727
default: []
2828
- name: Pool
2929
type: string
30-
default: azsdk-pool-mms-ubuntu-2004-1es-pt
30+
default: azsdk-pool-mms-ubuntu-2204-general
3131
- name: OsVmImage
3232
type: string
33-
default: azsdk-pool-mms-ubuntu-2004-1espt
34-
- name: OS
33+
default: ubuntu-22.04
34+
- name: Os
3535
type: string
3636
default: linux
3737
# This parameter is only necessary if there are multiple invocations of this template within the SAME STAGE.
@@ -42,16 +42,31 @@ parameters:
4242
- name: PreGenerationSteps
4343
type: stepList
4444
default: []
45+
# Mappings to OS name required at template compile time by 1es pipeline templates
46+
- name: Pools
47+
type: object
48+
default:
49+
- name: LinuxPool
50+
os: linux
51+
- name: LinuxNextPool
52+
os: linux
53+
- name: WindowsPool
54+
os: windows
55+
- name: MacPool
56+
os: macOS
4557

4658
jobs:
4759
- job: ${{ parameters.GenerateJobName }}
4860
variables:
49-
skipComponentGovernanceDetection: true
50-
displayNameFilter: $[ coalesce(variables.jobMatrixFilter, '.*') ]
61+
- template: /eng/pipelines/templates/variables/image.yml
62+
- name: skipComponentGovernanceDetection
63+
value: true
64+
- name: displayNameFilter
65+
value: $[ coalesce(variables.jobMatrixFilter, '.*') ]
5166
pool:
5267
name: ${{ parameters.Pool }}
5368
vmImage: ${{ parameters.OsVmImage }}
54-
os: ${{ parameters.OS }}
69+
os: ${{ parameters.Os }}
5570
${{ if parameters.DependsOn }}:
5671
dependsOn: ${{ parameters.DependsOn }}
5772
steps:
@@ -69,52 +84,56 @@ jobs:
6984
- ${{ parameters.PreGenerationSteps }}
7085

7186
- ${{ each config in parameters.MatrixConfigs }}:
72-
- ${{ if eq(config.GenerateVMJobs, 'true') }}:
73-
- task: Powershell@2
74-
inputs:
75-
pwsh: true
76-
filePath: eng/common/scripts/job-matrix/Create-JobMatrix.ps1
77-
arguments: >
78-
-ConfigPath ${{ config.Path }}
79-
-Selection ${{ config.Selection }}
80-
-DisplayNameFilter '$(displayNameFilter)'
81-
-Filters '${{ join(''',''', parameters.MatrixFilters) }}','container=^$','SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}'
82-
-Replace '${{ join(''',''', parameters.MatrixReplace) }}'
83-
-NonSparseParameters '${{ join(''',''', config.NonSparseParameters) }}'
84-
displayName: Generate VM Job Matrix ${{ config.Name }}
85-
name: generate_vm_job_matrix_${{ config.Name }}
87+
- ${{ each pool in parameters.Pools }}:
88+
- ${{ if eq(config.GenerateVMJobs, 'true') }}:
89+
- task: Powershell@2
90+
inputs:
91+
pwsh: true
92+
filePath: eng/common/scripts/job-matrix/Create-JobMatrix.ps1
93+
arguments: >
94+
-ConfigPath ${{ config.Path }}
95+
-Selection ${{ config.Selection }}
96+
-DisplayNameFilter '$(displayNameFilter)'
97+
-Filters '${{ join(''',''', parameters.MatrixFilters) }}', 'container=^$', 'SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}', 'Pool=.*${{ pool.name }}$'
98+
-Replace '${{ join(''',''', parameters.MatrixReplace) }}'
99+
-NonSparseParameters '${{ join(''',''', config.NonSparseParameters) }}'
100+
displayName: Create ${{ pool.name }} Matrix ${{ config.Name }}
101+
name: vm_job_matrix_${{ config.Name }}_${{ pool.name }}
86102

87-
- ${{ if eq(config.GenerateContainerJobs, 'true') }}:
88-
- task: Powershell@2
89-
inputs:
90-
pwsh: true
91-
filePath: eng/common/scripts/job-matrix/Create-JobMatrix.ps1
92-
arguments: >
93-
-ConfigPath ${{ config.Path }}
94-
-Selection ${{ config.Selection }}
95-
-DisplayNameFilter '$(displayNameFilter)'
96-
-Filters '${{ join(''',''', parameters.MatrixFilters) }}', 'container=.*', 'SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}'
97-
-NonSparseParameters '${{ join(''',''', config.NonSparseParameters) }}'
98-
displayName: Generate Container Job Matrix
99-
name: generate_container_job_matrix_${{ config.Name }}
103+
- ${{ if eq(config.GenerateContainerJobs, 'true') }}:
104+
- task: Powershell@2
105+
inputs:
106+
pwsh: true
107+
filePath: eng/common/scripts/job-matrix/Create-JobMatrix.ps1
108+
arguments: >
109+
-ConfigPath ${{ config.Path }}
110+
-Selection ${{ config.Selection }}
111+
-DisplayNameFilter '$(displayNameFilter)'
112+
-Filters '${{ join(''',''', parameters.MatrixFilters) }}', 'container=^$', 'SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}', 'Pool=.*${{ pool.name }}$'
113+
-NonSparseParameters '${{ join(''',''', config.NonSparseParameters) }}'
114+
displayName: Create ${{ pool.name }} Container Matrix ${{ config.Name }}
115+
name: container_job_matrix_${{ config.Name }}_${{ pool.name }}
100116

101117
- ${{ each config in parameters.MatrixConfigs }}:
102-
- ${{ if eq(config.GenerateVMJobs, 'true') }}:
103-
- template: ${{ parameters.JobTemplatePath }}
104-
parameters:
105-
UsePlatformContainer: false
106-
Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['generate_vm_job_matrix_${{ config.Name }}.matrix']
107-
DependsOn: ${{ parameters.GenerateJobName }}
108-
CloudConfig: ${{ parameters.CloudConfig }}
109-
${{ each param in parameters.AdditionalParameters }}:
110-
${{ param.key }}: ${{ param.value }}
118+
- ${{ each pool in parameters.Pools }}:
119+
- ${{ if eq(config.GenerateVMJobs, 'true') }}:
120+
- template: ${{ parameters.JobTemplatePath }}
121+
parameters:
122+
UsePlatformContainer: false
123+
OSName: ${{ pool.os }}
124+
Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['vm_job_matrix_${{ config.Name }}_${{ pool.name }}.matrix']
125+
DependsOn: ${{ parameters.GenerateJobName }}
126+
CloudConfig: ${{ parameters.CloudConfig }}
127+
${{ each param in parameters.AdditionalParameters }}:
128+
${{ param.key }}: ${{ param.value }}
111129

112-
- ${{ if eq(config.GenerateContainerJobs, 'true') }}:
113-
- template: ${{ parameters.JobTemplatePath }}
114-
parameters:
115-
UsePlatformContainer: true
116-
Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['generate_container_job_matrix_${{ config.Name }}.matrix']
117-
DependsOn: ${{ parameters.GenerateJobName }}
118-
CloudConfig: ${{ parameters.CloudConfig }}
119-
${{ each param in parameters.AdditionalParameters }}:
120-
${{ param.key }}: ${{ param.value }}
130+
- ${{ if eq(config.GenerateContainerJobs, 'true') }}:
131+
- template: ${{ parameters.JobTemplatePath }}
132+
parameters:
133+
UsePlatformContainer: true
134+
OSName: ${{ pool.os }}
135+
Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['vm_job_matrix_${{ config.Name }}_${{ pool.name }}.matrix']
136+
DependsOn: ${{ parameters.GenerateJobName }}
137+
CloudConfig: ${{ parameters.CloudConfig }}
138+
${{ each param in parameters.AdditionalParameters }}:
139+
${{ param.key }}: ${{ param.value }}

eng/common/scripts/Verify-AgentOS.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function Throw-InvalidOperatingSystem {
1010

1111
if ($IsWindows -and $AgentImage -match "windows|win|MMS\d{4}") {
1212
$osName = "Windows"
13-
} elseif ($IsLinux -and $AgentImage -match "ubuntu") {
13+
} elseif ($IsLinux -and $AgentImage -match "ubuntu|linux") {
1414
$osName = "Linux"
15-
} elseif ($IsMacOs -and $AgentImage -match "macos") {
15+
} elseif ($IsMacOs -and $AgentImage -match "macos|macOS") {
1616
$osName = "macOS"
1717
} else {
1818
Throw-InvalidOperatingSystem

0 commit comments

Comments
 (0)