forked from vieter-v/vieter
feat: allow queueing one-time builds
This commit is contained in:
parent
f6c5e7c246
commit
6a208dbe6c
3 changed files with 51 additions and 18 deletions
|
|
@ -19,3 +19,24 @@ fn (mut app App) v1_poll_job_queue() web.Result {
|
|||
|
||||
return app.json(.ok, new_data_response(out))
|
||||
}
|
||||
|
||||
['/api/v1/jobs/queue'; auth; post]
|
||||
fn (mut app App) v1_queue_job() web.Result {
|
||||
target_id := app.query['target'] or {
|
||||
return app.json(.bad_request, new_response('Missing target query arg.'))
|
||||
}.int()
|
||||
|
||||
arch := app.query['arch'] or {
|
||||
return app.json(.bad_request, new_response('Missing arch query arg.'))
|
||||
}
|
||||
|
||||
target := app.db.get_target(target_id) or {
|
||||
return app.json(.bad_request, new_response('Unknown target id.'))
|
||||
}
|
||||
|
||||
app.job_queue.insert(target: target, arch: arch, single: true) or {
|
||||
return app.status(.internal_server_error)
|
||||
}
|
||||
|
||||
return app.status(.ok)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ fn (mut app App) init_job_queue() ! {
|
|||
for targets.len > 0 {
|
||||
for target in targets {
|
||||
for arch in target.arch {
|
||||
app.job_queue.insert(target, arch.value)!
|
||||
app.job_queue.insert(target: target, arch: arch.value)!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue