Search code examples
azure-devops-rest-apiazure-devops-extensionsazure-devops-server-2020

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


Incoming webhook can be triggered on Azure DevOps Server Version Dev18.M170.6, but it can't be triggered on Azure DevOps Server 2020.1.RC2.

I'm getting an error message from the 2020.1.RC2:

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

Below are snapshots of testing related APIs using postman.

Invoke Azure DevOps Server 2020.1.RC2 6.0-preview incoming webhook API: Invoke Azure DevOps Server 2020.1.RC2 6.0-preview incoming webhook API

Invoke Azure DevOps Server Dev18.M170.6 6.0-preview incoming webhook API with HTTP status 200 OK: Invoke Azure DevOps Server Dev18.M170.6 6.0-preview incoming webhook API with HTTP status 200 OK

Is there a way to make it work on the Azure DevOps Server 2020.1.RC2?


Solution

  • I found the cause!!!

    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*).