如何在 Azure Devops 中安排 Cypress 测试?

How to schedule the Cypress tests in Azure Devops?

我的 Cypress 测试在每次提交后 运行ning,但我希望它们每 30 分钟 运行。这是我的 YAML 文件 - https://pastebin.pl/view/0d56bd33。我怎样才能将它们管理为每 30 分钟(或根据给定的 CRON 时间)运行?

run script A after commit, but run script B after every 30 min

您可以在脚本中添加条件。例如:

schedules:
- cron:  "*/30 * * * *"
  displayName: Every 30 minutes
  branches:
    include:
    - main
  always: true
trigger:
- '*'

pool:
  vmImage: ubuntu-latest

steps:
- script: echo script A
  displayName: 'script A'
  condition: eq(variables['Build.Reason'], 'IndividualCI')

- script: echo  script B
  displayName: 'script B'
  condition: eq(variables['Build.Reason'], 'Schedule')

在此示例中:

  • 脚本 A 将 运行 当您推送提交时脚本 B 将被跳过。
  • 脚本 B 将 运行 每 30 分钟一次,脚本 A 将被跳过。