mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
expose lResult and lLastResult
This commit is contained in:
parent
a2701dcfd9
commit
2147346493
@ -425,6 +425,12 @@ void Laminar::assignNewJobs() {
|
|||||||
run->startedAt = time(0);
|
run->startedAt = time(0);
|
||||||
run->build = ++buildNums[run->name];
|
run->build = ++buildNums[run->name];
|
||||||
run->laminarHome = homeDir;
|
run->laminarHome = homeDir;
|
||||||
|
// set the last known result if exists
|
||||||
|
db->stmt("SELECT result FROM builds WHERE name = ? ORDER BY completedAt DESC LIMIT 1")
|
||||||
|
.bind(run->name)
|
||||||
|
.fetch<int>([=](int result){
|
||||||
|
run->lastResult = RunState(result);
|
||||||
|
});
|
||||||
|
|
||||||
fs::path wd = fs::path(homeDir)/"run"/run->name/std::to_string(run->build);
|
fs::path wd = fs::path(homeDir)/"run"/run->name/std::to_string(run->build);
|
||||||
if(!fs::is_directory(wd) && !fs::create_directory(wd)) {
|
if(!fs::is_directory(wd) && !fs::create_directory(wd)) {
|
||||||
|
@ -42,7 +42,7 @@ std::string to_string(const RunState& rs) {
|
|||||||
|
|
||||||
Run::Run() {
|
Run::Run() {
|
||||||
result = RunState::SUCCESS;
|
result = RunState::SUCCESS;
|
||||||
|
lastResult = RunState::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
Run::~Run() {
|
Run::~Run() {
|
||||||
@ -84,6 +84,8 @@ bool Run::step() {
|
|||||||
setenv("PATH", PATH.c_str(), true);
|
setenv("PATH", PATH.c_str(), true);
|
||||||
setenv("lBuildNum", buildNum.c_str(), true);
|
setenv("lBuildNum", buildNum.c_str(), true);
|
||||||
setenv("lJobName", name.c_str(), true);
|
setenv("lJobName", name.c_str(), true);
|
||||||
|
setenv("lResult", to_string(result).c_str(), true);
|
||||||
|
setenv("lLastResult", to_string(lastResult).c_str(), true);
|
||||||
setenv("lWorkspace", (fs::path(laminarHome)/"run"/name/"workspace").string().c_str(), true);
|
setenv("lWorkspace", (fs::path(laminarHome)/"run"/name/"workspace").string().c_str(), true);
|
||||||
for(auto& pair : params) {
|
for(auto& pair : params) {
|
||||||
setenv(pair.first.c_str(), pair.second.c_str(), false);
|
setenv(pair.first.c_str(), pair.second.c_str(), false);
|
||||||
|
@ -66,6 +66,7 @@ public:
|
|||||||
std::function<void(const Run*)> notifyCompletion;
|
std::function<void(const Run*)> notifyCompletion;
|
||||||
Node* node;
|
Node* node;
|
||||||
RunState result;
|
RunState result;
|
||||||
|
RunState lastResult;
|
||||||
std::string laminarHome;
|
std::string laminarHome;
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string wd;
|
std::string wd;
|
||||||
|
Loading…
Reference in New Issue
Block a user