Skip to content

Commit

Permalink
[CI] Allow to override the pool that will be used in a manual build. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque authored Mar 6, 2022
1 parent 080b5c3 commit e49d854
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 16 deletions.
10 changes: 10 additions & 0 deletions tools/devops/automation/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ parameters:
type: string
default: 'latest'

- name: pool
type: string
displayName: Bot pool to use
default: automatic
values:
- pr
- ci
- automatic

- name: runTests
displayName: Run Simulator Tests
type: boolean
Expand Down Expand Up @@ -282,6 +291,7 @@ stages:
enableDotnet: ${{ parameters.enableDotnet }}
enableAPIDiff: ${{ parameters.enableAPIDiff }}
skipESRP: ${{ parameters.skipESRP }}
pool: ${{ parameters.pool }}

# .NET 6 Release Prep and VS Insertion Stages, only execute them when the build comes from an official branch and is not a schedule build from OneLoc
- ${{ if and(ne(variables['Build.Reason'], 'Schedule'), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(parameters.forceInsertion, true))) }}:
Expand Down
49 changes: 33 additions & 16 deletions tools/devops/automation/templates/build/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ parameters:
type: boolean
default: false # only to be used when testing the CI and we do not need a signed pkg

- name: pool
type: string
default: automatic

jobs:
- job: configure
displayName: 'Configure build'
Expand All @@ -46,28 +50,35 @@ jobs:
steps:
- template: configure.yml

- job: AgentPoolSelector # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml
pool: # Consider using an agentless (server) job here, but would need to host selection logic as an Azure function: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server
vmImage: ubuntu-latest
steps:
- checkout: none # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout
- ${{ if eq(parameters.pool, 'automatic') }}:
- job: AgentPoolSelector # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml
pool: # Consider using an agentless (server) job here, but would need to host selection logic as an Azure function: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server
vmImage: ubuntu-latest
steps:
- checkout: none # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout

# Selects appropriate agent pool based on trigger type (PR or CI); manually triggered builds target the PR pool
- template: azure-devops-pools/agent-pool-selector.yml@templates
parameters:
agentPoolPR: $(PRBuildPool)
agentPoolPRUrl: $(PRBuildPoolUrl)
agentPoolCI: $(CIBuildPool)
agentPoolCIUrl: $(CIBuildPoolUrl)
# Selects appropriate agent pool based on trigger type (PR or CI); manually triggered builds target the PR pool
- template: azure-devops-pools/agent-pool-selector.yml@templates
parameters:
agentPoolPR: $(PRBuildPool)
agentPoolPRUrl: $(PRBuildPoolUrl)
agentPoolCI: $(CIBuildPool)
agentPoolCIUrl: $(CIBuildPoolUrl)

- job: build
dependsOn:
- AgentPoolSelector
- ${{ if eq(parameters.pool, 'automatic') }}:
- AgentPoolSelector
- configure
displayName: 'Build packages'
timeoutInMinutes: 1000
variables:
AgentPoolComputed: $[ dependencies.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ]
${{ if eq(parameters.pool, 'automatic') }}:
AgentPoolComputed: $[ dependencies.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ]
${{ if eq(parameters.pool, 'ci') }}:
AgentPoolComputed: $(CIBuildPool)
${{ if eq(parameters.pool, 'pr') }}:
AgentPoolComputed: $(PRBuildPool)
# add all the variables that have been parsed by the configuration step. Could we have a less verbose way??
#
# build-package
Expand Down Expand Up @@ -119,12 +130,18 @@ jobs:
- ${{ if eq(parameters.enableAPIDiff, true) }}:
- job: api_diff
dependsOn:
- AgentPoolSelector
- ${{ if eq(parameters.pool, 'automatic') }}:
- AgentPoolSelector
- configure
displayName: 'Generate API diff'
timeoutInMinutes: 1000
variables:
AgentPoolComputed: $[ dependencies.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ]
${{ if eq(parameters.pool, 'automatic') }}:
AgentPoolComputed: $[ dependencies.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ]
${{ if eq(parameters.pool, 'ci') }}:
AgentPoolComputed: $(CIBuildPool)
${{ if eq(parameters.pool, 'pr') }}:
AgentPoolComputed: $(PRBuildPool)
PR_ID: $[ dependencies.configure.outputs['labels.pr-number'] ]
# set the branch variable name, this is required by jenkins and we have a lot of scripts that depend on it
BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
Expand Down

1 comment on commit e49d854

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests didn't execute on Build. ❌

Tests didn't execute on Build.

API diff

✅ API Diff from stable

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff

API Current PR diff

ℹ️ API Diff (from PR only) (please review changes)

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff
  • ⚠️ Generator diff comments have not been provided.
    Path D:\a\1\s\artifacts\pkg-info\artifacts.json was not found!

No test summary was found (something probably failed before the tests could execute)

Pipeline on Agent
[CI] Allow to override the pool that will be used in a manual build. (#14320)

Please sign in to comment.