首页 > 解决方案 > 天蓝色任务:复制文件@2如果没有匹配的文件抛出错误

问题描述

如果没有文件匹配,我喜欢让任务失败。从阅读文件

我可以看到它的行为完全相反。

这是我的下载和复制任务,当它的 0 个文件抛出错误并使管道失败时如何

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}}'

标签: azureazure-devopsazure-pipelines

解决方案


你能做的只有:

  1. 如果有 eny 文件,则将 powershell/bash 脚本写入 schek,如果没有,exit 1则从脚本中生成使任务失败的内容
  2. CopyFiles以类似的方式分析您的任务日志

推荐阅读