azure - Azure Devops 管道的传入 Webhook 触发器 : "Cannot find webhook for the given webHookId"

标签 azure azure-pipelines webhooks azure-devops-pipelines

我尝试在项目中设置传入的 Webhook 以触发 yaml 管道。 设置与传入 Webhook 的服务连接。 将 yaml 片段添加到管道中,如下所示:

resources:
  webhooks:
    - webhook: testtrigger          ### Webhook alias
      connection: testconnection   ### Incoming webhook service connection

通过curl调用url时:curl -X POST 'https://dev.azure.com/<my org>/_apis/public/distributedtask/webhooks/testtrigger?api-version=6.0-preview' -d '{ "tags": {} }' -H "Content-Type: application/json" ,我总是收到错误消息:

{"$id":"1","innerException":null,"message":"Cannot find webhook for the given webHookId testtrigger. Try enabling CD trigger for this artifact.","typeName":"Microsoft.TeamFoundation.DistributedTask.Pipelines.Artifacts.WebHooks.WebHookException, Microsoft.TeamFoundation.DistributedTask.Orchestration.Server","typeKey":"WebHookException","errorCode":0,"eventId":3000}

在触发器/连接上尝试使用不同的名称,但没有任何效果。 我缺少什么想法吗?

最佳答案

呼应@FrankBaumfalk的评论,您需要确保管道的默认分支与您正在开发的分支相同。 (您可能像我一样,在其构建的同一存储库的分支上开发和测试此 yaml。)

指示您的默认分支:

  1. 编辑您的管道
  2. 从烤肉菜单中选择触发器
  3. 选择YAML选项卡,见下文👇
  4. 注意默认的分支字段;保存

enter image description here

此外,是的,引用 webHookId 的错误是服务连接中传入 WebHook 中的 WebHook 名称。> 一致的命名。

关于azure - Azure Devops 管道的传入 Webhook 触发器 : "Cannot find webhook for the given webHookId",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67622056/

相关文章:

Azure Function EventHubTriggerAttribute 不使用 local.settings.json 中的事件中心名称

azure - 如何在 azure 日志分析工作区中使用 kql 查询拆分列值以分配给自定义列

azure - 一旦失败的测试百分比高于阈值,如何使 Azure DevOps 中的管道运行失败

azure - Azure DevOps 发布管道的工件位置

node.js - 保护 Twitter Webhook

azure - 我的托管集群 VirtualMachineScaleSet 中的 vmssCSE 扩展是什么?

sql-server - 无法将 Node.js 服务器连接到 Azure SQL 数据库

azure-devops - 如何设置 Azure DevOps 通知以在管道运行失败后接收?

ruby-on-rails - Stripe Webhook在Rails上

teamcity - 如何让 BitBucket.org 提交触发 TeamCity 构建?