Search code examples
azure-devopsazure-pipelinesazure-pipelines-release-pipelineazure-artifacts

Can you use variables to specify artifact version in a release pipeline?


I'm working with a release pipeline where I want to download a specific version of different artifacts. Each artifact version will change with time (it will not always be the latest version), and I would like this process to be automated so developers don't have to manually change the versions to download.

My ambition is to use variables which as values holds the version number of an artifact. Is this achievable?

I have found this thread which explains how to do it with build pipelines. But I don't know how to do this for release pipelines. I have also found another thread which suggests using runtime parameters when one wants to specify resource versions inside a variable.

Despite these sources, I still have not come to a definite solution to my problem. Is it possible to use variables to specify artifact version in a release pipeline? Or are there workarounds?


Solution

  • Yes, this possible. You can use for that purpose Download Pipeline Artifacts or similar Download build artifacts depends how you publish your artifacts. However, you must get pipeline id or build id, so if your variable holds artifact version which is build number you may use REST API to get build id

    You may find you build id and then assign it to variable and use this variable in the task.

    enter image description here