Question: Is there any way to define a custom-variable in a build pipeline in azure-devops, which then can be used in/exposed to the release pipeline in any way?
Scenario: We are not using a variable group, because we need to dynamically set the variable in the build pipeline and then consume it in the release pipeline - it is not a static super global.
Checked the docs at release variables and build variables but could not find any helping information or a hint, that this is possible.
What I tried
- Define a
variable
invariables
( in the build pipeline ) and try to access it in the release pipeline using$(name)
or checking if it is inenv
.
Extras - Motivation The motivation behind this is
- read the latest git-tag used in a build-pipeline step and expose this into the pipeline variable
VERSION
( actually, we bump patch during that ) - Releasing builds is a manual step.
- If a build is released, the azure-devops gui shows us all the variables of the release-pipeline, which are "settable during release - this includes the version we want to release this package with
- we want this "VERSION" to be prefilled with the version of the build-pipeline as a suggestion for the next version
- In the release pipeline we checkout the repo, add the
VERSION
as a tag and package/publish the artifact with this version