从Azure DevOps管道YAML文件运行`az artificats`命令

问题描述 投票:0回答:1

在我的Azure Pipelines YAML文件中,我正在使用Bash任务来运行Python脚本,该脚本在Azure工件(通用包)上缓存CocoaPods库。我假设Azure DevOps虚拟机上的Azure命令行工具将安装最新的Azure扩展。我错了。

我的Python脚本调用诸如az artifacts universal downloadaz artifacts universal publish之类的命令。这在我的Mac上效果很好。在Microsoft的VM上没有那么多。

任何建议将不胜感激。

##[section]Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.159.3
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
./cache_pods.py Debug
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /Users/runner/runners/2.160.1/work/_temp/d0fd889d-a201-42ac-aad6-45ee3eca0532.sh
ERROR: az: 'artifacts' is not in the 'az' command group. See 'az --help'.
azure azure-devops package universal artifacts
1个回答
0
投票

错误:az:“工件”不在“ az”命令组中。参见“ az --help”。

您需要先安装Azure DevOps Extension,然后使用az构件命令。有关更多信息,请参考Azure DevOps CLI in Azure Pipeline YAML

steps:
- script: az extension add -n azure-devops
  displayName: 'Install Azure DevOps Extension'

请将此添加到您的Yaml中,然后重试。希望这会有用。

© www.soinside.com 2019 - 2024. All rights reserved.