8000 Reintroduce support for building VMR from repo PR/CI (#548) · dotnet/dotnet@094631c · GitHub
[go: up one dir, main page]

Skip to content

Commit 094631c

Browse files
Reintroduce support for building VMR from repo PR/CI (#548)
1 parent 20248d6 commit 094631c

File tree

6 files changed

+112
-8
lines changed

6 files changed

+112
-8
lines changed

eng/pipelines/templates/jobs/vmr-build.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ parameters:
114114
type: stepList
115115
default: []
116116

117+
#### repo parameters ####
118+
119+
- name: isBuiltFromVmr
120+
displayName: True when build is running from dotnet/dotnet directly
121+
type: boolean
122+
117123
jobs:
118124
- job: ${{ parameters.buildName }}_${{ parameters.targetArchitecture }}${{ replace(format('_BuildPass{0}', coalesce(parameters.buildPass, '1')), '_BuildPass1', '') }}
119125
pool: ${{ parameters.pool }}
@@ -160,8 +166,13 @@ jobs:
160166
value: ''
161167
- name: runTestsTimeout
162168
value: 30
163-
- name: vmrPath
164-
value: $(Build.SourcesDirectory)
169+
170+
- ${{ if parameters.isBuiltFromVmr }}:
171+
- name: vmrPath
172+
value: $(Build.SourcesDirectory)
173+
- ${{ else }}:
174+
- name: vmrPath
175+
value: $(Agent.BuildDirectory)/vmr
165176

166177
# Location of the VMR sources
167178
# We either build the repo directly, or we extract them outside (which is what partners do)
@@ -270,7 +281,7 @@ jobs:
270281
timeoutInMinutes: 720
271282
## Currently, CodeQL slows the build down too much
272283
## https://github.com/dotnet/source-build/issues/4276
273-
${{ elseif and(startswith(parameters.buildName, 'Windows'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
284+
${{ elseif and(parameters.isBuiltFromVmr, startswith(parameters.buildName, 'Windows'), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
274285
timeoutInMinutes: 720
275286
${{ else }}:
276287
timeoutInMinutes: 240
@@ -312,6 +323,13 @@ jobs:
312323
sbomEnabled: false
313324

314325
steps:
326+
- ${{ if not(parameters.isBuiltFromVmr) }}:
327+
# Synchronize new content in the VMR during PRs
328+
- template: /eng/common/templates/steps/vmr-pull-updates.yml@self
329+
parameters:
330+
vmrPath: $(vmrPath)
331+
targetRef: $(Build.SourceVersion) # Synchronize the current repo commit
332+
315333
- ${{ if parameters.buildFromArchive }}:
316334
- script: |
317335
set -ex
@@ -323,7 +341,7 @@ jobs:
323341
- ${{ if ne(parameters.reuseBuildArtifactsFrom,'') }}:
324342
- ${{ each reuseBuildArtifacts in parameters.reuseBuildArtifactsFrom }}:
325343
- ${{ if eq(parameters.buildSourceOnly, true) }}:
326-
- template: ../steps/download-artifacts.yml@self
344+
- template: ../steps/download-artifacts.yml
327345
parameters:
328346
artifactDescription: Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
329347
artifactName: ${{ reuseBuildArtifacts }}_Artifacts

eng/pipelines/templates/stages/source-build-and-validate.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ parameters:
1515
- name: legs
1616
type: object
1717

18+
# True when build is running from dotnet/dotnet directly
19+
- name: isBuiltFromVmr
20+
type: boolean
21+
default: true
22+
1823
stages:
1924
- stage: VMR_SourceOnly_Build
2025
displayName: VMR Source-Only Build
@@ -83,6 +88,7 @@ stages:
8388
targetRid: ${{ variables.alpineX64Rid }}
8489

8590
targetArchitecture: ${{ leg.targetArchitecture }}
91+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
8692
${{ if eq(leg.targetArchitecture, 'arm64') }}:
8793
pool: ${{ parameters.pool_LinuxArm64 }}
8894
${{ else }}:
@@ -150,6 +156,7 @@ stages:
150156
targetRid: ${{ variables.alpineX64Rid }}
151157

152158
targetArchitecture: ${{ leg.targetArchitecture }}
159+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
153160
${{ if eq(leg.targetArchitecture, 'arm64') }}:
154161
pool: ${{ parameters.pool_LinuxArm64 }}
155162
${{ else }}:

eng/pipelines/templates/stages/source-build-stages.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ parameters:
1414
type: boolean
1515
default: true
1616

17+
# True when build is running from dotnet/dotnet directly
18+
- name: isBuiltFromVmr
19+
type: boolean
20+
default: true
21+
1722
# Temporarily needed to enable SB PR legs from the unified build pipeline
1823
# This parameter should be removed with https://github.com/do 9E7A tnet/dotnet/pull/400
1924
- name: officialBuildId
@@ -27,6 +32,7 @@ stages:
2732
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
2833
scope: ${{ parameters.scope }}
2934
useMicrosoftBuildAssetsForTests: ${{ parameters.useMicrosoftBuildAssetsForTests }}
35+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
3036

3137
# Description of the source build legs to run.
3238
# This is described here as a parameter to allow two separate stages to be produced from this list (one for building

eng/pipelines/templates/stages/vmr-build-with-join.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ parameters:
1010
- name: finalJoinCondition
1111
type: boolean
1212

13+
#### repo parameters ####
14+
- name: isBuiltFromVmr
15+
displayName: True when build is running from dotnet/dotnet directly
16+
type: boolean
17+
1318
# These are not expected to be passed it but rather just object variables reused below
1419
- name: pool_Linux
1520
type: object
@@ -66,8 +71,12 @@ stages:
6671
- ${{ if ne(stage.templateContext.validationOnly, 'true') }}:
6772
- ${{ stage.stage }}
6873
variables:
69-
- name: vmrPath
70-
value: $(Build.SourcesDirectory)
74+
- ${{ if parameters.isBuiltFromVmr }}:
75+
- name: vmrPath
76+
value: $(Build.SourcesDirectory)
77+
- ${{ else }}:
78+
- name: vmrPath
79+
value: $(Agent.BuildDirectory)/vmr
7180
- template: ../variables/vmr-build.yml
7281
jobs:
7382
- job: FinalJoin
@@ -129,6 +138,11 @@ stages:
129138
inputs:
130139
path: $(Build.ArtifactStagingDirectory)/VerticalArtifacts/${{ vertical.job }}
131140
artifactName: ${{ vertical.job }}_Artifacts
141+
- ${{ if not(parameters.isBuiltFromVmr) }}:
142+
- template: /eng/common/templates/steps/vmr-pull-updates.yml@self
143+
parameters:
144+
vmrPath: ${{ variables.vmrPath }}
145+
targetRef: $(Build.SourceVersion) # Synchronize the current repo commit
132146
- template: ../steps/vmr-join-verticals.yml
133147
parameters:
134148
dotNetBuildPass: final

eng/pipelines/templates/stages/vmr-build.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ parameters:
2121
# run everything
2222
- full
2323

24+
# True when build is running from dotnet/dotnet directly
25+
- name: isBuiltFromVmr
26+
type: boolean
27+
default: true
28+
2429
# True when building the VMR in source-only mode
2530
- name: isSourceOnlyBuild
2631
type: boolean
@@ -76,15 +81,17 @@ stages:
7681
parameters:
7782
desiredSigning: ${{ parameters.desiredSigning }}
7883
desiredIbc: ${{ parameters.desiredIbc }}
84+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
7985
scope: ${{ parameters.scope }}
8086
isSourceOnlyBuild: ${{ parameters.isSourceOnlyBuild }}
8187
finalJoinCondition: ${{ and(not(parameters.isSourceOnlyBuild), eq(parameters.scope, 'full')) }}
88+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
8289
postJoinStages:
83-
- ${{ if and(not(parameters.isSourceOnlyBuild), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
90+
- ${{ if and(parameters.isBuiltFromVmr, not(parameters.isSourceOnlyBuild), eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
8491
- stage: Publish_Build_Assets
8592
displayName: Publish Assets
8693
jobs:
87-
- template: /eng/common/templates-official/job/publish-build-assets.yml@self
94+
- template: /eng/common/templates-official/job/publish-build-assets.yml
8895
parameters:
8996
publishUsingPipelines: true
9097
publishAssetsImmediately: true
@@ -104,11 +111,13 @@ stages:
104111
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
105112
scope: ${{ parameters.scope }}
106113
useMicrosoftBuildAssetsForTests: false
114+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
107115
- ${{ else }}:
108116
- template: source-build-stages.yml
109117
parameters:
110118
pool_Linux: ${{ parameters.pool_Linux }}
111119
pool_LinuxArm64: ${{ parameters.pool_LinuxArm64 }}
120+
isBuiltFromVmr: ${{ parameters.isBuiltFromVmr }}
112121
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
113122
scope: ultralite
114123
# Temporarily needed to enable SB PR legs from the unified build pipeline

0 commit comments

Comments
 (0)
0