Configure webhook to not trigger the jenkins job after the file is pushed to bitbucket

I have a bit different requirement. I have a Jenkins job that is being triggered by a webhook. It is a Post Receive hook in the Bitbucket.

The webhook works and the job get triggered. The thing is the job needs to edit a file in the repo and then commit the same file back to the repo. This also works, but once the file is pushed to the repo, it triggers another build in Jenkins. Leading to chain reaction scenario.

What I want to do here is, when I commit and push the file from the Jenkins job, the file should get pushed to the repo, but the webhook should not trigger for this particular file. If any other file is modified and pushed, the webhook should trigger and hence the Jenkins job as well.

Is there any configuration that we can do in the Bitbucket webhook so that if simply do not trigger if a particular file is pushed?

Thanks for being part of the GitHub Community Forum. We’re glad you’re here.

The GitHub Community Forum focuses primarily on topics related to GitHub itself or collaboration on project development and ideas. Unfortunately, we don’t support Jenkins or BitBucket. You may want to contact their respective support resources for assistance: Jenkins, BitBucket.

On the other hand, you may want to take a look at the GitHub Actions feature, that now includes support for CI activities like Jenkins.

Let us know.