Include datetime from webhook
authorTom Powell <tom@powell.io>
Mon, 29 Oct 2018 03:11:54 +0000 (20:11 -0700)
committerTom Powell <tom@powell.io>
Mon, 29 Oct 2018 03:11:54 +0000 (20:11 -0700)
ui/gitlab/webhooks.py

index 13e3b3f018f3896770481c7368e12a5814b40074..8e26ccdf7d43ac6205044e26217b3ff2a6cefcfb 100644 (file)
@@ -1,3 +1,5 @@
+import datetime
+
 from flask import abort
 
 from ui import config
@@ -32,6 +34,8 @@ def process(request):
             build.build_runner = Runner.get_or_create_by_id(runner.get('id'))
             if not build.build_runner.runner_name:
                 build.build_runner.runner_name = runner.get("description")
+        date = datetime.datetime.strptime(build_stage.get("created_at"), "%Y-%m-%d %H:%M:%S UTC")
+        build.build_date = date
         db.session.add(build)
         db.session.commit()
         if build.build_status in ['failed', 'canceled']: