From 559a81ca181efd618d327447acec47e7450c11d1 Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Dec 09 2021 15:41:25 +0000 Subject: [PATCH 1/3] Adding example body for eln compose message Signed-off-by: Mohan Boddu --- diff --git a/compose_tracker.py b/compose_tracker.py index 73188cc..5e67231 100755 --- a/compose_tracker.py +++ b/compose_tracker.py @@ -65,6 +65,56 @@ EXAMPLE_MESSAGE_BODY = json.loads( } """) +# We are processing the org.fedoraproject.prod.odcs.compose.state-changed topic +# https://apps.fedoraproject.org/datagrepper/raw?topic=org.fedoraproject.prod.odcs.compose.state-changed&rows_per_page=1&delta=100000 +# EX: https://apps.fedoraproject.org/datagrepper/id?id=2021-a8dbce3c-e8bd-4b08-a12d-b426636b5076&is_raw=true&size=extra-large +#EXAMPLE_MESSAGE_BODY = json.loads( +# """ +#{ +# "compose": { +# "state_name": "failed", +# "sigkeys": "", +# "target_dir": "default", +# "results": [ +# "repository" +# ], +# "time_removed": null, +# "parent_pungi_compose_ids": null, +# "owner": "releng-odcs@service", +# "toplevel_url": "https://odcs.fedoraproject.org/composes/odcs-21212", +# "id": 21212, +# "state_reason": "Error while generating compose: Compose has taken more time than allowed by configuration", +# "multilib_method": 0, +# "multilib_arches": "", +# "scratch_modules": null, +# "lookaside_repos": "", +# "label": "Alpha-0.1639008001", +# "modular_koji_tags": null, +# "state": 4, +# "compose_type": "production", +# "flags": [], +# "module_defaults_url": null, +# "scratch_build_tasks": null, +# "koji_event": null, +# "source_type": 5, +# "koji_task_id": null, +# "packages": null, +# "time_started": "2021-12-09T00:00:02Z", +# "builds": null, +# "time_submitted": "2021-12-09T00:00:02Z", +# "arches": "x86_64", +# "time_to_expire": "2021-12-10T03:03:13Z", +# "pungi_compose_id": "Fedora-ELN-Rawhide-20211209.0", +# "source": "eln#eln", +# "time_done": null, +# "result_repo": "https://odcs.fedoraproject.org/composes/odcs-21212/compose/Temporary", +# "removed_by": null, +# "result_repofile": "" +# }, +# "event": "state-changed" +#} +#""") + class Consumer(object): def __init__(self): self.token = os.getenv('PAGURE_TOKEN') From 824d9f22ff3aabebe2422f4e2ab08d57b7906261 Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Dec 09 2021 15:47:18 +0000 Subject: [PATCH 2/3] Fixing the return values for get_maintainers() in eln tracking Signed-off-by: Mohan Boddu --- diff --git a/compose_tracker.py b/compose_tracker.py index 5e67231..7e391cb 100755 --- a/compose_tracker.py +++ b/compose_tracker.py @@ -362,7 +362,7 @@ class Consumer(object): if not eln: maintainers, variant, sub_variant = self.get_maintainers(line, ks_url) or (None, None, None) else: - maintainers, variant, sub_variant = self.get_maintainers('eln', ks_url) or (None, None, None) + maintainers, line = self.get_maintainers('eln', ks_url) or (None, None, None) if not maintainers: logger.info("No maintainers info available. The ticket will be filed without pinging any maintainers") else: From 5f2cb52dd689b97f74a667f371f599049ef74a8a Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Dec 09 2021 15:58:44 +0000 Subject: [PATCH 3/3] Check if the 'compose' key is in the message body for eln Signed-off-by: Mohan Boddu --- diff --git a/compose_tracker.py b/compose_tracker.py index 7e391cb..cc6e0cc 100755 --- a/compose_tracker.py +++ b/compose_tracker.py @@ -432,7 +432,7 @@ if __name__ == '__main__': body = data['msg'] # Create a Message and then call the Consumer() - if "ELN" in body['compose']['pungi_compose_id']: + if 'compose' in body and "ELN" in body['compose']['pungi_compose_id']: m = fedora_messaging.api.Message( topic = 'org.fedoraproject.prod.odcs.compose.state-changed', body = body)