Search code examples
gitjenkinsmergeautomationjenkins-pipeline

Jenkins pipeline same job for multiple branches


I'm looking for a quite specific option for which I haven't been able to find anything useful online.

Basically what I want is a single Jenkins pipeline job...which is capable of building from several branches. GIT repo is the same...just different branches.

Preferably branches would get recognized by a certain name prefix.

it is a possibility? Please advice...


Solution

  • You can use regular expression in Branch Specifier to match branches with specific prefix using :<regex>:

    :origin/prefix_.*
    

    should match origin/prefix_<whatever>