I have written a azure pipeline named my-azure-pipelines.yml to download the artifacts published in a specific build.
I have used the following task in my pipeline to download the artifacts from a specific build.
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
buildType: 'specific'
project: 'YourProjectName' # Replace with your Azure DevOps project name
**definition: 'YourBuildPipelineName' # Replace with the name of your build pipeline**(error)
buildId: 'YourBuildId' # Specify the build ID you want to download artifacts from
downloadType: 'single'
artifactName: 'YourArtifactName' # Replace with the name of the published artifact
downloadPath: '$(System.DefaultWorkingDirectory)/DownloadedArtifacts'
I am getting error which says ##[error]Definition name xyz didn't correspond to a valid definition
I am not sure what a build definition is and how to find it. Appreciate if somebody explains
I was expecting that the artifacts would be downloaded but due to the error the artifact are not getting downloaded
Error:
There is no definition
parameters for the task DownloadBuildArtifacts@0.
To fix the error, you can
settings
(grey) link to simply pick the value for the parameters on the right side.add
button, it will automatically override with correct values.After fix, it should look like below:
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
buildType: 'specific'
project: '1b60f1ab-xxxx3c91a6'
pipeline: '330'
buildVersionToDownload: 'specific'
buildId: '2488'
downloadType: 'single'
artifactName: 'YourArtifactName'
downloadPath: '$(System.DefaultWorkingDirectory)/DownloadedArtifacts'
In addition, if the artifact comes from another
project, please go to Project settings
-> Pipelines -> Settings -> Toggle off the option Limit job authorization scope to current project for non-release pipelines
.
If the target build is in same project, the option above is not needed.