1

I want to migrate an old project to Jenkins. It already had a couple of release which I don't want to (and sometimes can't - don't ask) build.

So basically, how can I tell Jenkins to build anything matching Git branches releases/1.10 and following, ignoring releases/0.1 up to releases/1.9.1?

One option would be to tell Jenkins "you have seen+built these branches" - something which Jenkins remembers automatically if you tell it to build "release/*" - it will build "release/1.0" only when someone pushed something new to that branch.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820

1 Answers1

0

A simple approach with some manual work is to create regexp patterns which match only new versions. In the case above, this would work:

:releases/1.\d\d+.*

This matches anything with a two digit minor version (so 1.0 .. 1.9 or excluded). Note the colon at the beginning tells Jenkins to treat this as a regexp.

It will break when you start with 2.x but you can either add a second branch in the Jenkins UI with the pattern release/2* (no colon here!) or use a more complex regexp:

:releases/(1.\d\d+|[2-9]).*

Things are more complicated if you want to start with 1.5:

:releases/(1.[5-9]|1.\d\d+|[2-9]).*

Read: 1. followed by 5 to 9 OR 1. followed by at least two digits (1.10, 1.11, ..., 1.20 ...) OR starting with 2 to 9.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820