简体   繁体   English

在 Azure DevOps 中丢失时强制下载和安装扩展

[英]Force download and install extension when missing in Azure DevOps

I have an Azure DevOps YAML which creates resources on azure with Terraform.我有一个 Azure DevOps YAML,它使用 Terraform 在 azure 上创建资源。 In order to achieve that I have used this terraform extension for Azure DevOps.为了实现这一点,我将这个 terraform 扩展用于 Azure DevOps。 My goal is to re-use this template in the future on other organizations.我的目标是将来在其他组织中重复使用此模板。

I want to use this YAML template without installing this or any other extension manually.我想使用这个 YAML 模板而不手动安装这个或任何其他扩展。

  1. Is there a way to force the YAML to install the extensions that are missing?有没有办法强制 YAML 安装缺少的扩展?
  2. Is there a way to write a Powershell/any other programming languages to download and install the extensions?有没有办法编写 Powershell/任何其他编程语言来下载和安装扩展?

You can't force download an extension in the YAML :/ but you can use the Rest API Install Extension By Name to install the extension problematically, with PowerShell for example.您不能在 YAML 中强制下载扩展:/ 但您可以使用 Rest API Install Extension By Name来安装有问题的扩展,例如使用 PowerShell。

In addition, you can use Azure DevOps CLI to install the extension.此外,您可以使用Azure DevOps CLI来安装扩展。

So you can add a PS task that check if the extension exist, if not - install it.所以你可以添加一个 PS 任务来检查扩展是否存在,如果不存在 - 安装它。

Or just script that install it and in the first time run the script in the organization.或者只是安装它并在第一次在组织中运行脚本的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM