File-based filtering for Jenkins Multibranch Pipeline (similar to GitHub Actions paths filter)

I’m using Jenkins 2.516.3 with GitHub Enterprise Server and Multibranch Pipeline jobs.

In GitHub Actions, I can use file-based filters (e.g., the paths / paths-ignore filters) on both pushes and pull requests. This prevents runners from starting and avoids triggering workflows when irrelevant files are changed.

For a standard Jenkins Pipeline job, I know we can achieve something similar using include/exclude regions. However, for Multibranch Pipeline jobs, I can’t find any documentation or configuration options that allow setting file filters per branch before triggering a build.

Does Jenkins support this kind of file filtering for Multibranch jobs?
If so, how can it be configured? And if not, is there a recommended workaround?

You can achive that in a Multibranch pipeline as well by installing the following plugin: Pipeline: Multibranch build strategy extension

Once you get that installed and restart Jenkins just open the configuration of your multibranch pipeline and under Branch sources → Build Strategies you can add some new strategies.

Among them:

  • Accept build by included regions strategy,
  • Cancel build by excluded regions strategy.

You have other ones as well. I believe this should cover your use case.

Can I then control the region in the Jenkinsfile configured in the branch?

I am not quite sure you can do that in the Jenkins file. However, besides the strategies I have listed as examples, there are two other ones that look promising:

  • Accept build by included regions strategy defined in file,
  • Cancel build by excluded regions strategy defined in file.

I have not tested them and I cannot check the parameters they support but I guess they should allow you to define the regions in a file in the repository. this should allow you to control the regions based on the branch. Have a look, maybe these options support the Jenkinsfile s well.