| |
@@ -129,18 +129,17 @@
|
| |
models.ArtifactBuild.create(db.session, ev, name, type, build_id, dep_of)
|
| |
db.session.commit()
|
| |
|
| |
- def allow_build(self, event, artifact_type, name, branch):
|
| |
+ def allow_build(self, artifact_type, name, branch):
|
| |
"""
|
| |
Check whether the artifact is allowed to be built by checking
|
| |
HANDLER_BUILD_WHITELIST and HANDLER_BUILD_BLACKLIST in config.
|
| |
|
| |
- :param event: event instance.
|
| |
:param artifact_type: 'module' or 'image'.
|
| |
:param name: name of the artifact.
|
| |
:param branch: branch name of the artifact.
|
| |
:return: True or False.
|
| |
"""
|
| |
- # If there is a whitelist specified for the (handler, event, artifact_type),
|
| |
+ # If there is a whitelist specified for the (handler, artifact_type),
|
| |
# the build target of (name, branch) need to be in that whitelist first.
|
| |
# After that (if the build target is in whitelist), check the build target
|
| |
# is not in the specified blacklist.
|
| |
@@ -150,9 +149,8 @@
|
| |
in_blacklist = False
|
| |
|
| |
handler_name = self.name
|
| |
- event_name = type(event).__name__
|
| |
- whitelist_rules = conf.handler_build_whitelist.get(handler_name, {}).get(event_name, {})
|
| |
- blacklist_rules = conf.handler_build_blacklist.get(handler_name, {}).get(event_name, {})
|
| |
+ whitelist_rules = conf.handler_build_whitelist.get(handler_name, {})
|
| |
+ blacklist_rules = conf.handler_build_blacklist.get(handler_name, {})
|
| |
|
| |
def match_rule(name, branch, rule):
|
| |
name_rule = rule.get('name', None)
|
| |
@@ -179,8 +177,8 @@
|
| |
in_blacklist = True
|
| |
|
| |
except re.error as exc:
|
| |
- log.error("Error while compiling blacklist/whilelist rule for <handler(%s) event(%s) artifact(%s)>:\n"
|
| |
+ log.error("Error while compiling blacklist/whilelist rule for <handler(%s) artifact(%s)>:\n"
|
| |
"Incorrect regular expression: %s\nBlacklist and Whitelist will not take effect",
|
| |
- handler_name, event_name, artifact_type, str(exc))
|
| |
+ handler_name, artifact_type, str(exc))
|
| |
return True
|
| |
return in_whitelist and not in_blacklist
|
| |
As we have one handler for each event, so just having handler name in
whiltelist and blacklist is enough.