Skip to content

Commit e57a410

Browse files
authored
Onboard the official build to 1ES pipeline templates (#1223)
1 parent f44b7a5 commit e57a410

2 files changed

Lines changed: 246 additions & 116 deletions

File tree

azure-pipelines-PR.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Branches that trigger builds on PR
2+
pr:
3+
branches:
4+
include:
5+
- main
6+
- release/*
7+
paths:
8+
exclude:
9+
- README.md
10+
- docs/*
11+
12+
# Run official build every day at midnight, if code has changed since the last run.
13+
schedules:
14+
- cron: "0 0 * * *"
15+
displayName: Daily Official Build
16+
branches:
17+
include:
18+
- main
19+
20+
variables:
21+
- template: /eng/common/templates/variables/pool-providers.yml
22+
- name: _TeamName
23+
value: Roslyn
24+
25+
stages:
26+
- stage: build
27+
displayName: Build
28+
jobs:
29+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
30+
- template: /eng/common/templates/job/onelocbuild.yml
31+
parameters:
32+
MirrorRepo: sourcelink
33+
LclSource: lclFilesfromPackage
34+
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
35+
- template: /eng/common/templates/jobs/jobs.yml
36+
parameters:
37+
enableMicrobuild: true
38+
enablePublishBuildArtifacts: true
39+
enablePublishTestResults: true
40+
enablePublishBuildAssets: true
41+
enablePublishUsingPipelines: true
42+
enableTelemetry: true
43+
enableSourceBuild: true
44+
helixRepo: dotnet/symreader
45+
jobs:
46+
- job: Windows
47+
pool:
48+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
49+
vmImage: 'windows-latest'
50+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
51+
name: $(DncEngInternalBuildPool)
52+
demands: ImageOverride -equals 1es-windows-2022
53+
variables:
54+
# Only enable publishing in official builds
55+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
56+
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
57+
- group: Publish-Build-Assets
58+
- name: _OfficialBuildArgs
59+
value: /p:DotNetSignType=$(_SignType)
60+
/p:DotNetPublishUsingPipelines=true
61+
/p:TeamName=$(_TeamName)
62+
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
63+
# else
64+
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
65+
- name: _OfficialBuildArgs
66+
value: ''
67+
strategy:
68+
matrix:
69+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
70+
Debug:
71+
_BuildConfig: Debug
72+
_SignType: test
73+
_BuildArgs: ''
74+
Release:
75+
_BuildConfig: Release
76+
# PRs or external builds are not signed.
77+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
78+
_SignType: test
79+
_BuildArgs: ''
80+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
81+
_SignType: real
82+
_BuildArgs: $(_OfficialBuildArgs)
83+
steps:
84+
- checkout: self
85+
clean: true
86+
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
87+
displayName: Build and Test
88+
89+
# Archive NuGet packages to DevOps (workaround for https://github.com/dotnet/arcade/issues/4444)
90+
- task: PublishBuildArtifacts@1
91+
displayName: Publish Artifact Packages
92+
inputs:
93+
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
94+
ArtifactName: 'Packages'
95+
condition: succeeded()
96+
97+
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
98+
- job: MacOS
99+
displayName: 'MacOS'
100+
pool:
101+
vmImage: 'macOS-latest'
102+
strategy:
103+
matrix:
104+
Debug:
105+
_BuildConfig: Debug
106+
_SignType: none
107+
Release:
108+
_BuildConfig: Release
109+
_SignType: none
110+
steps:
111+
- checkout: self
112+
clean: true
113+
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
114+
displayName: Build and Test
115+
116+
- job: Linux
117+
displayName: 'Linux'
118+
pool:
119+
vmImage: 'ubuntu-latest'
120+
strategy:
121+
matrix:
122+
Debug:
123+
_BuildConfig: Debug
124+
_SignType: none
125+
Release:
126+
_BuildConfig: Release
127+
_SignType: none
128+
steps:
129+
- checkout: self
130+
clean: true
131+
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
132+
displayName: Build and Test
133+
134+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
135+
- template: eng\common\templates\post-build\post-build.yml

azure-pipelines.yml

Lines changed: 111 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Branches that trigger builds on PR
21
pr:
32
branches:
43
include:
@@ -8,128 +7,124 @@ pr:
87
exclude:
98
- README.md
109
- docs/*
11-
12-
# Run official build every day at midnight, if code has changed since the last run.
1310
schedules:
1411
- cron: "0 0 * * *"
1512
displayName: Daily Official Build
1613
branches:
1714
include:
1815
- main
19-
2016
variables:
21-
- template: /eng/common/templates/variables/pool-providers.yml
22-
- name: _TeamName
23-
value: Roslyn
24-
25-
stages:
26-
- stage: build
27-
displayName: Build
28-
jobs:
29-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
30-
- template: /eng/common/templates/job/onelocbuild.yml
31-
parameters:
32-
MirrorRepo: sourcelink
33-
LclSource: lclFilesfromPackage
34-
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
35-
- template: /eng/common/templates/jobs/jobs.yml
36-
parameters:
37-
enableMicrobuild: true
38-
enablePublishBuildArtifacts: true
39-
enablePublishTestResults: true
40-
enablePublishBuildAssets: true
41-
enablePublishUsingPipelines: true
42-
enableTelemetry: true
43-
enableSourceBuild: true
44-
helixRepo: dotnet/symreader
17+
- template: /eng/common/templates-official/variables/pool-providers.yml@self
18+
- name: _TeamName
19+
value: Roslyn
20+
- name: TeamName
21+
value: Roslyn
22+
resources:
23+
repositories:
24+
- repository: MicroBuildTemplate
25+
type: git
26+
name: 1ESPipelineTemplates/MicroBuildTemplate
27+
ref: refs/tags/release
28+
extends:
29+
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
30+
parameters:
31+
sdl:
32+
sourceAnalysisPool:
33+
name: $(DncEngInternalBuildPool)
34+
image: 1es-windows-2022-pt
35+
os: windows
36+
customBuildTags:
37+
- ES365AIMigrationTooling
38+
stages:
39+
- stage: build
40+
displayName: Build
4541
jobs:
46-
- job: Windows
47-
pool:
48-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
49-
vmImage: 'windows-latest'
50-
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
51-
name: $(DncEngInternalBuildPool)
52-
demands: ImageOverride -equals 1es-windows-2022
53-
variables:
54-
# Only enable publishing in official builds
55-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
56-
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
57-
- group: Publish-Build-Assets
58-
- name: _OfficialBuildArgs
59-
value: /p:DotNetSignType=$(_SignType)
60-
/p:DotNetPublishUsingPipelines=true
61-
/p:TeamName=$(_TeamName)
62-
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
63-
# else
64-
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
65-
- name: _OfficialBuildArgs
66-
value: ''
67-
strategy:
68-
matrix:
69-
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
70-
Debug:
71-
_BuildConfig: Debug
72-
_SignType: test
73-
_BuildArgs: ''
74-
Release:
75-
_BuildConfig: Release
76-
# PRs or external builds are not signed.
42+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
43+
- template: /eng/common/templates-official/job/onelocbuild.yml@self
44+
parameters:
45+
MirrorRepo: sourcelink
46+
LclSource: lclFilesfromPackage
47+
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
48+
- template: /eng/common/templates-official/jobs/jobs.yml@self
49+
parameters:
50+
enableMicrobuild: true
51+
enablePublishBuildArtifacts: true
52+
enablePublishTestResults: true
53+
enablePublishBuildAssets: true
54+
enablePublishUsingPipelines: true
55+
enableTelemetry: true
56+
enableSourceBuild: true
57+
helixRepo: dotnet/symreader
58+
jobs:
59+
- job: Windows
60+
pool:
7761
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
78-
_SignType: test
79-
_BuildArgs: ''
62+
vmImage: 'windows-latest'
8063
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
81-
_SignType: real
82-
_BuildArgs: $(_OfficialBuildArgs)
83-
steps:
84-
- checkout: self
85-
clean: true
86-
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
87-
displayName: Build and Test
88-
89-
# Archive NuGet packages to DevOps (workaround for https://github.com/dotnet/arcade/issues/4444)
90-
- task: PublishBuildArtifacts@1
91-
displayName: Publish Artifact Packages
92-
inputs:
93-
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
94-
ArtifactName: 'Packages'
95-
condition: succeeded()
96-
97-
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
98-
- job: MacOS
99-
displayName: 'MacOS'
100-
pool:
101-
vmImage: 'macOS-latest'
102-
strategy:
103-
matrix:
104-
Debug:
105-
_BuildConfig: Debug
106-
_SignType: none
107-
Release:
108-
_BuildConfig: Release
109-
_SignType: none
110-
steps:
111-
- checkout: self
112-
clean: true
113-
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
114-
displayName: Build and Test
115-
116-
- job: Linux
117-
displayName: 'Linux'
118-
pool:
119-
vmImage: 'ubuntu-latest'
120-
strategy:
121-
matrix:
122-
Debug:
123-
_BuildConfig: Debug
124-
_SignType: none
125-
Release:
126-
_BuildConfig: Release
127-
_SignType: none
128-
steps:
129-
- checkout: self
130-
clean: true
131-
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
132-
displayName: Build and Test
133-
134-
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
135-
- template: eng\common\templates\post-build\post-build.yml
64+
name: $(DncEngInternalBuildPool)
65+
demands: ImageOverride -equals 1es-windows-2022
66+
variables:
67+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
68+
- group: Publish-Build-Assets
69+
- name: _OfficialBuildArgs
70+
value: /p:DotNetSignType=$(_SignType) /p:DotNetPublishUsingPipelines=true /p:TeamName=$(_TeamName) /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
71+
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
72+
- name: _OfficialBuildArgs
73+
value: ''
74+
strategy:
75+
matrix:
76+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
77+
Debug:
78+
_BuildConfig: Debug
79+
_SignType: test
80+
_BuildArgs: ''
81+
Release:
82+
_BuildConfig: Release
83+
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
84+
_SignType: test
85+
_BuildArgs: ''
86+
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
87+
_SignType: real
88+
_BuildArgs: $(_OfficialBuildArgs)
89+
steps:
90+
- checkout: self
91+
clean: true
92+
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
93+
displayName: Build and Test
94+
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
95+
- job: MacOS
96+
displayName: 'MacOS'
97+
pool:
98+
vmImage: 'macOS-latest'
99+
strategy:
100+
matrix:
101+
Debug:
102+
_BuildConfig: Debug
103+
_SignType: none
104+
Release:
105+
_BuildConfig: Release
106+
_SignType: none
107+
steps:
108+
- checkout: self
109+
clean: true
110+
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
111+
displayName: Build and Test
112+
- job: Linux
113+
displayName: 'Linux'
114+
pool:
115+
vmImage: 'ubuntu-latest'
116+
strategy:
117+
matrix:
118+
Debug:
119+
_BuildConfig: Debug
120+
_SignType: none
121+
Release:
122+
_BuildConfig: Release
123+
_SignType: none
124+
steps:
125+
- checkout: self
126+
clean: true
127+
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
128+
displayName: Build and Test
129+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
130+
- template: /eng/common/templates-official/post-build/post-build.yml@self

0 commit comments

Comments
 (0)