Azure devops Azure Pipeline Cron调度程序:不要让SCM同时轮询所有分支
我的问题如下: 到目前为止,我每天使用Jenkins SCM轮询两次检查生产分支中的更改,但我想使用Azure Devops(在prem 2020上)检查更改,并在发生更改时启动管道,这是一个大致相同的过程:Azure devops Azure Pipeline Cron调度程序:不要让SCM同时轮询所有分支,azure-devops,azure-pipelines,azure-pipelines-yaml,Azure Devops,Azure Pipelines,Azure Pipelines Yaml,我的问题如下: 到目前为止,我每天使用Jenkins SCM轮询两次检查生产分支中的更改,但我想使用Azure Devops(在prem 2020上)检查更改,并在发生更改时启动管道,这是一个大致相同的过程: schedules: - cron: '5 13/12 * * *' # cron syntax defining a schedule in UTC time displayName: 'Automatic Deployment' branches: include:
schedules:
- cron: '5 13/12 * * *' # cron syntax defining a schedule in UTC time
displayName: 'Automatic Deployment'
branches:
include:
- develop
- support
- patch
always: false
詹金斯很有可能在一段时间内进行SCM民意测验:
cron:'H H(11-14),H(20-23)***'
将对分支名称进行哈希运算,使相同的分支始终在两个版本的同一时间进行SCM轮询,这很实用,因为在完全相同的时间开始会出现有关我的资源锁定的问题
(有些资源会很快释放,因此如果它们没有同步触发,就不会等待)
我看到的唯一可能性是使用,因为在解决这些问题时使用了
有没有可能散列某种形式的inputstring并将其映射到一个值数组
我是否必须为AZP2020提出功能请求,或者是否有某种形式的变通方法可以使用,以便在两到三个小时内对开发/支持/修补分支进行轮询?您可以尝试为每个分支定义具有不同计划时间的多个计划。因此,开发/支持/修补分支将在不同的时间进行轮询。请参见以下示例:
schedules:
- cron: '5 13/12 * * *' # cron syntax defining a schedule in UTC time
displayName: 'Automatic Deployment'
branches:
include:
- develop
always: false
- cron: '5 15/12 * * *' # cron syntax defining a schedule in UTC time
displayName: 'Automatic Deployment'
branches:
include:
- support
always: false
- cron: '5 17/12 * * *' # cron syntax defining a schedule in UTC time
displayName: 'Automatic Deployment'
branches:
include:
- patch
always: false
另一个解决方法是在support/patch branch的yaml文件中添加一个,以将support/patch branch的轮询延迟一段固定时间。见下文:
更改support branch中的azure-pipelines.yml文件,如下所示:
# azure-pipelines.yml @ support branch
schedules:
- cron: '5 13/12 * * *' # cron syntax defining a schedule in UTC time
displayName: 'Automatic Deployment'
branches:
include:
- develop
- support
- patch
always: false
jobs:
- job: severJob
pool: server
steps:
- task: Delay@1
inputs:
delayForMinutes: '120'
- job:
dependsOn: severJob
pool:
vmImage: windows-latest
steps:
...
...
更改修补程序分支的延迟时间:
# azure-pipelines.yml @ patch branch
schedules:
...
jobs:
- job: severJob
pool: server
steps:
- task: Delay@1
inputs:
delayForMinutes: '240'
- job:
dependsOn: severJob
通过添加服务器作业来延迟支持/补丁分支管道的执行。可以在不同的时间轮询开发/支持/补丁分支
注意:如果只想通过使用计划触发器来运行管道,则必须通过在YAML文件中指定PR:none
和trigger:none
来禁用PR和连续集成触发器