Azure 管道提取任务 7zip

标签 azure azure-devops azure-pipelines task

无法将 zip 解压缩到默认使用 Extract Task 的目标它失败并出现错误:

##[error]Unable to locate executable file: 'C:\azagent\A5\_work\_tasks\ExtractFiles_5e1e3830-fbfb-11e5-aab1-090c92bc4988\1.200.0\7zip\7z.exe'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

指出无法找到默认的 7zip 路径。尝试使用自定义 PATH 设置,但也失败并出现相同的错误。

更新

问题似乎是由代理权限引起的。仍然无法在服务模式下以管理员权限执行Release。当以管理员身份在交互模式下运行时,发布成功执行。

只要需要管理员权限,任务就会失败。

最佳答案

从错误消息来看,您的自托管代理上似乎未安装 7zip。在使用提取任务之前尝试安装 7zip。

以 Bash Task 为例:

brew install p7zip

对于 Windows,请使用以下 PowerShell 脚本进行安装:

$dlurl = 'https://7-zip.org/' + (Invoke-WebRequest -UseBasicParsing -Uri 'https://7-zip.org/' | Select-Object -ExpandProperty Links | Where-Object {($_.outerHTML -match 'Download')-and ($_.href -like "a/*") -and ($_.href -like "*-x64.exe")} | Select-Object -First 1 | Select-Object -ExpandProperty href)
# modified to work without IE
# above code from: https://perplexity.nl/windows-powershell/installing-or-updating-7-zip-using-powershell/
$installerPath = Join-Path $env:TEMP (Split-Path $dlurl -Leaf)
Invoke-WebRequest $dlurl -OutFile $installerPath
Start-Process -FilePath $installerPath -Args "/S" -Verb RunAs -Wait
Remove-Item $installerPath

关于Azure 管道提取任务 7zip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72548321/

相关文章:

azure - 与 Azure Java SDK 一起使用时,Jackson 在 Apache Spark 中发生冲突

linux - 在 Azure Web App 中跨 docker 重启保留内容

Azure 存储数据传输和数据输出成本

node.js - Azure Node.js Web App - 如何在更新时使服务可用?

azure - 有没有办法在 azure devops 仪表板的 markdown 中显示最后的构建 ID?

azure - 在 CI/CD 过程中管理 csproj 文件

django - 复制失败: stat/var/lib/docker/tmp/docker-builder<num>/server/requirements. txt:没有这样的文件或目录

Azure 管道代理无法提取项目并出现错误 : unsupported media type "undefined"

azure - 为 SourceVersion 指定的值不是有效的提交 ID

Azure 应用服务部署无法发布 "no files found"