[CI] Use yaml-templates agent pool selector (#11356)
Use release version of yaml-templates agent pool selector from main https://github.com/xamarin/yaml-templates/pull/115
This commit is contained in:
Родитель
4ba7bf3b9d
Коммит
906cb14c06
|
@ -148,7 +148,14 @@ variables:
|
|||
value: 'xamarin-macios'
|
||||
- name: PROVISIONATOR_CHANNEL
|
||||
value: ${{ parameters.provisionatorChannel }}
|
||||
|
||||
- name: PRBuildPool
|
||||
value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Untrusted'
|
||||
- name: PRBuildPoolUrl
|
||||
value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=366&view=agents'
|
||||
- name: CIBuildPool
|
||||
value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Trusted'
|
||||
- name: CIBuildPoolUrl
|
||||
value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=367&view=agents'
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
#
|
||||
# Selects appropriate agent pool based on trigger type (PR or CI)
|
||||
#
|
||||
parameters:
|
||||
agentPoolPR: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Untrusted'
|
||||
agentPoolPRUrl: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=366&view=agents'
|
||||
agentPoolCI: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Trusted'
|
||||
agentPoolCIUrl: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=367&view=agents'
|
||||
condition: succeeded()
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
$buildReason = "$(Build.Reason)"
|
||||
$buildSourceBranchName = "$(Build.SourceBranchName)"
|
||||
$agentPoolPR = "${{ parameters.agentPoolPR }}"
|
||||
$agentPoolPRUrl = "${{ parameters.agentPoolPRUrl }}"
|
||||
$agentPoolCI = "${{ parameters.agentPoolCI }}"
|
||||
$agentPoolCIUrl = "${{ parameters.agentPoolCIUrl }}"
|
||||
|
||||
Write-Host "buildReason: ${buildReason}"
|
||||
Write-Host "buildSourceBranchName: ${buildSourceBranchName}"
|
||||
Write-Host "agentPoolPR: ${agentPoolPR}"
|
||||
Write-Host "agentPoolPRUrl: ${agentPoolPRUrl}"
|
||||
Write-Host "agentPoolCI: ${agentPoolCI}"
|
||||
Write-Host "agentPoolCIUrl: ${agentPoolCIUrl}"
|
||||
|
||||
$agentPool = $agentPoolPR # Default to Catalina PR pool
|
||||
$agentPoolUrl = $agentPoolPRUrl
|
||||
Write-Host "Default agent pool: ${agentPool}"
|
||||
|
||||
[bool] $isTopicBranch = $False
|
||||
[bool] $isPullRequest = $False
|
||||
|
||||
if (-not ($buildSourceBranchName -eq 'main' -or $buildSourceBranchName -eq 'master' -or $buildSourceBranchName.StartsWith('d16-'))) {
|
||||
$isTopicBranch = $True
|
||||
}
|
||||
|
||||
if ($buildReason -eq 'PullRequest') {
|
||||
$prTargetBranchName = "$(System.PullRequest.TargetBranch)" # This system variable is only defined (and in turn the value macro replaced) when $buildReason is 'PullRequest'. Consequently, it cannot be defined as part of an input parameter
|
||||
Write-Host "prTargetBranchName: System.PullRequest.TargetBranch: ${prTargetBranchName}"
|
||||
$isPullRequest = $True
|
||||
$targetBranch = $prTargetBranchName
|
||||
} else {
|
||||
$targetBranch = $buildSourceBranchName
|
||||
}
|
||||
|
||||
Write-Host "Settings:"
|
||||
Write-Host " targetBranch: ${targetBranch}"
|
||||
Write-Host " isTopicBranch: ${isTopicBranch}"
|
||||
Write-Host " isPullRequest: ${isPullRequest}"
|
||||
|
||||
if ($isPullRequest) {
|
||||
$agentPool = $agentPoolPR # Untrusted on-prem iOS pool used for all PRs (including those from forks) and feature/topic branch commits not targeting main or d16-x branches
|
||||
$agentPoolUrl = $agentPoolPRUrl
|
||||
} else {
|
||||
$agentPool = $agentPoolCI # Trusted on-prem iOS pool used for CIs targeting main and d16-x release branches
|
||||
$agentPoolUrl = $agentPoolCIUrl
|
||||
}
|
||||
|
||||
Write-Host "AgentPoolComputed: ${agentPool}"
|
||||
Write-Host "Selected agent pool: ${agentPoolUrl}"
|
||||
Write-Host "##vso[task.setvariable variable=AgentPoolComputed;isOutput=true]$agentPool"
|
||||
name: setAgentPool
|
||||
displayName: 'AgentPoolSelector: Select agent pool'
|
||||
condition: ${{ parameters.condition }}
|
|
@ -43,8 +43,13 @@ jobs:
|
|||
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)
|
||||
- template: ../agent-pool-selector.yml
|
||||
# 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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче