1
votes

I have setup an Azure pipeline to run GUI tests twice a day. According to the documentation it should only run if there have been code changes, but it always runs.

This is my cron schedule in "azure-pipelines-cypress.xml"

schedules:
- cron: "0 10 * * *"
  displayName: Daily 12:00 build (UTC 10:00)
  branches:
    include:
    - master

Note that the documentation (https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml#scheduled-triggers) states:

always: boolean # whether to always run the pipeline or only if there have been source code changes since the last run. The default is false.

Is this simply a bug or am I missing something?

1

1 Answers

2
votes

Azure cron pipeline always runs

Update2:

I don't want it to run every time the master branch is updated. It should run when the master branch is updated AND only at a scheduled time.

But is that not the expected behavior of my current pipeline? The current behavior acts as if I had set "always: true"

First of all, thanks Mick for your patience in providing a lot of detailed information.

Now, I figure out the issue and I could reproduce this issue on my side. If we set the scheduled triggers, but the build result is failed. In this case, even if we do not any change, the scheduled triggers will still fire. That because the latest build failed, so the last commit record was not recorded by the pipeline. When the scheduled time is reached, the last commit/source code change still exists. It will trigger scheduled triggers.

So, that the reason why your pipeline still executed, even if you do not do any change in the code/yaml.

If I successfully build the pipeline, the scheduled triggers works as expected.

So, it should be said that the documentation is not clear enough, it should be:

always: boolean # whether to always run the pipeline or only if there have been source code changes since the last successful run. The default is false.

I submit this to MS, Thank you for helping us build a better Azure DevOps.

Hope this helps.