Add support for build_timeout_seconds
This commit is contained in:
parent
1323890e07
commit
47f3bf00ff
|
@ -16,7 +16,6 @@ use ofborg::config;
|
||||||
use ofborg::checkout;
|
use ofborg::checkout;
|
||||||
use ofborg::worker;
|
use ofborg::worker;
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
use ofborg::nix;
|
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -48,7 +47,7 @@ fn main() {
|
||||||
let mut channel = session.open_channel(2).unwrap();
|
let mut channel = session.open_channel(2).unwrap();
|
||||||
|
|
||||||
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
|
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
|
||||||
let nix = nix::new(cfg.nix.system.clone(), cfg.nix.remote.clone());
|
let nix = cfg.nix();
|
||||||
|
|
||||||
channel.basic_consume(
|
channel.basic_consume(
|
||||||
worker::new(tasks::build::BuildWorker::new(cloner, nix, cfg.nix.system.clone())),
|
worker::new(tasks::build::BuildWorker::new(cloner, nix, cfg.nix.system.clone())),
|
||||||
|
|
|
@ -10,7 +10,6 @@ use std::path::Path;
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::checkout;
|
use ofborg::checkout;
|
||||||
use ofborg::nix;
|
|
||||||
|
|
||||||
use ofborg::worker;
|
use ofborg::worker;
|
||||||
use amqp::Session;
|
use amqp::Session;
|
||||||
|
@ -46,7 +45,7 @@ fn main() {
|
||||||
let mut channel = session.open_channel(2).unwrap();
|
let mut channel = session.open_channel(2).unwrap();
|
||||||
|
|
||||||
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
|
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
|
||||||
let nix = nix::new(cfg.nix.system.clone(), cfg.nix.remote.clone());
|
let nix = cfg.nix();
|
||||||
|
|
||||||
|
|
||||||
let mrw = tasks::massrebuilder::MassRebuildWorker::new(
|
let mrw = tasks::massrebuilder::MassRebuildWorker::new(
|
||||||
|
|
|
@ -6,7 +6,7 @@ use hyper::Client;
|
||||||
use hyper::net::HttpsConnector;
|
use hyper::net::HttpsConnector;
|
||||||
use hyper_native_tls::NativeTlsClient;
|
use hyper_native_tls::NativeTlsClient;
|
||||||
use hubcaps::{Credentials, Github};
|
use hubcaps::{Credentials, Github};
|
||||||
|
use nix::Nix;
|
||||||
|
|
||||||
|
|
||||||
use ofborg::acl;
|
use ofborg::acl;
|
||||||
|
@ -32,6 +32,7 @@ pub struct RabbitMQConfig {
|
||||||
pub struct NixConfig {
|
pub struct NixConfig {
|
||||||
pub system: String,
|
pub system: String,
|
||||||
pub remote: String,
|
pub remote: String,
|
||||||
|
pub build_timeout_seconds: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +77,21 @@ impl Config {
|
||||||
Credentials::Token(self.github.clone().unwrap().token)
|
Credentials::Token(self.github.clone().unwrap().token)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn nix(&self) -> Nix {
|
||||||
|
if self.nix.build_timeout_seconds < 1200 {
|
||||||
|
error!("Note: {} is way too low for build_timeout_seconds!",
|
||||||
|
self.nix.build_timeout_seconds
|
||||||
|
);
|
||||||
|
error!("Please set build_timeout_seconds to at least 1200");
|
||||||
|
panic!();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Nix::new(self.nix.system.clone(),
|
||||||
|
self.nix.remote.clone(),
|
||||||
|
self.nix.build_timeout_seconds
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,21 +9,24 @@ use std::io::SeekFrom;
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct Nix {
|
pub struct Nix {
|
||||||
system: String,
|
system: String,
|
||||||
remote: String
|
remote: String,
|
||||||
}
|
build_timeout: u16
|
||||||
|
|
||||||
pub fn new(system: String, remote: String) -> Nix {
|
|
||||||
return Nix{
|
|
||||||
system: system,
|
|
||||||
remote: remote,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Nix {
|
impl Nix {
|
||||||
|
pub fn new(system: String, remote: String, build_timeout: u16) -> Nix {
|
||||||
|
return Nix{
|
||||||
|
system: system,
|
||||||
|
remote: remote,
|
||||||
|
build_timeout: build_timeout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn with_system(&self, system: String) -> Nix {
|
pub fn with_system(&self, system: String) -> Nix {
|
||||||
return Nix{
|
return Nix{
|
||||||
system: system,
|
system: system,
|
||||||
remote: self.remote.clone(),
|
remote: self.remote.clone(),
|
||||||
|
build_timeout: self.build_timeout,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +61,7 @@ impl Nix {
|
||||||
.env("NIX_PATH", nixpath)
|
.env("NIX_PATH", nixpath)
|
||||||
.env("NIX_REMOTE", &self.remote)
|
.env("NIX_REMOTE", &self.remote)
|
||||||
.args(&["--option", "restrict-eval", "true"])
|
.args(&["--option", "restrict-eval", "true"])
|
||||||
|
.args(&["--option", "build-timeout", &format!("{}", self.build_timeout)])
|
||||||
.args(&["--argstr", "system", &self.system])
|
.args(&["--argstr", "system", &self.system])
|
||||||
.args(args)
|
.args(args)
|
||||||
.status()
|
.status()
|
||||||
|
|
Loading…
Reference in a new issue