Hey everyone! I'm dealing with an issue where Jenkins keeps polling our repositories for changes, leading to a big backlog in the queue. We're currently using the 'Periodically if not otherwise run' feature in our Multibranch Pipeline setup. I'm wondering if there's a way to optimize this by switching to GitLab webhooks, so Jenkins only triggers builds when a new commit is pushed. I'd love to hear any best practices or configuration tips you might have. Thanks!
3 Answers
If you’ve got GitLab, you might want to consider using GitLab Pipelines instead of Jenkins. But I get it—getting that change approved can be tough! As for your question, the GitLab documentation has clear instructions on how to integrate it with Jenkins. Check it out [here](https://docs.gitlab.com/integration/jenkins/). That should help you get started with using webhooks.
Honestly, you really should just move away from Jenkins if you can. But if you can’t, here are some quick tips: add jitter to your polling times, keep your jobs lightweight, and set up webhooks with the help of your sysadmin. The Jenkins best practices guide can give you more detailed advice [here](https://www.jenkins.io/doc/book/using/best-practices/).
If you’re looking for a way to ease the load, consider moving some of your evaluation logic to upstream jobs that check for changes. This will let you run quicker and lighter jobs that don’t block your workflow as much. And definitely chat with your team about implementing webhooks. It’ll save a lot of hassle in the long run!

Great points! I’ve also found that keeping just two build jobs—one for evaluating code changes and another for the actual build—works wonders. Helps keep things simple and efficient.