0

I'm trying to set up JSONPath filtering on incoming Bitbucket webhooks so the pipeline will only start when a push is made to the branch the pipeline is watching. The relevant parts of the webhook request body are:

{
  "push": {
    "changes": [
      {
        "new": {
          "name": "repo_name"
        }
      }
    ]
  }
}

which I filter with $.push.changes[0].new.name and check to see if the filter result matches {Branch}. I've also tried explicitly setting the branch name rather than letting CodePipeline resolve it.

I've confirmed this correctly filters the request with jsonpath.com, but using this no executions are triggered. I am able to get executions to trigger by using a JSONPath that just matches the repository name, but this is not ideal as executions will start when pushes are made to other branches too. What am I doing wrong?

  • why not using Source Version? – Nghia Do Jul 22 '20 at 18:02
  • @NghiaDo do you mean the commit hash? I'm not sure how that would work since the hash is unpredictable – Xenu's Prophet Jul 22 '20 at 19:18
  • "pipeline will only start when a push is made to the branch the pipeline is watching" if you're using the new Bitbucket integration powered by the CodeStar Connections action, then this should work out of the box without you having to setup a webhook on your own. It uses Bitbucket Apps which automatically sets up a webhook for you ;) – TimB Jul 29 '20 at 16:51

0 Answers0