git - 有没有办法从现有的 YAML 自动设置 azure devops 管道?

标签 git azure azure-devops azure-pipelines cicd

我已经在 devops 存储库上托管了一些 YAML 文件。有没有办法从这些 YAML 文件自动创建 DevOps 管道,而不需要通过设置管道的向导。

建立新的存储库时也会出现这种情况。我正在为我的平台设置租赁,并且需要在引导存储库时自动设置一些管道。

不想通过以下向导来设置管道:

enter image description here

最佳答案

您可以使用 Rest API 使其自动化。 使用Pipelines - Create :

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=7.1-preview.1

正文示例:

$body = @{
  configuration=@{
                    variables=@{
                                customVariable=@{
                                        value="value"
                                }
                    };
                    path="azure-pipelines.yml";
                    repository=@{
                                    id=  "repository-id";
                                    name="repository-name"
                                    type=  "azureReposGit"
                                  };
                    type=  "yaml"
       };
   name=  "pipeline-name";
   folder= "\\"
 }

关于git - 有没有办法从现有的 YAML 自动设置 azure devops 管道?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76226831/

相关文章:

git - 在 Eclipse Ubuntu 中重新索引存储库

git - 在 git 中使用历史记录恢复已删除的文件

azure - 一个 azure 辅助角色是否可以拥有多个公共(public) IP 地址?

c# - asp.net mvc 4路由错误

visual-studio-2010 - 在没有团队基础服务器的情况下运行 Mstest.exe。

node.js - 如何将文件从 Github pull 到 Digital Ocean Droplet

git - 是否有包含 merge (仅)和非 merge 提交的 `git log` 摘要?

Azure 功能 - 从 IoT 中心保存到表存储

amazon-s3 - 如何使用 Azure Board 触发 API 调用或脚本

azure - 如何在 VSO 托管构建 Controller 上构建时设置环境变量?