首页 > 解决方案 > Azure devops 管道 ArchiveFiles 错误:无法找到可执行文件:'zip'

问题描述

我正在为 python 包构建创建 Azure DevOps 管道,但任务 ArchiveFiles@2 失败。

- stage: Build
  jobs:
    - job: BuildApp
      pool:
        vmImage: 'ubuntu-latest'
      - task: ArchiveFiles@2
        inputs:
          rootFolderOrFile: '$(Build.SourcesDirectory)'
          includeRootFolder: false
          archiveType: 'zip'
          archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
          replaceExistingArchive: true
          verbose: true

错误日志是这样的

Found 20 files
Archiving file: .env_sample
... 21 more ...

##[debug]Checking for archive destination folder:/__w/1/a
##[debug]Creating archive with zip: /__w/1/a/1009007.zip
##[debug]which 'zip'
##[debug]not found
##[debug]Unable to locate executable file: 'zip'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

标签: pythonazure-devops

解决方案


我同意@Daniel Mann 的观点,并且在执行 ArchiveFiles@2 任务时遇到了同样的问题。我将 ubuntu 18.04 版本的代理用于 DevOps 代理池。安装 ZIP 后,它工作。


推荐阅读