Browse Source

Send messages about docker pushes

master
Chris Smith 6 years ago
parent
commit
c7edae6059
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      main.py

+ 14
- 1
main.py View File

@@ -129,7 +129,20 @@ def handle_docker_registry(hash):
129 129
         app.logger.info(f"Hash mismatch: expected {expected_hash}")
130 130
         abort(403)
131 131
 
132
-    app.logger.warn(f"Docker hub json: {request.get_json()}")
132
+    for event in request.get_json()["events"]:
133
+        if (
134
+            event["action"] == "push"
135
+            and "vnd.docker.distribution.manifest" in event["target"]["mediaType"]
136
+            and "tag" in event["target"]
137
+        ):
138
+            repo = event["target"]["repository"]
139
+            tag = event["target"]["tag"]
140
+            host = event["request"]["host"]
141
+            user = event["actor"]["name"]
142
+            reportbot_announce(
143
+                f"\002[registry]\002 New manifest pushed to {host}/{repo}:{tag} by {user}"
144
+            )
145
+
133 146
     return "", 204
134 147
 
135 148
 

Loading…
Cancel
Save