forked from vieter-v/vieter
feat: add non-functional build timeout setting
This commit is contained in:
parent
8a76860363
commit
ac3a89500b
8 changed files with 34 additions and 21 deletions
|
|
@ -94,8 +94,8 @@ pub:
|
|||
}
|
||||
|
||||
// build_target builds the given target. Internally it calls `build_config`.
|
||||
pub fn build_target(address string, api_key string, base_image_id string, target &Target, force bool) !BuildResult {
|
||||
config := target.as_build_config(base_image_id, force)
|
||||
pub fn build_target(address string, api_key string, base_image_id string, target &Target, force bool, timeout int) !BuildResult {
|
||||
config := target.as_build_config(base_image_id, force, timeout)
|
||||
|
||||
return build_config(address, api_key, config)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ pub struct BuildJobQueue {
|
|||
default_schedule &cron.Expression
|
||||
// Base image to use for targets without defined base image
|
||||
default_base_image string
|
||||
// After how many minutes a build should be forcefully cancelled
|
||||
default_build_timeout int
|
||||
mut:
|
||||
mutex shared util.Dummy
|
||||
// For each architecture, a priority queue is tracked
|
||||
|
|
@ -44,10 +46,11 @@ mut:
|
|||
}
|
||||
|
||||
// new_job_queue initializes a new job queue
|
||||
pub fn new_job_queue(default_schedule &cron.Expression, default_base_image string) BuildJobQueue {
|
||||
pub fn new_job_queue(default_schedule &cron.Expression, default_base_image string, default_build_timeout int) BuildJobQueue {
|
||||
return BuildJobQueue{
|
||||
default_schedule: unsafe { default_schedule }
|
||||
default_base_image: default_base_image
|
||||
default_build_timeout: default_build_timeout
|
||||
invalidated: map[int]time.Time{}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +83,7 @@ pub fn (mut q BuildJobQueue) insert(input InsertConfig) ! {
|
|||
mut job := BuildJob{
|
||||
created: time.now()
|
||||
single: input.single
|
||||
config: input.target.as_build_config(q.default_base_image, input.force)
|
||||
config: input.target.as_build_config(q.default_base_image, input.force, q.default_build_timeout)
|
||||
}
|
||||
|
||||
if !input.now {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue