mirror of
https://github.com/ohwgiles/laminar.git
synced 2025-06-13 12:54:29 +00:00
Musl libc type fix
This commit is contained in:
parent
448d8cfa48
commit
deb905b36d
@ -67,7 +67,7 @@ static int setParams(int argc, char** argv, T& request) {
|
||||
return argsConsumed;
|
||||
}
|
||||
|
||||
static void printTriggerLink(const char* job, uint run) {
|
||||
static void printTriggerLink(const char* job, uint32_t run) {
|
||||
// use a private ANSI CSI sequence to mark the JOB:NUM so the
|
||||
// frontend can recognise it and generate a hyperlink.
|
||||
printf("\033[{%s:%d\033\\\n", job, run);
|
||||
|
@ -81,7 +81,7 @@ void Database::Statement::bindValue(int i, int e) {
|
||||
sqlite3_bind_int(stmt, i, e);
|
||||
}
|
||||
|
||||
void Database::Statement::bindValue(int i, uint e) {
|
||||
void Database::Statement::bindValue(int i, uint32_t e) {
|
||||
sqlite3_bind_int(stmt, i, static_cast<int32_t>(e));
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ void Database::Statement::bindValue(int i, long e) {
|
||||
sqlite3_bind_int64(stmt, i, e);
|
||||
}
|
||||
|
||||
void Database::Statement::bindValue(int i, ulong e) {
|
||||
void Database::Statement::bindValue(int i, unsigned long e) {
|
||||
sqlite3_bind_int64(stmt, i, static_cast<int64_t>(e));
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ void Database::Statement::bindValue(int i, const std::string& e) {
|
||||
}
|
||||
|
||||
template<> std::string Database::Statement::fetchColumn(int col) {
|
||||
uint sz = static_cast<uint>(sqlite3_column_bytes(stmt, col)); // according to documentation will never be negative
|
||||
uint32_t sz = static_cast<uint32_t>(sqlite3_column_bytes(stmt, col)); // according to documentation will never be negative
|
||||
std::string res(sz, '\0');
|
||||
memcpy(&res[0], sqlite3_column_text(stmt, col), sz);
|
||||
return res;
|
||||
@ -117,16 +117,16 @@ template<> int Database::Statement::fetchColumn(int col) {
|
||||
return sqlite3_column_int(stmt, col);
|
||||
}
|
||||
|
||||
template<> uint Database::Statement::fetchColumn(int col) {
|
||||
return static_cast<uint>(sqlite3_column_int(stmt, col));
|
||||
template<> uint32_t Database::Statement::fetchColumn(int col) {
|
||||
return static_cast<uint32_t>(sqlite3_column_int(stmt, col));
|
||||
}
|
||||
|
||||
template<> long Database::Statement::fetchColumn(int col) {
|
||||
return static_cast<long>(sqlite3_column_int64(stmt, col));
|
||||
}
|
||||
|
||||
template<> ulong Database::Statement::fetchColumn(int col) {
|
||||
return static_cast<ulong>(sqlite3_column_int64(stmt, col));
|
||||
template<> unsigned long Database::Statement::fetchColumn(int col) {
|
||||
return static_cast<unsigned long>(sqlite3_column_int64(stmt, col));
|
||||
}
|
||||
|
||||
template<> double Database::Statement::fetchColumn(int col) {
|
||||
|
@ -119,7 +119,7 @@ private:
|
||||
|
||||
// Bind value specializations
|
||||
void bindValue(int i, int e);
|
||||
void bindValue(int i, uint e);
|
||||
void bindValue(int i, uint32_t e);
|
||||
void bindValue(int i, long e);
|
||||
void bindValue(int i, unsigned long e);
|
||||
void bindValue(int i, const char* e);
|
||||
@ -148,9 +148,9 @@ private:
|
||||
template<> std::string Database::Statement::fetchColumn(int col);
|
||||
template<> const char* Database::Statement::fetchColumn(int col);
|
||||
template<> int Database::Statement::fetchColumn(int col);
|
||||
template<> uint Database::Statement::fetchColumn(int col);
|
||||
template<> uint32_t Database::Statement::fetchColumn(int col);
|
||||
template<> long Database::Statement::fetchColumn(int col);
|
||||
template<> ulong Database::Statement::fetchColumn(int col);
|
||||
template<> unsigned long Database::Statement::fetchColumn(int col);
|
||||
template<> double Database::Statement::fetchColumn(int col);
|
||||
|
||||
#endif // LAMINAR_DATABASE_H_
|
||||
|
@ -37,7 +37,7 @@ struct MonitorScope {
|
||||
LOG // a run's log page
|
||||
};
|
||||
|
||||
MonitorScope(Type type = HOME, std::string job = std::string(), uint num = 0) :
|
||||
MonitorScope(Type type = HOME, std::string job = std::string(), uint32_t num = 0) :
|
||||
type(type),
|
||||
job(job),
|
||||
num(num),
|
||||
@ -47,22 +47,22 @@ struct MonitorScope {
|
||||
{}
|
||||
|
||||
// whether this scope wants status information about the given job or run
|
||||
bool wantsStatus(std::string ajob, uint anum = 0) const {
|
||||
bool wantsStatus(std::string ajob, uint32_t anum = 0) const {
|
||||
if(type == HOME || type == ALL) return true;
|
||||
if(type == JOB) return ajob == job;
|
||||
if(type == RUN) return ajob == job && anum == num;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wantsLog(std::string ajob, uint anum) const {
|
||||
bool wantsLog(std::string ajob, uint32_t anum) const {
|
||||
return type == LOG && ajob == job && anum == num;
|
||||
}
|
||||
|
||||
Type type;
|
||||
std::string job;
|
||||
uint num = 0;
|
||||
uint32_t num = 0;
|
||||
// sorting
|
||||
uint page = 0;
|
||||
uint32_t page = 0;
|
||||
std::string field;
|
||||
bool order_desc;
|
||||
};
|
||||
@ -121,11 +121,11 @@ struct LaminarInterface {
|
||||
virtual void deregisterWaiter(LaminarWaiter* waiter) = 0;
|
||||
|
||||
// Return the latest known number of the named job
|
||||
virtual uint latestRun(std::string job) = 0;
|
||||
virtual uint32_t latestRun(std::string job) = 0;
|
||||
|
||||
// Given a job name and number, return existence and (via reference params)
|
||||
// its current log output and whether the job is ongoing
|
||||
virtual bool handleLogRequest(std::string name, uint num, std::string& output, bool& complete) = 0;
|
||||
virtual bool handleLogRequest(std::string name, uint32_t num, std::string& output, bool& complete) = 0;
|
||||
|
||||
// Synchronously send a snapshot of the current status to the given
|
||||
// client (as governed by the client's MonitorScope). This is called on
|
||||
@ -135,7 +135,7 @@ struct LaminarInterface {
|
||||
// Implements the laminar client interface allowing the setting of
|
||||
// arbitrary parameters on a run (usually itself) to be available in
|
||||
// the environment of subsequent scripts.
|
||||
virtual bool setParam(std::string job, uint buildNum, std::string param, std::string value) = 0;
|
||||
virtual bool setParam(std::string job, uint32_t buildNum, std::string param, std::string value) = 0;
|
||||
|
||||
// Gets the list of jobs currently waiting in the execution queue
|
||||
virtual const std::list<std::shared_ptr<Run>>& listQueuedJobs() = 0;
|
||||
@ -162,7 +162,7 @@ struct LaminarInterface {
|
||||
virtual std::string getCustomCss() = 0;
|
||||
|
||||
// Aborts a single job
|
||||
virtual bool abort(std::string job, uint buildNum) = 0;
|
||||
virtual bool abort(std::string job, uint32_t buildNum) = 0;
|
||||
|
||||
// Abort all running jobs
|
||||
virtual void abortAll() = 0;
|
||||
|
@ -99,7 +99,7 @@ Laminar::Laminar(const char *home) :
|
||||
|
||||
// retrieve the last build numbers
|
||||
db->stmt("SELECT name, MAX(number) FROM builds GROUP BY name")
|
||||
.fetch<str,uint>([this](str name, uint build){
|
||||
.fetch<str,uint32_t>([this](str name, uint32_t build){
|
||||
buildNums[name] = build;
|
||||
});
|
||||
|
||||
@ -126,13 +126,13 @@ void Laminar::deregisterWaiter(LaminarWaiter *waiter) {
|
||||
waiters.erase(waiter);
|
||||
}
|
||||
|
||||
uint Laminar::latestRun(std::string job) {
|
||||
uint32_t Laminar::latestRun(std::string job) {
|
||||
auto it = activeJobs.byJobName().equal_range(job);
|
||||
if(it.first == it.second) {
|
||||
uint result = 0;
|
||||
uint32_t result = 0;
|
||||
db->stmt("SELECT MAX(number) FROM builds WHERE name = ?")
|
||||
.bind(job)
|
||||
.fetch<uint>([&](uint x){
|
||||
.fetch<uint32_t>([&](uint32_t x){
|
||||
result = x;
|
||||
});
|
||||
return result;
|
||||
@ -143,7 +143,7 @@ uint Laminar::latestRun(std::string job) {
|
||||
|
||||
// TODO: reunify with sendStatus. The difference is that this method is capable of
|
||||
// returning "not found" to the caller, and sendStatus isn't
|
||||
bool Laminar::handleLogRequest(std::string name, uint num, std::string& output, bool& complete) {
|
||||
bool Laminar::handleLogRequest(std::string name, uint32_t num, std::string& output, bool& complete) {
|
||||
if(Run* run = activeRun(name, num)) {
|
||||
output = run->log;
|
||||
complete = false;
|
||||
@ -172,7 +172,7 @@ bool Laminar::handleLogRequest(std::string name, uint num, std::string& output,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Laminar::setParam(std::string job, uint buildNum, std::string param, std::string value) {
|
||||
bool Laminar::setParam(std::string job, uint32_t buildNum, std::string param, std::string value) {
|
||||
if(Run* run = activeRun(job, buildNum)) {
|
||||
run->params[param] = value;
|
||||
return true;
|
||||
@ -200,7 +200,7 @@ std::list<std::string> Laminar::listKnownJobs() {
|
||||
return res;
|
||||
}
|
||||
|
||||
void Laminar::populateArtifacts(Json &j, std::string job, uint num) const {
|
||||
void Laminar::populateArtifacts(Json &j, std::string job, uint32_t num) const {
|
||||
kj::Path runArchive{job,std::to_string(num)};
|
||||
KJ_IF_MAYBE(dir, fsHome->tryOpenSubdir("archive"/runArchive)) {
|
||||
for(kj::StringPtr file : (*dir)->listNames()) {
|
||||
@ -250,7 +250,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
if(client->scope.type == MonitorScope::RUN) {
|
||||
db->stmt("SELECT queuedAt,startedAt,completedAt,result,reason,parentJob,parentBuild FROM builds WHERE name = ? AND number = ?")
|
||||
.bind(client->scope.job, client->scope.num)
|
||||
.fetch<time_t, time_t, time_t, int, std::string, std::string, uint>([&](time_t queued, time_t started, time_t completed, int result, std::string reason, std::string parentJob, uint parentBuild) {
|
||||
.fetch<time_t, time_t, time_t, int, std::string, std::string, uint32_t>([&](time_t queued, time_t started, time_t completed, int result, std::string reason, std::string parentJob, uint32_t parentBuild) {
|
||||
j.set("queued", started-queued);
|
||||
j.set("started", started);
|
||||
j.set("completed", completed);
|
||||
@ -266,7 +266,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.startObject("upstream").set("name", run->parentName).set("num", run->parentBuild).EndObject(2);
|
||||
db->stmt("SELECT completedAt - startedAt FROM builds WHERE name = ? ORDER BY completedAt DESC LIMIT 1")
|
||||
.bind(run->name)
|
||||
.fetch<uint>([&](uint lastRuntime){
|
||||
.fetch<uint32_t>([&](uint32_t lastRuntime){
|
||||
j.set("etc", run->startedAt + lastRuntime);
|
||||
});
|
||||
}
|
||||
@ -275,7 +275,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
populateArtifacts(j, client->scope.job, client->scope.num);
|
||||
j.EndArray();
|
||||
} else if(client->scope.type == MonitorScope::JOB) {
|
||||
const uint runsPerPage = 10;
|
||||
const uint32_t runsPerPage = 10;
|
||||
j.startArray("recent");
|
||||
// ORDER BY param cannot be bound
|
||||
std::string order_by;
|
||||
@ -294,7 +294,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
+ order_by + " LIMIT ?,?";
|
||||
db->stmt(stmt.c_str())
|
||||
.bind(client->scope.job, client->scope.page * runsPerPage, runsPerPage)
|
||||
.fetch<uint,time_t,time_t,int,str>([&](uint build,time_t started,time_t completed,int result,str reason){
|
||||
.fetch<uint32_t,time_t,time_t,int,str>([&](uint32_t build,time_t started,time_t completed,int result,str reason){
|
||||
j.StartObject();
|
||||
j.set("number", build)
|
||||
.set("completed", completed)
|
||||
@ -306,7 +306,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.EndArray();
|
||||
db->stmt("SELECT COUNT(*),AVG(completedAt-startedAt) FROM builds WHERE name = ?")
|
||||
.bind(client->scope.job)
|
||||
.fetch<uint,uint>([&](uint nRuns, uint averageRuntime){
|
||||
.fetch<uint32_t,uint32_t>([&](uint32_t nRuns, uint32_t averageRuntime){
|
||||
j.set("averageRuntime", averageRuntime);
|
||||
j.set("pages", (nRuns-1) / runsPerPage + 1);
|
||||
j.startObject("sort");
|
||||
@ -353,7 +353,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
} else if(client->scope.type == MonitorScope::ALL) {
|
||||
j.startArray("jobs");
|
||||
db->stmt("SELECT name,number,startedAt,completedAt,result FROM builds b JOIN (SELECT name n,MAX(number) l FROM builds GROUP BY n) q ON b.name = q.n AND b.number = q.l")
|
||||
.fetch<str,uint,time_t,time_t,int>([&](str name,uint number, time_t started, time_t completed, int result){
|
||||
.fetch<str,uint32_t,time_t,time_t,int>([&](str name,uint32_t number, time_t started, time_t completed, int result){
|
||||
j.StartObject();
|
||||
j.set("name", name);
|
||||
j.set("number", number);
|
||||
@ -386,7 +386,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
} else { // Home page
|
||||
j.startArray("recent");
|
||||
db->stmt("SELECT * FROM builds ORDER BY completedAt DESC LIMIT 15")
|
||||
.fetch<str,uint,str,time_t,time_t,time_t,int>([&](str name,uint build,str node,time_t,time_t started,time_t completed,int result){
|
||||
.fetch<str,uint32_t,str,time_t,time_t,time_t,int>([&](str name,uint32_t build,str node,time_t,time_t started,time_t completed,int result){
|
||||
j.StartObject();
|
||||
j.set("name", name)
|
||||
.set("number", build)
|
||||
@ -406,7 +406,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.set("started", run->startedAt);
|
||||
db->stmt("SELECT completedAt - startedAt FROM builds WHERE name = ? ORDER BY completedAt DESC LIMIT 1")
|
||||
.bind(run->name)
|
||||
.fetch<uint>([&](uint lastRuntime){
|
||||
.fetch<uint32_t>([&](uint32_t lastRuntime){
|
||||
j.set("etc", run->startedAt + lastRuntime);
|
||||
});
|
||||
j.EndObject();
|
||||
@ -449,14 +449,14 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.startObject("timePerJob");
|
||||
db->stmt("SELECT name, AVG(completedAt-startedAt) av FROM builds WHERE completedAt > ? GROUP BY name ORDER BY av DESC LIMIT 8")
|
||||
.bind(time(nullptr) - 7 * 86400)
|
||||
.fetch<str, uint>([&](str job, uint time){
|
||||
.fetch<str, uint32_t>([&](str job, uint32_t time){
|
||||
j.set(job.c_str(), time);
|
||||
});
|
||||
j.EndObject();
|
||||
j.startArray("resultChanged");
|
||||
db->stmt("SELECT b.name,MAX(b.number) as lastSuccess,lastFailure FROM builds AS b JOIN (SELECT name,MAX(number) AS lastFailure FROM builds WHERE result<>? GROUP BY name) AS t ON t.name=b.name WHERE b.result=? GROUP BY b.name ORDER BY lastSuccess>lastFailure, lastFailure-lastSuccess DESC LIMIT 8")
|
||||
.bind(int(RunState::SUCCESS), int(RunState::SUCCESS))
|
||||
.fetch<str, uint, uint>([&](str job, uint lastSuccess, uint lastFailure){
|
||||
.fetch<str, uint32_t, uint32_t>([&](str job, uint32_t lastSuccess, uint32_t lastFailure){
|
||||
j.StartObject();
|
||||
j.set("name", job)
|
||||
.set("lastSuccess", lastSuccess)
|
||||
@ -498,7 +498,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
"COUNT(CASE WHEN a >= 1200 AND a < 2400 THEN 1 END),"
|
||||
"COUNT(CASE WHEN a >= 2400 AND a < 3600 THEN 1 END),"
|
||||
"COUNT(CASE WHEN a >= 3600 THEN 1 END) FROM ba")
|
||||
.fetch<uint,uint,uint,uint,uint,uint,uint,uint>([&](uint c1, uint c2, uint c3, uint c4, uint c5, uint c6, uint c7, uint c8){
|
||||
.fetch<uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t,uint32_t>([&](uint32_t c1, uint32_t c2, uint32_t c3, uint32_t c4, uint32_t c5, uint32_t c6, uint32_t c7, uint32_t c8){
|
||||
j.Int(c1);
|
||||
j.Int(c2);
|
||||
j.Int(c3);
|
||||
@ -539,7 +539,7 @@ void Laminar::stop() {
|
||||
|
||||
bool Laminar::loadConfiguration() {
|
||||
if(const char* ndirs = getenv("LAMINAR_KEEP_RUNDIRS"))
|
||||
numKeepRunDirs = static_cast<uint>(atoi(ndirs));
|
||||
numKeepRunDirs = static_cast<uint32_t>(atoi(ndirs));
|
||||
|
||||
std::set<std::string> knownNodes;
|
||||
|
||||
@ -645,7 +645,7 @@ void Laminar::notifyConfigChanged()
|
||||
assignNewJobs();
|
||||
}
|
||||
|
||||
bool Laminar::abort(std::string job, uint buildNum) {
|
||||
bool Laminar::abort(std::string job, uint32_t buildNum) {
|
||||
if(Run* run = activeRun(job, buildNum)) {
|
||||
run->abort(true);
|
||||
return true;
|
||||
@ -722,7 +722,7 @@ bool Laminar::tryStartRun(std::shared_ptr<Run> run, int queueIndex) {
|
||||
.set("reason", run->reason());
|
||||
db->stmt("SELECT completedAt - startedAt FROM builds WHERE name = ? ORDER BY completedAt DESC LIMIT 1")
|
||||
.bind(run->name)
|
||||
.fetch<uint>([&](uint etc){
|
||||
.fetch<uint32_t>([&](uint32_t etc){
|
||||
j.set("etc", time(nullptr) + etc);
|
||||
});
|
||||
j.startArray("tags");
|
||||
@ -858,7 +858,7 @@ void Laminar::runFinished(Run * r) {
|
||||
// known build number of this job, which may not be that of the run that
|
||||
// finished here.
|
||||
auto it = activeJobs.byJobName().equal_range(r->name);
|
||||
uint oldestActive = (it.first == it.second)? buildNums[r->name] : (*it.first)->build - 1;
|
||||
uint32_t oldestActive = (it.first == it.second)? buildNums[r->name] : (*it.first)->build - 1;
|
||||
for(int i = static_cast<int>(oldestActive - numKeepRunDirs); i > 0; i--) {
|
||||
kj::Path d{"run",r->name,std::to_string(i)};
|
||||
// Once the directory does not exist, it's probably not worth checking
|
||||
|
@ -53,18 +53,18 @@ public:
|
||||
void deregisterClient(LaminarClient* client) override;
|
||||
void registerWaiter(LaminarWaiter* waiter) override;
|
||||
void deregisterWaiter(LaminarWaiter* waiter) override;
|
||||
uint latestRun(std::string job) override;
|
||||
bool handleLogRequest(std::string name, uint num, std::string& output, bool& complete) override;
|
||||
uint32_t latestRun(std::string job) override;
|
||||
bool handleLogRequest(std::string name, uint32_t num, std::string& output, bool& complete) override;
|
||||
|
||||
void sendStatus(LaminarClient* client) override;
|
||||
bool setParam(std::string job, uint buildNum, std::string param, std::string value) override;
|
||||
bool setParam(std::string job, uint32_t buildNum, std::string param, std::string value) override;
|
||||
const std::list<std::shared_ptr<Run>>& listQueuedJobs() override;
|
||||
const RunSet& listRunningJobs() override;
|
||||
std::list<std::string> listKnownJobs() override;
|
||||
kj::Maybe<kj::Own<const kj::ReadableFile>> getArtefact(std::string path) override;
|
||||
bool handleBadgeRequest(std::string job, std::string& badge) override;
|
||||
std::string getCustomCss() override;
|
||||
bool abort(std::string job, uint buildNum) override;
|
||||
bool abort(std::string job, uint32_t buildNum) override;
|
||||
void abortAll() override;
|
||||
void notifyConfigChanged() override;
|
||||
|
||||
@ -76,16 +76,16 @@ private:
|
||||
void runFinished(Run*);
|
||||
bool nodeCanQueue(const Node&, std::string jobName) const;
|
||||
// expects that Json has started an array
|
||||
void populateArtifacts(Json& out, std::string job, uint num) const;
|
||||
void populateArtifacts(Json& out, std::string job, uint32_t num) const;
|
||||
|
||||
Run* activeRun(const std::string name, uint num) {
|
||||
Run* activeRun(const std::string name, uint32_t num) {
|
||||
auto it = activeJobs.byNameNumber().find(boost::make_tuple(name, num));
|
||||
return it == activeJobs.byNameNumber().end() ? nullptr : it->get();
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<Run>> queuedJobs;
|
||||
|
||||
std::unordered_map<std::string, uint> buildNums;
|
||||
std::unordered_map<std::string, uint32_t> buildNums;
|
||||
|
||||
std::unordered_map<std::string, std::set<std::string>> jobTags;
|
||||
|
||||
@ -97,7 +97,7 @@ private:
|
||||
kj::Own<const kj::Directory> fsHome;
|
||||
std::set<LaminarClient*> clients;
|
||||
std::set<LaminarWaiter*> waiters;
|
||||
uint numKeepRunDirs;
|
||||
uint32_t numKeepRunDirs;
|
||||
std::string archiveUrl;
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ Run::~Run() {
|
||||
LLOG(INFO, "Run destroyed");
|
||||
}
|
||||
|
||||
bool Run::configure(uint buildNum, std::shared_ptr<Node> nd, const kj::Directory& fsHome)
|
||||
bool Run::configure(uint32_t buildNum, std::shared_ptr<Node> nd, const kj::Directory& fsHome)
|
||||
{
|
||||
kj::Path cfgDir{"cfg"};
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
Run& operator=(const Run&) = delete;
|
||||
|
||||
// Call this to "start" the run with a specific number and node
|
||||
bool configure(uint buildNum, std::shared_ptr<Node> node, const kj::Directory &fsHome);
|
||||
bool configure(uint32_t buildNum, std::shared_ptr<Node> node, const kj::Directory &fsHome);
|
||||
|
||||
// executes the next script (if any), returning true if there is nothing
|
||||
// more to be done.
|
||||
@ -78,7 +78,7 @@ public:
|
||||
std::string name;
|
||||
std::string parentName;
|
||||
int parentBuild = 0;
|
||||
uint build = 0;
|
||||
uint32_t build = 0;
|
||||
std::string log;
|
||||
kj::Maybe<pid_t> current_pid;
|
||||
int output_fd;
|
||||
@ -135,7 +135,7 @@ struct _run_index : bmi::indexed_by<
|
||||
std::shared_ptr<Run>,
|
||||
// a combination of their job name and build number
|
||||
bmi::member<Run, std::string, &Run::name>,
|
||||
bmi::member<Run, uint, &Run::build>
|
||||
bmi::member<Run, uint32_t, &Run::build>
|
||||
>>,
|
||||
// or a pointer to a Run object.
|
||||
bmi::hashed_unique<_run_same>,
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
// Set a parameter on a running build
|
||||
kj::Promise<void> set(SetContext context) override {
|
||||
std::string jobName = context.getParams().getRun().getJob();
|
||||
uint buildNum = context.getParams().getRun().getBuildNum();
|
||||
uint32_t buildNum = context.getParams().getRun().getBuildNum();
|
||||
LLOG(INFO, "RPC set", jobName, buildNum);
|
||||
|
||||
LaminarCi::MethodResult result = laminar.setParam(jobName, buildNum,
|
||||
@ -166,7 +166,7 @@ public:
|
||||
|
||||
kj::Promise<void> abort(AbortContext context) override {
|
||||
std::string jobName = context.getParams().getRun().getJob();
|
||||
uint buildNum = context.getParams().getRun().getBuildNum();
|
||||
uint32_t buildNum = context.getParams().getRun().getBuildNum();
|
||||
LLOG(INFO, "RPC abort", jobName, buildNum);
|
||||
LaminarCi::MethodResult result = laminar.abort(jobName, buildNum)
|
||||
? LaminarCi::MethodResult::SUCCESS
|
||||
@ -327,7 +327,7 @@ private:
|
||||
size_t split2 = resource.find('/', split+1);
|
||||
std::string run = resource.substr(split+1, split2-split);
|
||||
if(!run.empty()) {
|
||||
lc.scope.num = static_cast<uint>(atoi(run.c_str()));
|
||||
lc.scope.num = static_cast<uint32_t>(atoi(run.c_str()));
|
||||
lc.scope.type = MonitorScope::RUN;
|
||||
}
|
||||
if(split2 != std::string::npos && resource.compare(split2, 4, "/log") == 0) {
|
||||
@ -349,13 +349,13 @@ private:
|
||||
// Parses the url of the form /log/NAME/NUMBER, filling in the passed
|
||||
// references and returning true if successful. /log/NAME/latest is
|
||||
// also allowed, in which case the num reference is set to 0
|
||||
bool parseLogEndpoint(kj::StringPtr url, std::string& name, uint& num) {
|
||||
bool parseLogEndpoint(kj::StringPtr url, std::string& name, uint32_t& num) {
|
||||
if(url.startsWith("/log/")) {
|
||||
kj::StringPtr path = url.slice(5);
|
||||
KJ_IF_MAYBE(sep, path.findFirst('/')) {
|
||||
name = path.slice(0, *sep).begin();
|
||||
kj::StringPtr tail = path.slice(*sep+1);
|
||||
num = static_cast<uint>(atoi(tail.begin()));
|
||||
num = static_cast<uint32_t>(atoi(tail.begin()));
|
||||
name.erase(*sep);
|
||||
if(tail == "latest")
|
||||
num = laminar.latestRun(name);
|
||||
@ -396,7 +396,7 @@ private:
|
||||
std::string badge;
|
||||
// for log requests
|
||||
std::string name;
|
||||
uint num;
|
||||
uint32_t num;
|
||||
responseHeaders.clear();
|
||||
// Clients usually expect that http servers will ignore unknown query parameters,
|
||||
// and expect to use this feature to work around browser limitations like there
|
||||
|
@ -47,18 +47,18 @@ public:
|
||||
MOCK_METHOD2(queueJob, std::shared_ptr<Run>(std::string name, ParamMap params));
|
||||
MOCK_METHOD1(registerWaiter, void(LaminarWaiter* waiter));
|
||||
MOCK_METHOD1(deregisterWaiter, void(LaminarWaiter* waiter));
|
||||
MOCK_METHOD1(latestRun, uint(std::string));
|
||||
MOCK_METHOD4(handleLogRequest, bool(std::string, uint, std::string&, bool&));
|
||||
MOCK_METHOD1(latestRun, uint32_t(std::string));
|
||||
MOCK_METHOD4(handleLogRequest, bool(std::string, uint32_t, std::string&, bool&));
|
||||
|
||||
MOCK_METHOD1(sendStatus, void(LaminarClient* client));
|
||||
MOCK_METHOD4(setParam, bool(std::string job, uint buildNum, std::string param, std::string value));
|
||||
MOCK_METHOD4(setParam, bool(std::string job, uint32_t buildNum, std::string param, std::string value));
|
||||
MOCK_METHOD0(listQueuedJobs, const std::list<std::shared_ptr<Run>>&());
|
||||
MOCK_METHOD0(listRunningJobs, const RunSet&());
|
||||
MOCK_METHOD0(listKnownJobs, std::list<std::string>());
|
||||
|
||||
MOCK_METHOD0(getCustomCss, std::string());
|
||||
MOCK_METHOD2(handleBadgeRequest, bool(std::string, std::string&));
|
||||
MOCK_METHOD2(abort, bool(std::string, uint));
|
||||
MOCK_METHOD2(abort, bool(std::string, uint32_t));
|
||||
MOCK_METHOD0(abortAll, void());
|
||||
MOCK_METHOD0(notifyConfigChanged, void());
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user