We have a YAML file (pipelineB
) which does what it must do, it downloads the latest build artifact from a specific other existing build pipeline (pipelineA
). This is automatically triggered. Now we want to run this build pipelineB
manually and be able to select another artifact version to be used. In the Azure DevOps build pipeline there is an option saying "Run pipeline" where you can select "Resources" to be used. If you select a resource you end up with a list of all builds from pipelineA
which you can choose from.
If we then choose an older (e.g. 1.2.43-10019-master
) build from the pipeline runs of pipelineA
and run pipelineB
and we look in the logging we see that it ignores what we manually selected and always downloads the latest version. I can understand that it does that because the DownloadBuildArtifact@0
step tells to use the latestFromBranch
build version to download.
My question: how can we make use of manually selecting a resource build artifact and use the selected version further in the YAML pipeline? And ideally by default if you don't do a manual run/selection it should just use the latest version of an artifact.
Below an exerpt from our YAML pipeline:
name: pipelineB
resources:
pipelines:
- pipeline: pipelineA
source: pipelineA
branch: master
trigger:
branches:
- master
steps:
- task: DownloadBuildArtifacts@0
name:
displayName: 'Download pipelineA artifact'
inputs:
buildtype: specific
project: ourProjectName
pipeline: pipelineA
branchName: refs/heads/master
buildVersionToDownload: latestFromBranch
downloadType: specific
downloadPath: $(Pipeline.Workspace)
Working solution based on answer by @Krzysztof Madej. Only for the step
DownloadBuildArtifacts@0
the field buildVersionToDownload
needs to be changed to specific
and a new field needs to be introduced buildId
referring to the pipelineA
resource.
steps:
- task: DownloadBuildArtifacts@0
name:
displayName: 'Download pipelineA artifact'
inputs:
buildtype: specific
project: ourProjectName
pipeline: pipelineA
branchName: refs/heads/master
buildVersionToDownload: 'specific'
downloadType: specific
buildId: '$(resources.pipeline.pipelineA.runID)'
downloadPath: $(Pipeline.Workspace)
runID
– tjeerdnet