azure-devops - 如何使用 azure-pipelines.yml 在 microsoft azure CI 管道中选择我的代理
问题描述
我有这个脚本:
trigger:
- master
pool:
name: Mobile-Pool
agent: 'MacMini3-AMS'
vmImage: 'MacMini3-AMS'
steps:
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx4096m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean assembleDebug testDebugUnitTest'
# Bash
# Run a Bash script on macOS, Linux, or Windows
- task: Bash@3
inputs:
targetType: 'filePath'
filePath: 'run-tests-on-emulator.sh'
- task: Gradle@2
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx4096m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'connectedDebugAndroidTest'
我正在运行自己的本地硬件。我有一个MacMini3和一个MacMini2。MacMini2 无法正确编译,我想在 MacMini3 上运行。如何更改 yaml 脚本来做到这一点?
解决方案
您应该使用Demands来确保您的管道所需的功能存在于运行它的代理上。
pool:
name: MyPool
demands:
- myCustomCapability # check for existence of capability
- agent.os -equals Darwin # check for specific string in capability
在您的场景中,您可以使用Agent.Name
或Agent.ComputerName
需求。
推荐阅读
- javascript - @angular/fire AngularFireStorage getDownloadUrl()
- c# - 如何仅使用 1 个 dataGridView 在不同表的文本字段上显示不同的记录?
- sql - Laravel Eloquent 数据库迁移
- python - Hexify sha 摘要结果而不使用hashlib
- android - 在没有 AppCompat 的情况下显示 Android O 及更高版本的通知
- python - pd.to_numeric 忽略非数值
- javascript - 如何选择右键单击的单词?
- scala - 强迫无形记录的价值
- javascript - 如何使用javascript通过appium打开/关闭辅助功能
- visual-studio - 如何在 matlab 2014a、visual studio 2017 和 win10 中编译 mex 文件?