azure-devopsazure-pipelinesazure-yaml-pipelines

Build schedule for git tag


Is it possible to schedule a yaml pipeline using tags. What I want to achive, is an easy way to specify which commit to build. For this system, it needs to be rebuild on each deploy. I would like to not use branches for this as I would like to avoid merging when I need to deploy a new version.

Ultimately, I would put the tag name in a variable for easy update. It also seems tags work with triggers, but I can't get it to work with schedules.

I tried something like this, but nothing happens. If I change refs/tags/release-20200907-4 with master, it works

schedules:
  - cron: "*/5 * * * *"
    always: true
    branches:
      include:
      - refs/tags/release-20200907-4

Solution

  • It looks that this is not possible. Following documentation:

    Scheduled triggers evaluation Scheduled triggers are evaluated for a branch when the following events occur.

    • A pipeline is created.
    • A pipeline's YAML file is updated, either from a push, or by editing it in the pipeline editor.
    • A pipeline's YAML file path is updated to reference a different YAML file. This change only updates the default branch, and therefore will only pick up schedules in the updated YAML file for the default branch. If any other branches subsequently merge the default branch, for example git pull origin master, the scheduled triggers from the newly referenced YAML file are evaluated for that branch.
    • A new branch is created.

    After one of these events occurs in a branch, any scheduled runs for that branch are added, if that branch matches the branch filters for the scheduled triggers contained in the YAML file in that branch.

    and since documentation clearly refers only to the branches not to tags and test proves that this doesn't work for tags, there is no way to achieve what you want. Even trigger evaluation is triggered by a new branch, and not a new tag.

    You may consider adding this a feature request on developer community.