'Jenkins trigger Job on multiple branch changes

I want to build a Jenkins job when a change was done (merged) in multiple branches.

What I tried was to configure "Source Code Management" with GIT,

Branch Specifier: */release/*, */hotfix/*, */dev but it don't want to build.

For build trigger I use "pull scm"

Does anyone know how I can implemnt this



Solution 1:[1]

Keep in mind about wildcards (*) that

The syntax is of the form: REPOSITORYNAME/BRANCH. In addition, BRANCH is recognized as a shorthand of */BRANCH, * is recognized as a wildcard, and ** is recognized as wildcard that includes the separator '/'. Therefore, origin/branches* would match origin/branches-foo but not origin/branches/foo, while origin/branches** would match both origin/branches-foo and origin/branches/foo.

Try to use regular expression as branch specifier

:(release|hotfix|dev)

See documentation for details:

The syntax is of the form: :regexp. Regular expression syntax in branches to build will only build those branches whose names match the regular expression.

Solution 2:[2]

Branch specifier to match multiple branches with wildcard (Regular expression)

:(.*feature\/.*|.*release\/.*)

This would match: origin/feature/... or origin/release/...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin Armatys
Solution 2