Skip to content

Commit 486fc17

Browse files
authored
Batched Build and Analyze for Pullrequests (Azure#48564)
* refactor `build` and `analyze` steps into their own step templates * refactor the necessary pre-steps in front of `Create-PrJobMatrix` to a common template * on pullrequests, 'build' and 'analyze' phases are now batched -- meaning we will duplicate the jobs as necessary
1 parent ef6924c commit 486fc17

File tree

9 files changed

+549
-318
lines changed

9 files changed

+549
-318
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
parameters:
2+
- name: Artifacts
3+
type: object
4+
default: []
5+
- name: TestPipeline
6+
type: boolean
7+
default: false
8+
- name: ServiceDirectory
9+
type: string
10+
default: not-specified
11+
- name: SDKType
12+
type: string
13+
default: all
14+
- name: CheckAOTCompat
15+
type: boolean
16+
default: false
17+
- name: AOTTestInputs
18+
type: object
19+
default: []
20+
- name: BuildSnippets
21+
type: boolean
22+
default: true
23+
- name: DependsOn
24+
type: string
25+
default: ''
26+
- name: CloudConfig
27+
type: object
28+
default: {}
29+
- name: Matrix
30+
type: string
31+
- name: UsePlatformContainer
32+
type: boolean
33+
default: false
34+
- name: OSName
35+
type: string
36+
37+
jobs:
38+
- job:
39+
displayName: "Build"
40+
dependsOn: ${{ parameters.DependsOn }}
41+
condition: and(succeededOrFailed(), ne(${{ parameters.Matrix }}, '{}'))
42+
strategy:
43+
matrix: $[ ${{ parameters.Matrix }} ]
44+
45+
variables:
46+
- template: /eng/pipelines/templates/variables/codeql.yml
47+
- name: Codeql.BuildIdentifier
48+
value: ${{ parameters.ServiceDirectory }}
49+
- name: SDKType
50+
value: ${{ parameters.SDKType }}
51+
52+
pool:
53+
# 1es pipeline templates converts `image` to demands: ImageOverride under the hood
54+
# which is incompatible with image selection in the default non-1es hosted pools
55+
${{ if eq(parameters.OSName, 'macOS') }}:
56+
vmImage: $(OSVmImage)
57+
${{ else }}:
58+
image: $(OSVmImage)
59+
name: $(Pool)
60+
os: ${{ parameters.OSName }}
61+
${{ if eq(parameters.UsePlatformContainer, 'true') }}:
62+
# Add a default so the job doesn't fail when the matrix is empty
63+
container: $[ variables['Container'] ]
64+
65+
steps:
66+
- template: /eng/pipelines/templates/steps/build.yml
67+
parameters:
68+
Artifacts: ${{ parameters.Artifacts }}
69+
TestPipeline: ${{ parameters.TestPipeline }}
70+
ServiceDirectory: ${{ parameters.ServiceDirectory }}
71+
SDKType: ${{ parameters.SDKType }}
72+
CheckAOTCompat: ${{ parameters.CheckAOTCompat }}
73+
AOTTestInputs: ${{ parameters.AOTTestInputs }}
74+
75+
- job:
76+
displayName: "Analyze"
77+
dependsOn: ${{ parameters.DependsOn }}
78+
condition: and(succeededOrFailed(), ne(${{ parameters.Matrix }}, '{}'))
79+
80+
# allow duplication of the job by matrix
81+
strategy:
82+
matrix: $[ ${{ parameters.Matrix }} ]
83+
84+
# but immediately ignore the matrix for the job name
85+
pool:
86+
name: $(LINUXPOOL)
87+
image: $(LINUXVMIMAGE)
88+
os: linux
89+
90+
steps:
91+
- template: /eng/pipelines/templates/steps/analyze.yml
92+
parameters:
93+
Artifacts: ${{ parameters.Artifacts }}
94+
ServiceDirectory: ${{ parameters.ServiceDirectory }}
95+
SDKType: ${{ parameters.SDKType }}
96+
BuildSnippets: ${{ parameters.BuildSnippets }}

0 commit comments

Comments
 (0)