-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from ralphbean/feature/mbs
New fmn.rules for the MBS.
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from fmn.lib.hinting import hint, prefixed as _ | ||
|
||
|
||
@hint(categories=['mbs']) | ||
def mbs_catchall(config, message): | ||
""" All MBS events | ||
Adding this rule will indiscriminately match notifications of all types | ||
from the `module build service <https://mbs.fedoraproject.org>`_, i.e. every | ||
time any module build transitions to any state (init, wait, build, failed, | ||
completed, ready, ...) | ||
""" | ||
return message['topic'].split('.')[3] == 'mbs' | ||
|
||
|
||
@hint(topics=[_('mbs.module.state.change')]) | ||
def mbs_build_state_change(config, message): | ||
""" Module builds changing state (any state) | ||
This rule lets through messages from the `mbs build | ||
service <https://mbs.fedoraproject.org>`_ that get published anytime a | ||
build changes state. The state could be anything: started, completed, | ||
failed, etc... | ||
""" | ||
return message['topic'].endswith('mbs.module.state.change') | ||
|
||
|
||
@hint(topics=[_('buildsys.build.state.change')], invertible=False) | ||
def mbs_build_started(config, message): | ||
""" Module builds submitted | ||
This rule lets through messages from the `module build | ||
service <https://mbs.fedoraproject.org>`_ that get published anytime **a | ||
module build starts**. | ||
""" | ||
if not mbs_build_state_change(config, message): | ||
return False | ||
|
||
return message['msg']['state_name'] == 'wait' | ||
|
||
|
||
@hint(topics=[_('buildsys.build.state.change')], invertible=False) | ||
def mbs_build_completed(config, message): | ||
""" Module builds completing | ||
This rule lets through messages from the `module build | ||
service <https://mbs.fedoraproject.org>`_ that get published anytime **a | ||
module build completes**. | ||
""" | ||
if not mbs_build_state_change(config, message): | ||
return False | ||
|
||
return message['msg']['state_name'] == 'done' | ||
|
||
|
||
@hint(topics=[_('buildsys.build.state.change')], invertible=False) | ||
def mbs_build_completed(config, message): | ||
""" Module builds failing | ||
This rule lets through messages from the `module build | ||
service <https://mbs.fedoraproject.org>`_ that get published anytime **a | ||
module build fails**. | ||
""" | ||
if not mbs_build_state_change(config, message): | ||
return False | ||
|
||
return message['msg']['state_name'] == 'failed' |