【问题标题】:How to schedule the Cypress tests in Azure Devops?如何在 Azure Devops 中安排赛普拉斯测试?
【发布时间】:2021-02-18 15:10:45
【问题描述】:

我的赛普拉斯测试在每次提交后运行,但我希望它们每 30 分钟运行一次。这是我的 YAML 文件 - https://pastebin.pl/view/0d56bd33。如何管理它们每 30 分钟运行一次(或根据给定的 CRON 时间)?

【问题讨论】:

    标签: azure-devops continuous-integration yaml cypress schedule


    【解决方案1】:

    提交后运行脚本 A,但每 30 分钟运行一次脚本 B

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

    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 将被跳过。

    【讨论】:

    • 我希望 azure 在提交后运行脚本 A,但每 30 分钟运行一次脚本 B。您的示例将在提交和 30 分钟后运行相同的脚本。
    • @AraGalstyan 我无法在您的问题中查看您的屏幕截图。请再次分享。
    • Yaml file - 这是我的 yaml 文件,它使用 npm run cy:test 脚本运行我的测试。但我也想每 30 分钟运行另一个脚本。
    • @AraGalstyan 我更新了我的答案,请检查它是否满足您的需求。
    • 非常感谢!它救了我!
    猜你喜欢
    • 2021-01-03
    • 1970-01-01
    • 2023-02-18
    • 2023-02-14
    • 1970-01-01
    • 2021-11-06
    • 2021-10-20
    • 2020-05-16
    • 1970-01-01
    相关资源
    最近更新 更多