.vsts-ci.yml 12 KB

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