diff options
author | James E. Blair <jim@acmegating.com> | 2023-02-21 14:54:10 -0800 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2023-04-28 11:46:33 -0700 |
commit | 1a4ec7e9266989207f879786a1c19b6d18180eb2 (patch) | |
tree | a7fa200ab9d55a643c8408df157380f5c64502b3 /zuul/driver/github/githubtrigger.py | |
parent | f653eecb97edfcb78ba8951eaa9576141ddc452e (diff) | |
download | zuul-1a4ec7e9266989207f879786a1c19b6d18180eb2.tar.gz |
Add GitHub pipeline trigger requirements
This mimics a useful feature of the Gerrit driver and allows users
to configure pipelines that trigger on events but only if certain
conditions of the PR are met.
Unlike the Gerrit driver, this embeds the entire require/reject
filter within the trigger filter (the trigger filter has-a require
or reject filter). This makes the code simpler and is easier for
users to configure. If we like this approach, we should migrate the
gerrit driver as well, and perhaps the other drivers.
The "require-status" attribute already existed, but was undocumented.
This documents it, adds backwards-compat handling for it, and
deprecates it.
Some documentation typos are also corrected.
Change-Id: I4b6dd8c970691b1e74ffd5a96c2be4b8075f1a87
Diffstat (limited to 'zuul/driver/github/githubtrigger.py')
-rw-r--r-- | zuul/driver/github/githubtrigger.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/zuul/driver/github/githubtrigger.py b/zuul/driver/github/githubtrigger.py index 76d8f574e..5072fda43 100644 --- a/zuul/driver/github/githubtrigger.py +++ b/zuul/driver/github/githubtrigger.py @@ -16,6 +16,7 @@ import logging import voluptuous as v from zuul.trigger import BaseTrigger from zuul.driver.github.githubmodel import GithubEventFilter +from zuul.driver.github import githubsource from zuul.driver.util import scalar_or_list, to_list @@ -50,7 +51,9 @@ class GithubTrigger(BaseTrigger): unlabels=to_list(trigger.get('unlabel')), states=to_list(trigger.get('state')), statuses=to_list(trigger.get('status')), - required_statuses=to_list(trigger.get('require-status')) + required_statuses=to_list(trigger.get('require-status')), + require=trigger.get('require'), + reject=trigger.get('reject'), ) efilters.append(f) @@ -75,6 +78,8 @@ def getSchema(): 'unlabel': scalar_or_list(str), 'state': scalar_or_list(str), 'require-status': scalar_or_list(str), + 'require': githubsource.getRequireSchema(), + 'reject': githubsource.getRejectSchema(), 'status': scalar_or_list(str), 'check': scalar_or_list(str), } |