user6325732
user6325732

Reputation: 23

Azure Devops Pipeline Scheduled trigger on other repository

I have a repo with Yaml definition of pipelines, that reference other repo for steps.

I'm trying to have the pipeline triggered based on a scheduled (cron) definition (only when source code changed) of a repo that is not the repo of the pipeline. I tried that but the pipeline is not triggered:

resources:
 repositories:
 - repository: self
   type: git
   ref: master
 - repository: my-project
   name: my-project
   type: git
   ref: master
   schedules:
   - cron: 55 10 * * 1,2,3,4,5
     branches:
     include:
     - master
     always: false
     
trigger: none
pr: none
(...)

Repository "self" references the repo with pipeline YAML file(s)

If I get rid of the last two lines, the pipeline is triggered when I save it, but not when I change code on "my-project" I tried also with ref/heads prefixes for branch name without any change.

Any idea?

Upvotes: 2

Views: 1218

Answers (1)

Vince Bowdren
Vince Bowdren

Reputation: 9188

This can't be done, the way you're trying. A repository resource can include a trigger, but not a schedule; see the docs at https://learn.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema#define-a-repositories-resource

What you can do is a non-scheduled trigger:

resources:
 repositories:
 - repository: self
   type: git
   ref: master
 - repository: my-project
   name: my-project
   type: git
   ref: master
   trigger:
     branches:
       include:
       - master

This won't work on any schedule; it will simply be immediately triggered by any change to the code in my-project, in the master branch.

Upvotes: 2

Related Questions