Search code examples
azure-devopscronazure-pipelines

Azure pipeline schedules with fluid cron job


I'm using the Azure pipeline to build and run my .NET console application on a Microsoft agent running synthetic monitoring. My project runs Selenium and pushes transactions to Log Analytics. This needs to run on a set interval time in an hour.

I would like to have more fluid timing of schedules in the Azure pipeline. Can I give variables or generate variables with random intervals instead of a fixed cron job?

Current situation - this gives an interval of fixed :15, :30, :45:

  - cron: '*/15 * * * *'
    displayName: Measurement scheme
    branches:
      include:
        - main

Desired situation

int n = Random(0,15)

  - cron: '$(n),$(n),$(n),$(n),$(n),$(n),$(n)...... * * * *'
    displayName: Measurement scheme
    branches:
      include:
        - main

Solution

  • I am sorry that you can’t give variables or generate variables with random intervals instead of a fixed cron job . Because the following documentation has noted:"You can’t use pipeline variables when specifying schedules"

    Configure schedules to run pipelines - Azure Pipelines | Microsoft Learn

    pipeline variable constraints

    You may submit a suggestion at website below:

    feature request