azureazure-devopsazure-pipelines

Azure pipeline : DownloadBuildArtifacts@0 task itemPattern, can't download 2 files with different file suffixes and name patterns


I'm using DownloadBuildArtifacts@0 and I like to download all the *.ipa files and also the manifest.plist file.

When writing : itemPattern: '**/*.ipa it is downloading the ipa file but when I do:

- job: copy_back_files_to_self_hosted_connect
  dependsOn: mac_agent 
  timeoutInMinutes: 10
  pool: Default
  steps:
    - task: DownloadBuildArtifacts@0
      inputs:
        buildType: 'current'
        downloadType: 'single'
        artifactName: 'Artifacts'
        itemPattern: '**/*.ipa|manifest.plist'
        downloadPath: '$(System.ArtifactsDirectory)'
    - task: CopyFiles@2
      inputs:
        SourceFolder: '$(System.ArtifactsDirectory)'
        Contents: '**/*.ipa|manifest.plist'
        TargetFolder: '$(Agent.HomeDirectory)/../${{parameters.FolderCompile}}'

It downloaded none of the files not ipa and not the manifest.plist. What is the right pattern to download both all the time?


Solution

  • Coming from your previous ticket....

    You need define your task as below format:

    - task: DownloadBuildArtifacts@0
      displayName: 'Download Build Artifacts'
      inputs:
        buildType: 'current'
        downloadType: 'single'
        artifactName: Artifacts
        itemPattern: |
         **/*.ipa
         **/manifest.plist
    
    - task: CopyFiles@2
      displayName: 'Copy Files'
      inputs:
        SourceFolder: '$(System.ArtifactsDirectory)'
        Contents: |
         **/*.ipa
         **/manifest.plist
        TargetFolder: '$(Agent.HomeDirectory)/../${{parameters.FolderCompile}}'
    

    Since .ipa and manifest.plist are all come from the build artifact: Artifacts, both of them are all under the Artifacts folder. So, please also do not forget to use **/manifest.plist to retrieve your needed files.