Home > Mobile >  Does Jenkins generic webhook option filtering actually prevent the build if it doesn't match
Does Jenkins generic webhook option filtering actually prevent the build if it doesn't match

Time:01-19

I have a pipeline whos job is to take attached submodules, bundle them up in a zip, and push them to an artifact repo only on a merge to the primary branch; all of this logic works fine.

However, because a merge event gets trigged for opened and merged for merge requests, for every merge into the primary branch there is always an effective "no op" build because it will receive the opened event.

From the documentation around option filtering in the generic webhook, it isn't clear to me if a no-match also won't trigger a build, or simply will product a value of "". Here is the documentation:

Value filter
Optional. Anything in the evaluated value, matching this regular expression, will be removed. Having [^0-9] would only allow numbers. The regexp syntax is documented here.

This simply leads to the javadoc on regex.

I would love to not trigger a build at all, even a no-op build, unless the state is "merged" jenkins config

CodePudding user response:

Yes, you can do it, but you need to add Optional Filter in another way. In the end of GWT plugin configuration of your job, there is a global Optional Filter section:

enter image description here

  • Related