WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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. }