I have a build and release pipeline that runs the build stage after every pull request and the release stage on a schedule.
The build stage creates the artifacts and the release stage downloads them.
The problem I have is the download artifact task only seems to work if the current or previous pipeline produced them
E.g.
Should this be possible?
This is what I'm using to publish
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(ArtifactPathToPublish)'
artifact: '$(ArtifactName)'
publishLocation: 'pipeline'
And this is what I'm using to download
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'specific'
project: 'a1acfe27-c376-4239-a45c-a77eddf71d6f'
pipeline: 153
runVersion: 'latestFromBranch'
runBranch: $(Build.SourceBranch)
allowPartiallySucceededBuilds: true
artifact: '${{ parameters.ArtifactName }}'
path: '$(Pipeline.Workspace)/${{ parameters.ArtifactName }}'
I can't see any settings that may help with my issue.
At the moment it looks like I would need a hacky fix to find the runId
of the last successful pipeline and stage that ran and produced an artifact
runId
field of the existingDownload Pipeline Artifacts
task. Your solution looks fine as well although it's more powershell to maintain as you are downloading the artifact manually. – Konzy262