mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-03-19 19:46:38 +08:00
mirror_from_forge: Change messages from pagure to forgejo.
Signed-off-by: James Antill <james@and.org>
This commit is contained in:
@@ -13,9 +13,8 @@ callback = "mirror_from_forge_bus:MirrorFromForge"
|
||||
queue = "mirror_forge_ansible{{ env_suffix }}"
|
||||
{% endif %}
|
||||
exchange = "amq.topic"
|
||||
# FIXME: This key is probably wrong.
|
||||
routing_keys = [
|
||||
"org.fedoraproject.prod.forgejo.git.receive",
|
||||
"org.fedoraproject.prod.forgejo.push",
|
||||
]
|
||||
|
||||
[tls]
|
||||
|
||||
@@ -11,8 +11,10 @@ import time
|
||||
|
||||
from fedora_messaging import config, message
|
||||
|
||||
# FIXME: This key is probably wrong
|
||||
_msg_topic = "org.fedoraproject.prod.forgejo.git.receive"
|
||||
_msg_topic = "org.fedoraproject.prod.forgejo.push"
|
||||
|
||||
# "pagure" or "forgejo"
|
||||
_msg_from = "forgejo"
|
||||
|
||||
_log = logging.getLogger("mirror_from_forge_bus")
|
||||
|
||||
@@ -73,7 +75,12 @@ class MirrorFromForge(object):
|
||||
|
||||
msg = message.Message
|
||||
msg.topic = _msg_topic
|
||||
msg.body = {"repo": {"fullname": self.trigger_names[0]}}
|
||||
if _msg_from is None:
|
||||
pass
|
||||
elif _msg_from == "forgejo": # Lots of things missing here...
|
||||
msg.body = {"repository": {"full_name": self.trigger_names[0]}}
|
||||
elif _msg_from == "pagure":
|
||||
msg.body = {"repo": {"fullname": self.trigger_names[0]}}
|
||||
self.__call__(message=msg)
|
||||
|
||||
def __call__(self, message, cnt=0):
|
||||
@@ -85,7 +92,14 @@ class MirrorFromForge(object):
|
||||
"""
|
||||
_log.info("Received topic: %s", message.topic)
|
||||
if message.topic == _msg_topic:
|
||||
repo_name = message.body.get("repo", {}).get("fullname")
|
||||
# In theory we could try both here, but it might be confusing later
|
||||
# so just use _msg_from and try one.
|
||||
if _msg_from is None:
|
||||
pass
|
||||
elif _msg_from == "forgejo":
|
||||
repo_name = message.body.get("repository", {}).get("full_name")
|
||||
elif _msg_from == "pagure":
|
||||
repo_name = message.body.get("repo", {}).get("fullname")
|
||||
if repo_name not in self.trigger_names:
|
||||
_log.info("%s is not a forge repo of interest, bailing", repo_name)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user