Skip to content

Instantly share code, notes, and snippets.

@ralphbean
Last active December 16, 2015 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralphbean/5443891 to your computer and use it in GitHub Desktop.
Save ralphbean/5443891 to your computer and use it in GitHub Desktop.
First thoughts on a domain-specific-language (DSL) for defining Fedora open badges a la https://fedoraproject.org/wiki/Open_Badges
%YAML 1.2
---
# This is some metadata about the badge
name: The Zen of Foo Bar Baz
description: Your packaging efforts refer to a meta-syntactic variable.
creator: ralph
# This is a link to the discussion about adopting this as a for-real badge.
discussion: http://github.com/fedora-infra/badges/pull/SOME_NUMBER
# Here we'll run our check if the message that we receive is in either the
# 'bodhi' or the 'git' categories.
trigger:
category:
any:
- bodhi
- git
# Once the check has been triggered, this defines what we actually check.
# Here we check datanommer for all messages which
# belong to the user of the message we just received.
# have the same topic as that message
# and which have ANY of the strings 'foo', 'bar', 'baz' anywhere in the body.
# If there are at least one of those message in the db, then aware the badge.
criteria:
datanommer:
- filter:
all:
topic: "{{topic}}"
raw_contains:
any:
- foo
- bar
- baz
operation: count
must be:
greater than or equal to: 1
%YAML 1.2
---
# This is some metadata about the badge
name: Like a Rock
description: You have pushed 500 or more bodhi updates to stable status.
creator: ralph
# This is a link to the discussion about adopting this as a for-real badge.
discussion: http://github.com/fedora-infra/badges/pull/SOME_NUMBER
# We'll perform our more costly check (defined below) only when
# we receive messages that match this 'trigger'
trigger:
topic: org.fedoraproject.prod.bodhi.update.request.stable
# Once the check has been triggered, this defines what we actually check.
criteria:
datanommer:
- filter:
topic: "{{topic}}" # The topic of the message that triggered us.
operation: count
must be:
greater than or equal to: 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment