I am trying to make a TFS release YAML pipeline which takes resources from specific builds from branches.
For the resources part:
resources:
pipelines:
- pipeline: pipelineA
source: SourceA
project: ProjectA
- pipeline: pipelineB
source: SourceB
project: projectB
This works fine, but it will always release the latest build from pipelineA and pipelineB, regardless which branch it is. Then I was trying to let it release upon on a specific branch, I tried:
resources:
pipelines:
- pipeline: pipelineA
source: SourceA
project: ProjectA
branch: task/123_task_name
- pipeline: pipelineB
source: SourceB
project: projectB
This works fine as long as there is a build for branch "task/123_task_name".
Now I am trying to let it release upon on the branch I select, I tried:
resources:
pipelines:
- pipeline: pipelineA
source: SourceA
project: ProjectA
branch: $(Build.SourceBranchName) OR $(Build.SourceBranch) OR task/$(Build.SourceBranchName)
- pipeline: pipelineB
source: SourceB
project: projectB
None of them worked, all of them are returning error The pipeline is not valid. Unable to resolve latest version for pipeline pipelineA. This could be due to inaccessible pipeline or no version is available.
What should be the correct format for this branch variable, thanks.
It because you can't put this value in a variable if you're using TFS.
This feature added only to Azure DevOps Services recently:
https://learn.microsoft.com/en-us/azure/devops/release-notes/2022/pipelines/sprint-212-update