In my environment I have multiple instances of Jenkins. One instance is the 'prod' instance that is used by developers whereas the others are for me to test upgrading Jenkins, installing Plugins, tweaking config...

I run Jenkins on K8s and each instance is exactly the same except that it runs in a different K8s namespace.

I want to use webhooks but since the multiple instances are the same, if I just setup webhooks blindly, I will have multiple instances watching the same code Repos and acting on changes.

I could add some logic that when I setup my instances to remove the webhook config for the non-prod instances but I have a strong preference to keep the instances as similar as possible. What I would like to do is to instead have logic at the job or pipeline level (I use Jenkinsfiles with declarative syantax) such that I ignore the webhook if I am on a certain instance.

Is there a way to add some pipeline code that will run at the start of every pipeline?

Is there some global mechanism to manage or filter webhooks as they come in?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.