You don't make any mention of the scripting language you want to use, so I will talk specifically about the HTTP requests to the BitBucket API:
If you have a BitBucket Repository that has three commits in in it the first and the last are failing the build, the middle is passing:
Get the list of commits
You can ...
I believe it is now possible to configure the webhook on per-repo basis:
In a typical Continuous Delivery/Deployment pipeline you would have the following happen:
Developer pushes one or more commits, or, a pull request is merged.
Jenkins automatically builds and executes tests.
If successful Jenkins publishes a deployment package to an Artefact Repository; if failure publishes nothing and notify developers.
One could update the build status in bitbucket as follows:
Adding a build result to a commit
To associate a build result with a particular commit, you need to POST
a JSON object to the build status REST resource at:
The format of the JSON object that ...
If you just need generic post-receive hooks, you can just do a regular web hook and hit the build API endpoint. For instance, if the name of your Jenkins server is jenkins.example.com and the name of the Pipeline job to trigger is my_awesome_job, then you can fire off a POST request to https://jenkins.example.com/job/my_awesome_job/build. Depending on your ...
To expand on the answer above - try using:
Because in groovy, string interpolation is not done for simple strings - i.e. strings within single quotes. See http://groovy-lang.org/syntax.html#_string_interpolation for details on that.
In groovy script, you need to reference environment variables in a different way than in bash.
So probably this line is causing trouble:
branch: ('origin/pr/' + env.pullRequestId + '/from')
prune your branches. (guessing you'd have done this by now if feasible.)
implement Jenkinsfile, a code-driven pipeline,
and simply remove the jenkinsfile from the branches you don't want
built or triggered by SCM-polling.