I need to trigger a Jenkins build pipeline for N projects. These are stored in a Gerrit and their names have a pattern like this:
MODEL_A, MODEL_B, MODEL_C, etc.
So, in my opinion the best would be to use a regular expression for the comparison:
pipeline
...
triggers {
gerrit(
gerritProjects: [[
compareType: 'REG_EXP',
pattern : '**/MODEL_[A|B|C]**',
branches : [[
compareType: 'REG_EXP',
pattern : '**'
]]
]],
triggerOnEvents: [[
$class : 'PluginPatchsetCreatedEvent',
excludeDrafts : false,
excludeTrivialRebase: false,
excludeNoCodeChange : false
]]
)
}
...
}
The problem is that, no matter where I do the commit, no project is built. The patter is not a PCRE compliant patternand on the offigial Jenkis Gerrit trigger page is no example for such case.
Any hint with this regex?
Change from:
pattern : '**/MODEL_[A|B|C]**'
To:
pattern : '.*\/MODEL_[A-C].*'