Skip to content

Commit

Permalink
Onboard the official build to 1ES pipeline templates (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamariyan committed Mar 22, 2024
1 parent f44b7a5 commit e57a410
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 116 deletions.
135 changes: 135 additions & 0 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Branches that trigger builds on PR
pr:
branches:
include:
- main
- release/*
paths:
exclude:
- README.md
- docs/*

# Run official build every day at midnight, if code has changed since the last run.
schedules:
- cron: "0 0 * * *"
displayName: Daily Official Build
branches:
include:
- main

variables:
- template: /eng/common/templates/variables/pool-providers.yml
- name: _TeamName
value: Roslyn

stages:
- stage: build
displayName: Build
jobs:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
MirrorRepo: sourcelink
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enableTelemetry: true
enableSourceBuild: true
helixRepo: dotnet/symreader
jobs:
- job: Windows
pool:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
vmImage: 'windows-latest'
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-windows-2022
variables:
# Only enable publishing in official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- group: Publish-Build-Assets
- name: _OfficialBuildArgs
value: /p:DotNetSignType=$(_SignType)
/p:DotNetPublishUsingPipelines=true
/p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# else
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _OfficialBuildArgs
value: ''
strategy:
matrix:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
Debug:
_BuildConfig: Debug
_SignType: test
_BuildArgs: ''
Release:
_BuildConfig: Release
# PRs or external builds are not signed.
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: test
_BuildArgs: ''
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: real
_BuildArgs: $(_OfficialBuildArgs)
steps:
- checkout: self
clean: true
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
displayName: Build and Test

# Archive NuGet packages to DevOps (workaround for https://github.com/dotnet/arcade/issues/4444)
- task: PublishBuildArtifacts@1
displayName: Publish Artifact Packages
inputs:
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
ArtifactName: 'Packages'
condition: succeeded()

- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- job: MacOS
displayName: 'MacOS'
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test

- job: Linux
displayName: 'Linux'
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
227 changes: 111 additions & 116 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Branches that trigger builds on PR
pr:
branches:
include:
Expand All @@ -8,128 +7,124 @@ pr:
exclude:
- README.md
- docs/*

# Run official build every day at midnight, if code has changed since the last run.
schedules:
- cron: "0 0 * * *"
displayName: Daily Official Build
branches:
include:
- main

variables:
- template: /eng/common/templates/variables/pool-providers.yml
- name: _TeamName
value: Roslyn

stages:
- stage: build
displayName: Build
jobs:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
MirrorRepo: sourcelink
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enableTelemetry: true
enableSourceBuild: true
helixRepo: dotnet/symreader
- template: /eng/common/templates-official/variables/pool-providers.yml@self
- name: _TeamName
value: Roslyn
- name: TeamName
value: Roslyn
resources:
repositories:
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
sdl:
sourceAnalysisPool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022-pt
os: windows
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: build
displayName: Build
jobs:
- job: Windows
pool:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
vmImage: 'windows-latest'
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-windows-2022
variables:
# Only enable publishing in official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- group: Publish-Build-Assets
- name: _OfficialBuildArgs
value: /p:DotNetSignType=$(_SignType)
/p:DotNetPublishUsingPipelines=true
/p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# else
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _OfficialBuildArgs
value: ''
strategy:
matrix:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
Debug:
_BuildConfig: Debug
_SignType: test
_BuildArgs: ''
Release:
_BuildConfig: Release
# PRs or external builds are not signed.
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- template: /eng/common/templates-official/job/onelocbuild.yml@self
parameters:
MirrorRepo: sourcelink
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-SOURCELINK'
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enableTelemetry: true
enableSourceBuild: true
helixRepo: dotnet/symreader
jobs:
- job: Windows
pool:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: test
_BuildArgs: ''
vmImage: 'windows-latest'
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: real
_BuildArgs: $(_OfficialBuildArgs)
steps:
- checkout: self
clean: true
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
displayName: Build and Test

# Archive NuGet packages to DevOps (workaround for https://github.com/dotnet/arcade/issues/4444)
- task: PublishBuildArtifacts@1
displayName: Publish Artifact Packages
inputs:
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
ArtifactName: 'Packages'
condition: succeeded()

- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- job: MacOS
displayName: 'MacOS'
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test

- job: Linux
displayName: 'Linux'
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-windows-2022
variables:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: Publish-Build-Assets
- name: _OfficialBuildArgs
value: /p:DotNetSignType=$(_SignType) /p:DotNetPublishUsingPipelines=true /p:TeamName=$(_TeamName) /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _OfficialBuildArgs
value: ''
strategy:
matrix:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
Debug:
_BuildConfig: Debug
_SignType: test
_BuildArgs: ''
Release:
_BuildConfig: Release
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: test
_BuildArgs: ''
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: real
_BuildArgs: $(_OfficialBuildArgs)
steps:
- checkout: self
clean: true
- script: eng\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
displayName: Build and Test
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- job: MacOS
displayName: 'MacOS'
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test
- job: Linux
displayName: 'Linux'
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
Release:
_BuildConfig: Release
_SignType: none
steps:
- checkout: self
clean: true
- script: eng/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/common/templates-official/post-build/post-build.yml@self

0 comments on commit e57a410

Please sign in to comment.