【问题标题】:Running `az artificats` commands from Azure DevOps pipeline YAML file从 Azure DevOps 管道 YAML 文件运行“az artificats”命令
【发布时间】:2020-03-31 02:42:05
【问题描述】:

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

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

任何建议将不胜感激。

##[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】:

    错误:az:“artifacts”不在“az”命令组中。请参阅“az --help”。

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

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

    请将此添加到您的 yaml 中,然后重试。希望这会奏效。

    【讨论】:

      【解决方案2】:

      得到同样的问题花了一个小时后得到解决方案: 如果没有扩展,它就无法工作,所以请尝试按照以下步骤操作:

      首先尝试点击以下命令查找扩展名

      az extension add --name azure-devops
      

      然后检查扩展是否可用:

      例如。对于管道:

      az extension add --name azure-devops
      

      然后运行该命令

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-04-02
        • 1970-01-01
        • 2021-12-29
        • 2022-11-03
        • 2020-05-23
        • 2020-05-28
        • 1970-01-01
        相关资源
        最近更新 更多