diff --git a/roles/bodhi2/backend/files/fedwatch.conf b/roles/bodhi2/backend/files/fedwatch.conf new file mode 100644 index 0000000000..a04a3ca914 --- /dev/null +++ b/roles/bodhi2/backend/files/fedwatch.conf @@ -0,0 +1,9 @@ +{ + "io.pagure.prod.pagure.issue.edit": { + "args": [ + "msg/project/fullname", + "msg/fields", + "msg/issue/content" + ] + } +} diff --git a/roles/bodhi2/backend/files/koji-sync-fedwatch-glue.py b/roles/bodhi2/backend/files/koji-sync-fedwatch-glue.py new file mode 100644 index 0000000000..e511cfe198 --- /dev/null +++ b/roles/bodhi2/backend/files/koji-sync-fedwatch-glue.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +""" This is a glue script to run /usr/local/bin/owner-sync-pagure on a given +package anytime a ticket gets closed at +https://pagure.io/releng/fedora-scm-requests + +Author: Ralph Bean +""" + +import json +import subprocess as sp +import sys + + +def handle(content): + body = content.strip('`').strip() + body = json.loads(body) + package = body['repo'] + # XXX If you modify this taglist. Please also modify the other copy in + # bodhi2/backend/tasks/main.yml + taglist = 'f27 f26 f25 f27-container f26-container f25-container epel7 dist-6E-epel module-package-list' + cmd = [ + '/usr/local/bin/owner-sync-pagure', + '--package', package, + '--verbose', + ] + taglist.split() + sp.Popen(cmd) + + +def main(fullname, fields, content): + if fullname != 'releng/fedora-scm-requests': + print("Dropping %r. Not scm request.") + return False + if 'close_status' not in fields: + print("Dropping %r. Not closed.") + return False + + handle(content) + + +if __name__ == '__main__': + fullname, fields, content = sys.argv[-3:] + main(fullname, fields, content) diff --git a/roles/bodhi2/backend/tasks/main.yml b/roles/bodhi2/backend/tasks/main.yml index a5de8b7f9d..e1188fe9bb 100644 --- a/roles/bodhi2/backend/tasks/main.yml +++ b/roles/bodhi2/backend/tasks/main.yml @@ -26,6 +26,7 @@ - python-scandir - python2-productmd - compose-utils + - fedwatch tags: - packages - bodhi @@ -160,6 +161,8 @@ - cron - name: sync packages from pagure-on-dist-git to koji (all branches) + # XXX If you modify this taglist. Please also modify the other copy in + # bodhi2/backend/tasks/main.yml cron: name="owner-sync" minute="15" user="root" job="/usr/local/bin/lock-wrapper owner-sync '/usr/local/bin/owner-sync-pagure f27 f26 f25 f27-container f26-container f25-container epel7 dist-6E-epel module-package-list'" cron_file=update-koji-owner @@ -168,6 +171,27 @@ - bodhi - cron +- name: configure fedwatch to sync packages as soon as requests are process. + copy: src=fedwatch.conf dest=/etc/fedwatch.conf + tags: + - bodhi + - fedwatch + +- name: put the fedwatch koji sync glue script in place + copy: + src: koji-sync-fedwatch-glue.py + dest: /etc/fedwatch.d/koji-sync-fedwatch-glue.py + mode: 0755 + tags: + - bodhi + - fedwatch + +- name: start fedwatch + service: name=fedwatch enabled=yes state=started + tags: + - bodhi + - fedwatch + # # cron job that syncs updates to master mirror #