How to download multiple artifacts of a specific build into a folder of a repo

88 Views Asked by At

Unable to download the artifacts generated from a specific build/latest buildI want to write a pipeline that can download the artifacts from a specific build and store in a folder of a repoartifact to download

I tried this pipeline

Our pipeline runs should pull artifacts from other repositories and make them

available to the script.

trigger:
- main  # Set the branch or trigger conditions for your pipeline

pool:
  name: Default  # You can choose an appropriate VM image based on your requirements

jobs:
- job: DownloadAndCopyArtifacts
  displayName: 'Download and Copy Artifacts'
  steps:
  - task: DownloadPipelineArtifact@2
    inputs:
      artifact: 'MyArtifacts'  # Replace with the actual name of your artifact from the kvi_sandbox pipeline
      path: '$(System.ArtifactsDirectory)'
      runVersion: 'latest'  # Set this to 'latest' to download from the latest successful build
      buildType: 'specific'
      project: 'kvi_sandbox'  # Replace with your actual project name
      pipeline: 'azure-pipelines.yml'  # Corrected to match the name of your pipeline file
      buildNumber: '98'  # Replace with the correct build number

  - task: CopyFiles@2
    inputs:
      sourceFolder: '$(System.ArtifactsDirectory)/xyz'  # Replace 'steam' with the actual folder structure
      contents: '**'
      targetFolder: '$(Build.SourcesDirectory)/abc/assets/xyz'

  - task: CopyFiles@2
    inputs:
      sourceFolder: '$(System.ArtifactsDirectory)/pqr'   # Replace 'pyro' with the actual folder structure
      contents: '**'
      targetFolder: '$(Build.SourcesDirectory)/HYBM_Pipelines_Rebuild/assets/cde'

# Add additional jobs or stages as needed for your pipeline

but getting the error

##[error]The following pipeline does not exist: azure-pipelines.yml. Please verify the name of the pipeline. error

I have verified the pipeline. It exists! that pipeline is actually what is generating the artifact

Thanks in advance

1

There are 1 best solutions below

1
Kevin Lu-MSFT On

##[error]The following pipeline does not exist: azure-pipelines.yml. Please verify the name of the pipeline

From your yaml sample, you are using the Download Pipeline Artifacts task.

The cause of the error is that you are defining the Pipeline file name (azure-pipelines.yml) in the Pipeline field of DownloadPipelineArtifact task.

The pipeline field needs to set Pipeline name or Pipeline ID to point to the target Pipeline.

To solve this issue, you can change to set the Pipeline name/Pipeline ID to Pipeline field of DownloadPipelineArtifact task.

You can find the Pipeline name as the screenshot below:

enter image description here

For example:

jobs:
- job: DownloadAndCopyArtifacts
  displayName: 'Download and Copy Artifacts'
  steps:
  - task: DownloadPipelineArtifact@2
    inputs:
      artifact: 'MyArtifacts'  # Replace with the actual name of your artifact from the kvi_sandbox pipeline
      path: '$(System.ArtifactsDirectory)'
      runVersion: 'latest'  # Set this to 'latest' to download from the latest successful build
      buildType: 'specific'
      project: 'kvi_sandbox'  # Replace with your actual project name
      pipeline: 'kvi_sandbox (1)'  # Corrected to match the name of your pipeline file
      buildNumber: '98'  # Replace with the correct build number