Still migrating from classic to yaml pipeline. Hope you can give me some advices on the following scenario.
I have unique repository and two yml files:
My azurepipelines_build.yml looks this:
trigger:
- main
name: $(BuildDefinitionName)_$(Build.BuildId)_$(Date:yyyyMMdd)
And with that i can see easily my buildId updated everytime i start this pipeline.
Now my azurepipelines_deploy.yml looks this:
trigger:
- none
resources:
pipelines:
- pipeline: myproject-build
source: myproject-build
trigger:
branches:
- '*'
name: $(BuildDefinitionName)_$(resources.pipeline.myproject-build.runID)_$(Date:yyyyMMdd)
...
...
steps:
- script: |
echo "Checking build id $(resources.pipeline.myproject-build.runID)"
I do confirm that echo "Checking build id $(resources.pipeline.myproject-build.runID)"
works and i get correct build Id reference.
Unfortunately for the name I do not have $(resources.pipeline.myproject-build.runID)
as expected. I wonder if it is possible and requires your advice. It is something possible ?
Thx
Paul
The name is a special field to set run number. Not everything is allowed here. For expressions you can have
If you use an expression to set the build number, you can't use some tokens because their values aren't set at the time expressions are evaluated. These tokens include $(Build.BuildId), $(Build.BuildURL), and $(Build.BuildNumber).
resources.pipeline.myproject-build.runID
is empty at a time of evaluation of name expressions and this is not possible to overcome this, because Pipeline resource metadata
In each run, the metadata for a pipeline resource is available to all jobs as the following predefined variables. These variables are available to your pipeline at runtime, and therefore can't be used in template expressions, which are evaluated at pipeline compile time.