This is an old revision of the document!


Jenkins Job Naming

We strive for consistency in our Jenkins job naming, so all names are validated using the following PCRE regex:

^(
    ( # define some frequently used capture groups
        (?!x)x                                   # always false ("match only if there is no 'x' ahead and there is 'x' ahead")
        (?<name>[^_]+)                           # group "name", name of the program/library
        (?<os>windows|linux|osx|android|illumos) # group "os", operating systems
        (?<arch>x86-64|x86|arm64|arm)            # group"arch", architectures
        (?<buildtype>release|debug)              # group"buildtype", build types
        (?<linking>shared|static|mixed)          # group "linking", library linking/build types
    )
    |
    ( # regular executable builds
        (?!lib)\g<name>_build_\g<os>_\g<arch>_\g<buildtype>
    )
    |
    ( # library builds
        lib\g<name>_build_\g<os>_\g<arch>_\g<linking>_\g<buildtype>
    )
    |
    ( # syncing source code of a project from git or something else
        \g<name>_src
    )
    |
    ( # static code analizer
        \g<name>_analyze_(cppcheck|scan-build)
    )
    |
    ( # package builds
        \g<name>_pkg_\g<os>_
            (
                ((?<=linux_) # if there is "linux_" before here
                    ( # then match
                        debian-8
                    )_
                )
                |
                ((?<!linux_)) # if there is no "linux_", don't match anything
            )
        \g<arch>_(stable|nightly)_\g<buildtype>
    )
)$

You can test your job name against the regex using this regex101 save.

Examples of valid job names

  • libtoxcore_analyze_scan-build
  • libtoxcore_build_linux_arm64_mixed_debug
  • libtoxcore_build_linux_x86_64_mixed_debug
  • libtoxcore_build_windows_x86_shared_release
  • libtoxcore_src
  • qTox_analyze_cppcheck
  • qtox_pkg_linux_debian-8_x86-64_stable_release
  • qtox_pkg_windows_x86-64_stable_release
  • utox_build_windows_x86_release
  • utox_pkg_linux-debian-8_arm_stable_debug
  • utox_pkg_osx_x86-64_nightly_debug
  • uTox_src

Note that the name part of the job (\g<name>) can contain lower case letters, as well as upper case ones. The general rule of thumb is to use lowercase letters for everything unless you have a good reason to not to. The reason for that rule of thumb is that most jobs initially were named in lowercase only (i.e. libqt5 instead of libQt5, libffmpeg, instead of libFFmpeg, etc.), and sometime later this was enforced by adding lowercase restriction to the regex above, but qTox and uTox maintainers wanted to have “T” letter in their jobs names, so the lowercase-only restriction in regex was lifted because of that, which makes them an exception to the general rule.

Improving the regex

If you want to add more rules to the regex or change existing ones, please bring it up for discussion in #tox-dev.

If you will be modifying the regex101 save, be aware that regex101 uses PCRE to evaluate the regex. Jenkins is a Java software, so it uses Java's regex engine, which is not fully compatible with PCRE. For example, Java's regex engine doesn't support backreference constructs \g<name> and conditional constructs (?(condition)X). Read more in Comparison to Perl 5. So even if your regex works fine in regex101, make sure it doesn't use things Java's regex engine doesn't support. Also, be sure to run the unit tests located at the end of the left menu of the regex101 save.

Although Java's regex engine doesn't support backreference constructs \g<name>, you can see us using them in the regex above. We find that construct to be quite useful, since it allows us to change a frequently repeating pattern once and it will change throughout the regex, so we wrote a pre-processor program that translates such multi-line, indented and non-standard commented regular expressions with backreference constructs to a single-line, no indentation, no comments and with backreference constructs replaced by corresponding named capturing group, so that the final regex could be used directly in Jenkins.

Print/export