We are experimenting with AzureDevOps. We use git multirepo and, unfortunately, there are direct dependencies between different repos. With previous tool we used to match branches from different repositories by their name with a fallback to master - if branch XXX is not present on some repo than use master.
I'd like to achieve the same behavior with AzureDevOps YAML syntax. Here is my attempt.
resources:
repositories:
- repository: repo
type: GitHub
connection: myGitHubConnection
source: primaryRepo
ref: $(Build.SourceBranchName)
- repository: repo
type: GitHub
connection: myGitHubConnection
source: secondaryRepo
ref: $(Build.SourceBranchName)
It has one problem - if $(Build.SourceBranchName) is not present on secondaryRepo pipeline fails with message:
The pipeline is not valid. Could not get the latest source version for repository company/secondaryRepo hosted on GitHub using ref refs/heads/$(Build.SourceBranchName) ...
Where specific branch name is substituted (variable works).
Is there a way to specify fallback in case ref is invalid (branch does not exist)? I tried doing duplicate ref and using lists in YAML, but none succeeded.
