From c916b49701c2c2de3f0b12e554dfa1f90f653ac9 Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Apr 04 2019 13:43:56 +0000 Subject: The pkgdb rules are not working anymore. This commit move the rules using pkdb to a retired_rules directory. That way we do not sync them on the backend server and break the fedmsg consumer. Signed-off-by: Clement Verna --- diff --git a/retired_rules/helping-hand.yml b/retired_rules/helping-hand.yml new file mode 100644 index 0000000..984fff0 --- /dev/null +++ b/retired_rules/helping-hand.yml @@ -0,0 +1,35 @@ +%YAML 1.2 +--- + +name: Helping Hand +description: You built a package owned by someone else. It takes a village... +creator: ralph +discussion: https://pagure.io/design/issue/76 +image_url: https://badges.fedoraproject.org/pngs/helping_hand.png +issuer_id: fedora-project + + +# From the ticket: +# Trigger from buildsys.build.state.change like all the Koji Success builds, +# then check package builder and owner. Though having a quick look, I'm not +# sure this info is in the fedmsg message itself, I think you get just the +# build submitter; do we need to extend fedmsg-koji for this, or can we check +# the package owner in pkgdb in the trigger/criteria? + +trigger: + all: + - topic: buildsys.build.state.change + - lambda: msg.get('msg', {}).get('new', None) is 1 + - lambda: msg.get('msg', {}).get('instance', None) == 'primary' + +# This is the most complex criteria we have to date. The badge is only awarded +# if the owner of the build is *not* an owner of the package in the pkgdb. +criteria: + not: + pkgdb: + owns: + user: "%(msg.owner)s" + packages: + - "%(msg.name)s" + +recipient: "%(msg.owner)s" diff --git a/retired_rules/pkgdb-hatchling-i.yml b/retired_rules/pkgdb-hatchling-i.yml new file mode 100644 index 0000000..5a2a77d --- /dev/null +++ b/retired_rules/pkgdb-hatchling-i.yml @@ -0,0 +1,30 @@ +%YAML 1.2 +--- + +# This is some metadata about the badge. +name: Delivery +description: You added a new package to the distribution. +creator: adamwill +discussion: https://pagure.io/design/issue/243 +image_url: https://badges.fedoraproject.org/pngs/delivery.png +issuer_id: fedora-project + +# We'll perform our more costly check (defined below) +# only when we receive messages that match this trigger. +trigger: + topic: pkgdb.package.new + +# Once the check has been triggered, this defines what we +# actually check. +criteria: + datanommer: + filter: + topics: + - "%(topic)s" # The topic of the message that triggered us. + users: + - "%(msg.package_listing.point_of_contact)s" # The owner of the newly created package. + operation: count + condition: + greater than or equal to: 1 + +recipient: "%(msg.package_listing.point_of_contact)s" diff --git a/retired_rules/pkgdb-old-yeller.yml b/retired_rules/pkgdb-old-yeller.yml new file mode 100644 index 0000000..20d9497 --- /dev/null +++ b/retired_rules/pkgdb-old-yeller.yml @@ -0,0 +1,39 @@ +%YAML 1.2 +--- + +# This is some metadata about the badge. +name: Old Yeller +description: You retired a package from the distribution. It hurt, but it had to be done. +creator: adamwill + +# This is a link to the discussion about adopting this as a for-real badge. +discussion: https://pagure.io/design/issue/21 + +# A link to the image for the badge. +image_url: https://badges.fedoraproject.org/pngs/pkgdb-old-yeller.png + +# The issuer. +issuer_id: fedora-project + +# We'll perform our more costly check (defined below) +# only when we receive messages that match this trigger. +trigger: + all: + - topic: pkgdb.package.update.status + - lambda: msg.get('msg', {}).get('prev_status', None) != 'Retired' + - lambda: msg.get('msg', {}).get('status', None) == 'Retired' + +# Once the check has been triggered, this defines what we +# actually check. +criteria: + datanommer: + filter: + topics: + - "%(topic)s" # The topic of the message that triggered us. + users: + - "%(msg.agent)s" # The owner of the retired package. + operation: count + condition: + greater than or equal to: 1 + +recipient: "%(msg.agent)s" diff --git a/retired_rules/pkgdb-partners-in-crime.yml b/retired_rules/pkgdb-partners-in-crime.yml new file mode 100644 index 0000000..efdb5c9 --- /dev/null +++ b/retired_rules/pkgdb-partners-in-crime.yml @@ -0,0 +1,42 @@ +%YAML 1.2 +--- + +# This is some metadata about the badge. +name: Partners in Crime +description: You added a co-maintainer to a package. BFF! +creator: adamwill + +# This is a link to the discussion about adopting this as a for-real badge. +discussion: https://pagure.io/design/issue/66 + +# A link to the image for the badge. +image_url: https://badges.fedoraproject.org/pngs/pkgdb-partners-in-crime.png + +# The issuer. +issuer_id: fedora-project + +# We'll perform our more costly check (defined below) +# only when we receive messages that match this trigger. +trigger: + all: + - topic: pkgdb.acl.update + - lambda: msg.get('msg', {}).get('acl', None) == 'commit' + - lambda: msg.get('msg', {}).get('status', None) == 'Approved' + - lambda: not msg.get('msg', {}).get('username', None) == None + - lambda: msg.get('msg', {}).get('username', None) != msg.get('msg', {}).get('agent', None) + +# This criteria check could just be left empty since the trigger matching is all +# that we need. We'll do something trivial just because fedbadges demands a +# criteria block. We can remove this in the future. +criteria: + datanommer: + filter: + topics: + - "%(topic)s" # The topic of the message that triggered us. + users: + - "%(msg.agent)s" # The badge recipient. + operation: count + condition: + greater than or equal to: 1 + +recipient: "%(msg.agent)s" diff --git a/retired_rules/pkgdb-phoenix-down.yml b/retired_rules/pkgdb-phoenix-down.yml new file mode 100644 index 0000000..f78d1fe --- /dev/null +++ b/retired_rules/pkgdb-phoenix-down.yml @@ -0,0 +1,38 @@ +%YAML 1.2 +--- + +# This is some metadata about the badge. +name: Phoenix Down +description: You unretired a package from the distribution. Long may it live! +creator: adamwill + +# This is a link to the discussion about adopting this as a for-real badge. +discussion: https://pagure.io/design/issue/22 + +# A link to the image for the badge. +image_url: https://badges.fedoraproject.org/pngs/pkgdb-phoenix-down.png + +# The issuer. +issuer_id: fedora-project + +# We'll perform our more costly check (defined below) +# only when we receive messages that match this trigger. +trigger: + all: + - topic: pkgdb.package.retire + - lambda: msg.get('msg', {}).get('retirement', None) == 'unretired' + +# Once the check has been triggered, this defines what we +# actually check. +criteria: + datanommer: + filter: + topics: + - "%(topic)s" # The topic of the message that triggered us. + users: + - "%(msg.agent)s" # The owner of the retired package. + operation: count + condition: + greater than or equal to: 1 + +recipient: "%(msg.agent)s" diff --git a/retired_rules/pkgdb-the-cat-came-back.yml b/retired_rules/pkgdb-the-cat-came-back.yml new file mode 100644 index 0000000..2215444 --- /dev/null +++ b/retired_rules/pkgdb-the-cat-came-back.yml @@ -0,0 +1,30 @@ +%YAML 1.2 +--- +name: The cat came back... +description: You took ownership of a previously orphaned package. +creator: ralph +discussion: https://pagure.io/design/issue/7 +image_url: https://badges.fedoraproject.org/pngs/pkgdb-the-cat-came-back.png +issuer_id: fedora-project + +# This is really all that matters for this badge. +trigger: + all: + - topic: pkgdb.owner.update + - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) != None + - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) != 'orphan' + - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) == msg.get('msg', {}).get('agent', None) + +# This is really a throwaway check. fedbadges demands that we have one. +criteria: + datanommer: + filter: + topics: + - "%(topic)s" + users: + - "%(msg.agent)s" + operation: count + condition: + greater than or equal to: 1 + +recipient: "%(msg.agent)s" diff --git a/rules/helping-hand.yml b/rules/helping-hand.yml deleted file mode 100644 index 984fff0..0000000 --- a/rules/helping-hand.yml +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.2 ---- - -name: Helping Hand -description: You built a package owned by someone else. It takes a village... -creator: ralph -discussion: https://pagure.io/design/issue/76 -image_url: https://badges.fedoraproject.org/pngs/helping_hand.png -issuer_id: fedora-project - - -# From the ticket: -# Trigger from buildsys.build.state.change like all the Koji Success builds, -# then check package builder and owner. Though having a quick look, I'm not -# sure this info is in the fedmsg message itself, I think you get just the -# build submitter; do we need to extend fedmsg-koji for this, or can we check -# the package owner in pkgdb in the trigger/criteria? - -trigger: - all: - - topic: buildsys.build.state.change - - lambda: msg.get('msg', {}).get('new', None) is 1 - - lambda: msg.get('msg', {}).get('instance', None) == 'primary' - -# This is the most complex criteria we have to date. The badge is only awarded -# if the owner of the build is *not* an owner of the package in the pkgdb. -criteria: - not: - pkgdb: - owns: - user: "%(msg.owner)s" - packages: - - "%(msg.name)s" - -recipient: "%(msg.owner)s" diff --git a/rules/pkgdb-hatchling-i.yml b/rules/pkgdb-hatchling-i.yml deleted file mode 100644 index 5a2a77d..0000000 --- a/rules/pkgdb-hatchling-i.yml +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.2 ---- - -# This is some metadata about the badge. -name: Delivery -description: You added a new package to the distribution. -creator: adamwill -discussion: https://pagure.io/design/issue/243 -image_url: https://badges.fedoraproject.org/pngs/delivery.png -issuer_id: fedora-project - -# We'll perform our more costly check (defined below) -# only when we receive messages that match this trigger. -trigger: - topic: pkgdb.package.new - -# Once the check has been triggered, this defines what we -# actually check. -criteria: - datanommer: - filter: - topics: - - "%(topic)s" # The topic of the message that triggered us. - users: - - "%(msg.package_listing.point_of_contact)s" # The owner of the newly created package. - operation: count - condition: - greater than or equal to: 1 - -recipient: "%(msg.package_listing.point_of_contact)s" diff --git a/rules/pkgdb-old-yeller.yml b/rules/pkgdb-old-yeller.yml deleted file mode 100644 index 20d9497..0000000 --- a/rules/pkgdb-old-yeller.yml +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.2 ---- - -# This is some metadata about the badge. -name: Old Yeller -description: You retired a package from the distribution. It hurt, but it had to be done. -creator: adamwill - -# This is a link to the discussion about adopting this as a for-real badge. -discussion: https://pagure.io/design/issue/21 - -# A link to the image for the badge. -image_url: https://badges.fedoraproject.org/pngs/pkgdb-old-yeller.png - -# The issuer. -issuer_id: fedora-project - -# We'll perform our more costly check (defined below) -# only when we receive messages that match this trigger. -trigger: - all: - - topic: pkgdb.package.update.status - - lambda: msg.get('msg', {}).get('prev_status', None) != 'Retired' - - lambda: msg.get('msg', {}).get('status', None) == 'Retired' - -# Once the check has been triggered, this defines what we -# actually check. -criteria: - datanommer: - filter: - topics: - - "%(topic)s" # The topic of the message that triggered us. - users: - - "%(msg.agent)s" # The owner of the retired package. - operation: count - condition: - greater than or equal to: 1 - -recipient: "%(msg.agent)s" diff --git a/rules/pkgdb-partners-in-crime.yml b/rules/pkgdb-partners-in-crime.yml deleted file mode 100644 index efdb5c9..0000000 --- a/rules/pkgdb-partners-in-crime.yml +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.2 ---- - -# This is some metadata about the badge. -name: Partners in Crime -description: You added a co-maintainer to a package. BFF! -creator: adamwill - -# This is a link to the discussion about adopting this as a for-real badge. -discussion: https://pagure.io/design/issue/66 - -# A link to the image for the badge. -image_url: https://badges.fedoraproject.org/pngs/pkgdb-partners-in-crime.png - -# The issuer. -issuer_id: fedora-project - -# We'll perform our more costly check (defined below) -# only when we receive messages that match this trigger. -trigger: - all: - - topic: pkgdb.acl.update - - lambda: msg.get('msg', {}).get('acl', None) == 'commit' - - lambda: msg.get('msg', {}).get('status', None) == 'Approved' - - lambda: not msg.get('msg', {}).get('username', None) == None - - lambda: msg.get('msg', {}).get('username', None) != msg.get('msg', {}).get('agent', None) - -# This criteria check could just be left empty since the trigger matching is all -# that we need. We'll do something trivial just because fedbadges demands a -# criteria block. We can remove this in the future. -criteria: - datanommer: - filter: - topics: - - "%(topic)s" # The topic of the message that triggered us. - users: - - "%(msg.agent)s" # The badge recipient. - operation: count - condition: - greater than or equal to: 1 - -recipient: "%(msg.agent)s" diff --git a/rules/pkgdb-phoenix-down.yml b/rules/pkgdb-phoenix-down.yml deleted file mode 100644 index f78d1fe..0000000 --- a/rules/pkgdb-phoenix-down.yml +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.2 ---- - -# This is some metadata about the badge. -name: Phoenix Down -description: You unretired a package from the distribution. Long may it live! -creator: adamwill - -# This is a link to the discussion about adopting this as a for-real badge. -discussion: https://pagure.io/design/issue/22 - -# A link to the image for the badge. -image_url: https://badges.fedoraproject.org/pngs/pkgdb-phoenix-down.png - -# The issuer. -issuer_id: fedora-project - -# We'll perform our more costly check (defined below) -# only when we receive messages that match this trigger. -trigger: - all: - - topic: pkgdb.package.retire - - lambda: msg.get('msg', {}).get('retirement', None) == 'unretired' - -# Once the check has been triggered, this defines what we -# actually check. -criteria: - datanommer: - filter: - topics: - - "%(topic)s" # The topic of the message that triggered us. - users: - - "%(msg.agent)s" # The owner of the retired package. - operation: count - condition: - greater than or equal to: 1 - -recipient: "%(msg.agent)s" diff --git a/rules/pkgdb-the-cat-came-back.yml b/rules/pkgdb-the-cat-came-back.yml deleted file mode 100644 index 2215444..0000000 --- a/rules/pkgdb-the-cat-came-back.yml +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.2 ---- -name: The cat came back... -description: You took ownership of a previously orphaned package. -creator: ralph -discussion: https://pagure.io/design/issue/7 -image_url: https://badges.fedoraproject.org/pngs/pkgdb-the-cat-came-back.png -issuer_id: fedora-project - -# This is really all that matters for this badge. -trigger: - all: - - topic: pkgdb.owner.update - - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) != None - - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) != 'orphan' - - lambda: msg.get('msg', {}).get('package_listing', {}).get('point_of_contact', None) == msg.get('msg', {}).get('agent', None) - -# This is really a throwaway check. fedbadges demands that we have one. -criteria: - datanommer: - filter: - topics: - - "%(topic)s" - users: - - "%(msg.agent)s" - operation: count - condition: - greater than or equal to: 1 - -recipient: "%(msg.agent)s"