WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021
  1. from .service import Service
  2. class Docker(Service):
  3. def __init__(self):
  4. super().__init__("docker")
  5. def accept_hook(self, identifier, request):
  6. for event in request.get_json()["events"]:
  7. if (
  8. event["action"] == "push"
  9. and "vnd.docker.distribution.manifest" in event["target"]["mediaType"]
  10. and "tag" in event["target"]
  11. ):
  12. yield {
  13. "type": "docker.push",
  14. "repo": event["target"]["repository"],
  15. "tag": event["target"]["tag"],
  16. "host": event["request"]["host"],
  17. "user": event["actor"]["name"],
  18. }