如何检测 YAML 管道或经典管道中的 AzDO 扩展是否为 运行?

How to detect whether AzDO extension is running in YAML pipeline or Classic pipeline?

我一直在谷歌搜索这个,但找不到任何东西。 任何人都知道一种方法来检测您的扩展是否在经典与 YAML 管道中 运行?

我正在开发一个扩展,它会产生 ANSI 彩色输出,显然经典管道日志 UI 无法处理它,而 YAML 管道可以。我没有完全去除颜色,而是试图找到一种“聪明”的方法。

How to detect whether AzDO extension is running in YAML pipeline or Classic pipeline?

恐怕目前在 YAML 管道或经典管道中没有这种方法来限制自定义扩展 运行。

我们目前能做的就是在扩展的描述中添加一个状态:

{
    "id": "XXXX-A7C8-4A78-A7C3-8D717BB7C13C",
    "name": "YourExtension",
    "friendlyName": "Your Extension",
    "description": "This extension can only be used in YAML pipeline.",

在我看来这是一个合理的需求,因此我建议您可以在我们的 UserVoice 网站 (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ) 上添加对此功能的请求,该网站是我们提供产品建议的主要论坛。感谢您帮助我们构建更好的 Azure DevOps。