Search code examples
gitbitbucketpleskbitbucket-pipelines

How to invoke Plesk Git extension webhook via cURL from Bitbucket Pipelines?


Unfortunately, Bitbucket doesn't support per-branch webhooks and won't support them in the near future (https://bitbucket.org/site/master/issues/11728/trigger-webhook-only-for-push-to-specific).

So I thought I maybe could write a simple bitbucket-pipelines.yml which calls the corresponding webhook:

pipelines:
  branches:
    staging:
      - step:
          script:
            - curl $WEBHOOK_STAGING
    master:
      - step:
          script:
            - curl $WEBHOOK_PRODUCTION

Simply requesting the webhook, doesn't seem to trigger a git pull within Plesk, so I'm assuming that I need to add a payload.

Question: What do I need to send to the Plesk webhook in order to perform a pull?


Solution

  • Webhooks are done via a POST request instead of a GET request, so you will have to pass the argument -X POST to curl in order to send the request to your webhook correctly.

    So your curl statement would look like this:

    curl -X POST $WEBHOOK_PRODUCTION