From da2e3bb89a467c04fc15c26b2521f38d312624b9 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 13 Jul 2018 21:44:07 +0200 Subject: [PATCH] [enh] continue working on api to create a new job --- models.py | 2 +- run.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/models.py b/models.py index ad654e4..f0cbf8c 100644 --- a/models.py +++ b/models.py @@ -24,7 +24,7 @@ class Job(peewee.Model): ('runnning', 'Running'), ('done', 'Done'), ('failure', 'Failure'), - )) + ), default="scheduled") created_time = peewee.DateTimeField(constraints=[peewee.SQL("DEFAULT (datetime('now'))")]) started_time = peewee.DateTimeField(null=True) diff --git a/run.py b/run.py index 733a8d4..1bc6f5c 100644 --- a/run.py +++ b/run.py @@ -185,14 +185,17 @@ async def api_new_job(request): # day for the montly test? # ? analyseCI path ? - Job.create( + job = Job.create( name=request.json["name"], - url_or_path=request.json["url"], + url_or_path=request.json["url_or_path"], + target_revision=request.json["revision"], type=request.json.get("test_type", "stable"), yunohost_version=request.json.get("yunohost_version", "unstable"), debian_version=request.json.get("debian_version", "stretch"), ) + print(f"Request to add new job '{job.name}' {job}") + return response.text("ok")