Azure DevOps - 在 yaml 中配置两个作业,一个使用 cron 计划,第二个使用手动执行

Azure DevOps - configuring two jobs in yaml, one with cron schedule, second with manual execution

我正在 Azure DevOps 上配置管道以进行 运行ning e2e 测试。

我想有两个选择:

我怎样才能做到这一点?尝试了这样的 yaml,但我在尝试手动 运行 时收到 Unexpected value 'schedules'

jobs:
  - job: 'auto-run tests'
    displayName: E2E scheduled tests
    schedules:
      - cron: "0 5 * * 1,3,5"
        branches:
          include:
            - master
    steps:

<some auto-run tests job config here>

  - job: 'manually run tests'
    displayName: E2E manually run tests
    steps:

你应该使用条件来区分构建原因:

schedules:
- cron: "0 5 * * 1,3,5"
  displayName: E2E scheduled tests
  branches:
    include:
    - master
  always: true

jobs:
  - job: scheduled_run_tests
    condition: eq(variables['Build.Reason'], 'Schedule')
    displayName: E2E scheduled run tests
    steps:
  - job: manually_run_tests
    condition: eq(variables['Build.Reason'], 'Manual')
    displayName: E2E manually run tests
    steps:

Here 您有构建共振列表。