无法在 Azure DevOps Server 版本 2020.1.RC2 上触发 Gitlab webhook

Gitlab webhook can't be triggered on Azure DevOps Server Version 2020.1.RC2

传入 webhook 可以在 Azure DevOps Server 版本 Dev18.M170.6 上触发,但无法在 Azure DevOps Server 2020.1.RC2 上触发.

我收到来自 2020.1.RC2 的错误消息:

Cannot find webhook for the given webHookId CodeSyncTrigger. Try enabling CD trigger for this artifact.

以下是使用 postman 测试相关 APIs 的快照。

调用 Azure DevOps Server 2020.1.RC2 6.0-preview 传入 webhook API:

调用 Azure DevOps Server Dev18.M170.6 6.0-preview 传入 webhook API,HTTP 状态为 200 OK:

有没有办法让它在 Azure DevOps Server 2020.1.RC2 上运行?

找到原因了!!!

https://developercommunity.visualstudio.com/t/cannot-use-generic-webhook-based-triggers-for-yaml/1135943#T-N1203277

  1. The service connection name does not need to be the same as the webhook name. The webhook name is what needs to be used in the API url. The service connection name is what needs to be referenced in the "connection:" line of the yml.

  2. The webhook name cannot be the naming convention/schema of an Azure DevOps Project ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

  3. After creating/modifying the webhook service connection, you must make a change(and commit) to each azure-pipeline.yml that references that webhook service connection for it to take effect for that repo/pipeline. A simple #comment will do.

  4. The "webhook:" (alias) line in the azure-pipelines.yml cannot have a hyphen, or your yaml will be invalid and the webhook won't work (see #5).

  5. The azure-pipelines.yml must not have any errors. To verify, try running the pipeline manually. If the pipeline initiates, then you should be good.

  6. It will only trigger the master branch. If you add the webhooks resource config to a non-master branch, it will not get triggered (this is a huge letdown for us*).

  7. You cannot use wildcards in the filters (this is also a huge letdown for us*).

在我的案例中,解决方案是更改默认分支,因为我托管的 yaml 不在主分支中

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-default-branch?view=azure-devops#:~:text=By%20default%2C%20a%20pipeline's%20default,...%20and%20select%20Triggers.