1

i like to fail the task if no files are matched. from reading the documents

i can see its behavior is exactly the opposite.

here is my download and copy task, how when its 0 files to throw error and to fail the pipeline

steps:
    - task: DownloadBuildArtifacts@0
      inputs:
        buildType: 'current'
        downloadType: 'single'
        artifactName: 'Artifacts'
        itemPattern: | 
                **/*.a
                **/*s.plist*
        downloadPath: '$(System.ArtifactsDirectory)'
    - task: CopyFiles@2
      inputs:
        SourceFolder: '$(System.ArtifactsDirectory)'
        Contents: | 
                **/*.a
                **/*s.plist*
        TargetFolder: '$(Agent.HomeDirectory)/../${{parameters.FolderCompile}}'
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
user63898
  • 29,839
  • 85
  • 272
  • 514

1 Answers1

1

What you can do is only:

  1. Write powershell/bash script to schek if there is eny file and if not then make exit 1 from the script what fails the task
  2. Analyze logs of your CopyFiles task in a similar way how it is done here
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • 1
    Thank you , i did the number 1 suggestion with bash script – user63898 Oct 12 '20 at 08:52
  • see if you can help with this :https://stackoverflow.com/questions/64314830/azure-pipeline-how-detect-when-pipeline-stoped-when-script-waiting-for-user-inpu – user63898 Oct 12 '20 at 09:16