This will look at the root of a GitHub reference for .jervis.yml for the branches and tags filtering. You can customize the name of the YAML file searched for if you like.

For Tags:

For Branches:

Example YAML

branches:
  only:
    - main

More on specify branches and tags to build

By default Jervis will generate Jenkins jobs for all branches that have a .jervis.yml file. You can control and limit this behavior by specifying the branches or tags key in your .jervis.yml.

Allow or block branches and tags

You can either create an allow list of branches (only) or a block list of branches (except) to be built.

# block branches from building
branches:
  except:
    - legacy
    - experimental

# allow only these branches
branches:
  only:
    - main
    - stable

The same YAML can be applied to tags.

# block tags from building
tags:
  except:
    - .*-rc
    - .*-beta

# allow only these tags
tags:
  only:
    - v[.0-9]+

If you specify both only and except, then except will be ignored. .jervis.yml needs to be present on all branches you want to be built. .jervis.yml will be interpreted in the context of that branch so if you specify an allow list in your main branch, then it will not propagate to other branches.

Using regular expressions

You can use regular expressions to allow or block branches:

branches:
  only:
    - main
    - /^[.0-9]+-hotfix$/

Any name surrounded with / in the list of branches is treated as a regular expression. The expression will use Pattern.compile to compile the regex string into a Groovy regular expression.