From 1e1f325884e656c0414dcf6892973f002eef76e1 Mon Sep 17 00:00:00 2001 From: Laura Barcziova Date: Fri, 29 Nov 2024 13:42:30 +0100 Subject: [PATCH] Set UID when setting Pagure PR flag Generate it from the check_name. This prevents not creating multiple separate flags (for each state). This was already introduced in 0d4bc3653d61e7d10310823995aa97a8071f93fe . --- packit_service/worker/reporting/reporters/pagure.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packit_service/worker/reporting/reporters/pagure.py b/packit_service/worker/reporting/reporters/pagure.py index dc1a74de2..b5f41ff99 100644 --- a/packit_service/worker/reporting/reporters/pagure.py +++ b/packit_service/worker/reporting/reporters/pagure.py @@ -1,6 +1,6 @@ # Copyright Contributors to the Packit project. # SPDX-License-Identifier: MIT - +import hashlib import logging from typing import Optional @@ -47,8 +47,16 @@ def set_status( url = CONTACTS_URL if self.pull_request_object: + # generate a custom uid from the check_name, + # so that we can update flags we set previously, + # instead of creating new ones (Pagure specific behaviour) + uid = hashlib.md5(check_name.encode()).hexdigest() self.pull_request_object.set_flag( - username=check_name, comment=description, url=url, status=state_to_set + username=check_name, + comment=description, + url=url, + status=state_to_set, + uid=uid, ) else: