mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[enh] continue working on api to create a new job
This commit is contained in:
parent
39da3d9f51
commit
da2e3bb89a
2 changed files with 6 additions and 3 deletions
|
@ -24,7 +24,7 @@ class Job(peewee.Model):
|
||||||
('runnning', 'Running'),
|
('runnning', 'Running'),
|
||||||
('done', 'Done'),
|
('done', 'Done'),
|
||||||
('failure', 'Failure'),
|
('failure', 'Failure'),
|
||||||
))
|
), default="scheduled")
|
||||||
|
|
||||||
created_time = peewee.DateTimeField(constraints=[peewee.SQL("DEFAULT (datetime('now'))")])
|
created_time = peewee.DateTimeField(constraints=[peewee.SQL("DEFAULT (datetime('now'))")])
|
||||||
started_time = peewee.DateTimeField(null=True)
|
started_time = peewee.DateTimeField(null=True)
|
||||||
|
|
7
run.py
7
run.py
|
@ -185,14 +185,17 @@ async def api_new_job(request):
|
||||||
# day for the montly test?
|
# day for the montly test?
|
||||||
# ? analyseCI path ?
|
# ? analyseCI path ?
|
||||||
|
|
||||||
Job.create(
|
job = Job.create(
|
||||||
name=request.json["name"],
|
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"),
|
type=request.json.get("test_type", "stable"),
|
||||||
yunohost_version=request.json.get("yunohost_version", "unstable"),
|
yunohost_version=request.json.get("yunohost_version", "unstable"),
|
||||||
debian_version=request.json.get("debian_version", "stretch"),
|
debian_version=request.json.get("debian_version", "stretch"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(f"Request to add new job '{job.name}' {job}")
|
||||||
|
|
||||||
return response.text("ok")
|
return response.text("ok")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue