.vsts-ci.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. trigger:
  2. batch: true
  3. branches:
  4. include:
  5. - main
  6. - release/9.0.1xx-preview*
  7. - internal/release/*
  8. - exp/*
  9. pr:
  10. branches:
  11. include:
  12. - main
  13. - release/*
  14. - internal/release/*
  15. variables:
  16. - name: _CIBuild
  17. value: -restore -build -sign -pack -ci
  18. # Disable post-build signing for internal release-branch builds or internal manual builds.
  19. - ${{ if and(eq(variables['System.TeamProject'], 'internal'), or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), eq(variables['Build.Reason'], 'Manual'))) }}:
  20. - name: PostBuildSign
  21. value: false
  22. - ${{ else }}:
  23. - name: PostBuildSign
  24. value: true
  25. - ${{ if eq(variables['System.TeamProject'], 'public') }}:
  26. - name: _InternalRuntimeDownloadArgs
  27. value: ''
  28. - name: _OfficialBuildArgs
  29. value: ''
  30. - name: "skipComponentGovernanceDetection"
  31. value: "true"
  32. - ${{ if ne(variables['System.TeamProject'], 'public') }}:
  33. - name: _OfficialBuildArgs
  34. value: /p:OfficialBuilder=Microsoft
  35. - name: Codeql.Enabled
  36. value: true
  37. - group: DotNetBuilds storage account read tokens
  38. - name: _InternalRuntimeDownloadArgs
  39. value: /p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
  40. /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
  41. - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
  42. - group: DotNet-CLI-SDLValidation-Params
  43. - template: /eng/common/templates-official/variables/pool-providers.yml
  44. # Set the MicroBuild plugin installation directory to the agent temp directory to avoid SDL tool scanning.
  45. - name: MicroBuildOutputFolderOverride
  46. value: $(Agent.TempDirectory)
  47. resources:
  48. repositories:
  49. - repository: 1esPipelines
  50. type: git
  51. name: 1ESPipelineTemplates/1ESPipelineTemplates
  52. ref: refs/tags/release
  53. extends:
  54. template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
  55. parameters:
  56. sdl:
  57. sourceAnalysisPool:
  58. name: $(DncEngInternalBuildPool)
  59. image: 1es-windows-2022
  60. os: windows
  61. stages:
  62. - stage: build
  63. displayName: Build
  64. jobs:
  65. - job: Publish_Build_Configuration
  66. pool:
  67. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  68. name: $(DncEngPublicBuildPool)
  69. image: 1es-windows-2022-open
  70. os: windows
  71. ${{ if eq(variables['System.TeamProject'], 'internal') }}:
  72. name: $(DncEngInternalBuildPool)
  73. image: 1es-windows-2022
  74. os: windows
  75. steps:
  76. - task: 1ES.PublishPipelineArtifact@1
  77. displayName: Publish Build Config
  78. inputs:
  79. targetPath: $(Build.SourcesDirectory)\eng\buildConfiguration
  80. artifactName: buildConfiguration
  81. - template: /eng/build.yml@self
  82. parameters:
  83. agentOs: Windows_NT
  84. pool:
  85. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  86. name: $(DncEngPublicBuildPool)
  87. image: 1es-windows-2022-open
  88. os: windows
  89. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  90. name: $(DncEngInternalBuildPool)
  91. image: 1es-windows-2022
  92. os: windows
  93. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  94. helixTargetQueue: Windows.Amd64.VS2022.Pre.Open
  95. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  96. helixTargetQueue: Windows.Amd64.VS2022.Pre
  97. variables:
  98. - name: _BuildConfig
  99. value: Release
  100. - name: _PublishArgs
  101. value: '-publish /p:DotNetPublishUsingPipelines=true'
  102. - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
  103. - name: _SignType
  104. value: test
  105. - name: _Test
  106. value: -test
  107. - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
  108. - name: _SignType
  109. value: real
  110. - name: _Test
  111. value: ''
  112. - template: /eng/common/templates-official/job/source-build.yml@self
  113. parameters:
  114. platform:
  115. name: 'Managed'
  116. container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9
  117. - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
  118. - template: /eng/build.yml@self
  119. parameters:
  120. agentOs: Windows_NT_FullFramework
  121. pool:
  122. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  123. name: $(DncEngPublicBuildPool)
  124. image: 1es-windows-2022-open
  125. os: windows
  126. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  127. name: $(DncEngInternalBuildPool)
  128. image: 1es-windows-2022
  129. os: windows
  130. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  131. helixTargetQueue: Windows.Amd64.VS2022.Pre.Open
  132. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  133. helixTargetQueue: Windows.Amd64.VS2022.Pre
  134. variables:
  135. - name: _BuildConfig
  136. value: Debug
  137. - name: _PublishArgs
  138. value: ''
  139. - name: _SignType
  140. value: test
  141. - name: _Test
  142. value: -test
  143. - template: /eng/build.yml@self
  144. parameters:
  145. agentOs: Windows_NT_TestAsTools
  146. pool:
  147. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  148. name: $(DncEngPublicBuildPool)
  149. image: 1es-windows-2022-open
  150. os: windows
  151. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  152. name: $(DncEngInternalBuildPool)
  153. image: 1es-windows-2022
  154. os: windows
  155. variables:
  156. - name: _BuildConfig
  157. value: Debug
  158. - name: _PublishArgs
  159. value: ''
  160. - name: _SignType
  161. value: test
  162. - template: /eng/build.yml@self
  163. parameters:
  164. agentOs: Ubuntu_22_04
  165. pool:
  166. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  167. name: $(DncEngPublicBuildPool)
  168. image: 1es-ubuntu-2204-open
  169. os: linux
  170. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  171. name: $(DncEngInternalBuildPool)
  172. image: 1es-ubuntu-2204
  173. os: linux
  174. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  175. helixTargetQueue: ubuntu.2204.amd64.open
  176. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  177. helixTargetQueue: Ubuntu.2204.Amd64
  178. variables:
  179. - name: _BuildConfig
  180. value: Release
  181. - name: _PublishArgs
  182. value: ''
  183. - name: _SignType
  184. value: test
  185. - name: _Test
  186. value: -test
  187. - template: /eng/build.yml@self
  188. parameters:
  189. agentOs: Darwin
  190. pool:
  191. name: Azure Pipelines
  192. image: macOS-latest
  193. os: macOS
  194. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  195. helixTargetQueue: OSX.13.Amd64.Open
  196. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  197. helixTargetQueue: OSX.13.Amd64
  198. variables:
  199. - name: _BuildConfig
  200. value: Release
  201. - name: _PublishArgs
  202. value: ''
  203. - name: _SignType
  204. value: test
  205. - name: _Test
  206. value: -test
  207. # template-engine builds
  208. - template: /eng/build.yml@self
  209. parameters:
  210. agentOs: Windows_NT_TemplateEngine
  211. pool:
  212. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  213. name: $(DncEngPublicBuildPool)
  214. image: 1es-windows-2022-open
  215. os: windows
  216. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  217. name: $(DncEngInternalBuildPool)
  218. image: 1es-windows-2022
  219. os: windows
  220. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  221. helixTargetQueue: Windows.Amd64.VS2022.Pre.Open
  222. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  223. helixTargetQueue: Windows.Amd64.VS2022.Pre
  224. variables:
  225. - name: _BuildConfig
  226. value: Release
  227. - name: PublishArgs
  228. value: '-publish /p:DotNetPublishUsingPipelines=true'
  229. - name: _SignType
  230. value: test
  231. - name: _Test
  232. value: -test
  233. - template: /eng/build.yml@self
  234. parameters:
  235. agentOs: Ubuntu_22_04_TemplateEngine
  236. pool:
  237. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  238. name: $(DncEngPublicBuildPool)
  239. image: 1es-ubuntu-2204-open
  240. os: linux
  241. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  242. name: $(DncEngInternalBuildPool)
  243. image: 1es-ubuntu-2204
  244. os: linux
  245. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  246. helixTargetQueue: 'ubuntu.2204.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-amd64'
  247. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  248. helixTargetQueue: Ubuntu.2204.Amd64
  249. variables:
  250. - name: _BuildConfig
  251. value: Release
  252. - name: _PublishArgs
  253. value: ''
  254. - name: _SignType
  255. value: test
  256. - name: _Test
  257. value: -test
  258. - template: /eng/build.yml@self
  259. parameters:
  260. agentOs: Darwin_TemplateEngine
  261. pool:
  262. name: Azure Pipelines
  263. image: macOS-latest
  264. os: macOS
  265. ${{ if eq(variables['System.TeamProject'], 'public') }}:
  266. helixTargetQueue: OSX.1100.Amd64.Open
  267. ${{ if ne(variables['System.TeamProject'], 'public') }}:
  268. helixTargetQueue: OSX.1100.Amd64
  269. variables:
  270. - name: _BuildConfig
  271. value: Release
  272. - name: _PublishArgs
  273. value: ''
  274. - name: _SignType
  275. value: test
  276. - name: _Test
  277. value: -test
  278. # dotnet-format builds
  279. - template: /eng/dotnet-format/dotnet-format-integration.yml@self
  280. parameters:
  281. PublishTaskName: 1ES.PublishBuildArtifacts@1
  282. - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
  283. - template: /eng/common/templates-official/job/publish-build-assets.yml@self
  284. parameters:
  285. publishUsingPipelines: true
  286. publishAssetsImmediately: true
  287. dependsOn:
  288. - Windows_NT
  289. - Source_Build_Managed
  290. pool:
  291. name: $(DncEngInternalBuildPool)
  292. image: 1es-windows-2022
  293. os: windows
  294. - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
  295. - template: /eng/common/templates-official/post-build/post-build.yml@self
  296. parameters:
  297. publishingInfraVersion: 3
  298. enableSymbolValidation: false
  299. enableSigningValidation: false
  300. enableNugetValidation: false
  301. enableSourceLinkValidation: false
  302. publishInstallersAndChecksums: true
  303. publishAssetsImmediately: true
  304. SDLValidationParameters:
  305. enable: false
  306. params: ' -SourceToolsList @("policheck","credscan")
  307. -TsaInstanceURL $(_TsaInstanceURL)
  308. -TsaProjectName $(_TsaProjectName)
  309. -TsaNotificationEmail $(_TsaNotificationEmail)
  310. -TsaCodebaseAdmin $(_TsaCodebaseAdmin)
  311. -TsaBugAreaPath $(_TsaBugAreaPath)
  312. -TsaIterationPath $(_TsaIterationPath)
  313. -TsaRepositoryName "dotnet-sdk"
  314. -TsaCodebaseName "dotnet-sdk"
  315. -TsaPublish $True'