We are using Azure Pipelines (YAML not classic) for both build & releases. The stages are as follows:
- Build
- Deploy_DEV
- Deploy_UAT
- Deploy_PERF
- Deploy_PROD
The YAML is parameterised that user can select what stages to run. For example:
- Build & Deploy DEV, or
- Build + Deploy DEV + Deploy UAT.
Now problem arises in scenarios like below:
- Build + Deploy DEV. >> Outcome: Works
- Deploy SIT (DownloadPipelineArtifact@2 with
runVersion: 'latestFromBranch') >> Outcome: works because last build Id produced artifact and deployment was successful - Deploy UAT (DownloadPipelineArtifact@2 with
runVersion: 'latestFromBranch') >> Outcome fails, because the very last deploy job to SIT didnt produce any artifact.
I dont know if its a bug or shortcoming of this pipeline task, but would expect the DownloadPipelineArtifact@2 tasks refer to the very last build Id of the branch that produced the artifact. It seem from the logs that DownloadPipelineArtifact@2 task simply tries to download artifact from very previous pipeline run which may not have produced any artifact.
Its very normal during any project to run 1 build & and then deploy that build over time to various environment (promoting artifact). So pipeline stages per run would look like:
- Build artifact 1 on a commit
- Deploy artifact 1 to Env x
- Deploy artifact 2 to Env y
- Deploy artifact 3 to Env z ... etc.
Can someone advise if this is a shortcoming of the task or am I doing something wrong?
Below is my task configuration:
- task: DownloadPipelineArtifact@2
displayName: Download LATEST artifact
inputs:
buildType: 'specific'
project: '$(System.TeamProjectId)'
definition: '$(System.DefinitionId)'
runVersion: 'latestFromBranch'
branchName: '$(Build.SourceBranch)'
targetPath: '$(Pipeline.Workspace)'