Reviewed. Covers the problems I could think of. +1

On Tue, 3 Mar 2020 at 14:37, Mohan Boddu <mboddu@bhujji.com> wrote:
Currently when a package is retired, it sets the eol date to today's
date in pdc, but that enables people to revert the git retirement
commit until the end of the day and that causes a couple of problems

1. When fedpkg retire is called, it sets the eol date in pdc but when
people revert it on the very same day, the eol date is not changed
back.

2. Since the eol date is not change back, the package gets blocked in
koji and people have to request releng to fix it manually and it
causes some confusion.

To fix this issue, we decided to change the retirement date to
yesterday's date and that disables people to revert the commit.

Issues: https://pagure.io/releng/issue/8851 and
https://pagure.io/releng/issue/9169

Fix:

diff --git a/pdcupdater/handlers/retirement.py
b/pdcupdater/handlers/retirement.py
index 3ccda5a..1fbf23b 100644
--- a/pdcupdater/handlers/retirement.py
+++ b/pdcupdater/handlers/retirement.py
@@ -1,5 +1,5 @@
 import logging
-from datetime import datetime
+from datetime import datetime, timedelta
 import requests

 import pdcupdater.services
@@ -189,9 +189,12 @@ def _is_retired_in_dist_git(namespace, repo,
branch, requests_session=None):
 @pdcupdater.utils.retry(wait_on=requests.exceptions.ConnectionError)
 def _retire_branch(pdc, branch):
     """ Internal method for retiring a branch in PDC. """
-    today = datetime.utcnow().date()
+    # To disable immediate git reverts
+    # Fixes: https://pagure.io/releng/issue/8851 - Better solution required
+    # Fixes: https://pagure.io/releng/issue/9169 - Not ideal, but works
+    yesterday = datetime.utcnow().date() - timedelta(days=1)
     for sla in branch['slas']:
         sla_eol = datetime.strptime(sla['eol'], '%Y-%m-%d').date()
-        if sla_eol > today:
+        if sla_eol > yesterday:
             pdc['component-branch-slas'][sla['id']]._ \
-                += {'eol': str(today)}
+                += {'eol': str(yesterday)}


This will be a hotfix in pdc-backend01.phx2.fp.o where pdc-updater is running.

Thanks,
Mohan Boddu.
_______________________________________________
infrastructure mailing list -- infrastructure@lists.fedoraproject.org
To unsubscribe send an email to infrastructure-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@lists.fedoraproject.org


--
Stephen J Smoogen.