1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00
Commit Graph

227 Commits

Author SHA1 Message Date
Oliver Giles
f981491a34 define FNM_EXTMATCH to 0 if undefined
FNM_EXTMATCH is undefined under musl. In that case, we
just won't support extended match patterns.

Resolves #110
2020-02-25 20:36:26 +02:00
Oliver Giles
a7e6094d01 replace KJ_ASSERT with LASSERT
inadvertently reintroduced KJ_ASSERT with recent refactor.
It uses __FILE__ which contains path to source, which is
fixed with LASSERT
2020-01-02 08:16:55 +02:00
Oliver Giles
2bf04d8157 allow setting a job description
adding DESCRIPTION=foo to $JOBNAME.conf will display "foo"
in the job overview page on the frontend

Resolves #97
2019-12-25 14:37:16 +02:00
Oliver Giles
3fde38c6b8 job leader process
Implement a separate process, the "leader", which runs all the
scripts for a job run, instead of directly from the main laminard
process. This makes for a cleaner process tree view, where the
owning job for a given script is clear; also the leader process
acts as a subreaper to clean up any wayward descendent processes.

Resolves #78.
2019-12-23 07:56:37 +02:00
Oliver Giles
0384fc9a0a
Replace nodes/tags with contexts
The nodes/tags system has not been particularly successful, it's not as
intuitive as it could be, and in an attempt to be a single feature to address
many use cases, ends up addressing none of them particularly well.

This commit replaces nodes and tags with contexts.

Each job may define which context(s) the job may be associated with.
Laminar will only pop the job off the waiting queue when it can be assigned
to a context. A context defines an integer number of executors, which
represents how many runs can be simultaneously assigned to it. A context
may provide extra environment variables.

Essentially, a context replaces a node, and tags are gone. You just assign
jobs to contexts directly, and you can use a glob expression. This should be
more intuitive.

For grouping jobs in the WebUI, a separate mechanism called "groups" is provided.
2019-12-13 10:42:22 +02:00
Oliver Giles
ba472711be refactor: remove run page json type hack
this hack tried to avoid sending unnecessary data to the frontend,
but it was more trouble than it's worth
2019-11-01 07:27:34 +02:00
Oliver Giles
39ca7e86cf replace websockets with sse and refactor
Large refactor that more closely aligns the codebase to the kj async
style, more clearly exposes an interface for functional testing and
removes cruft. There is a slight increase in coupling between the
Laminar and Http/Rpc classes, but this was always an issue, just until
now more obscured by the arbitrary pure virtual LaminarInterface class
(which has been removed in this change) and the previous lumping
together of all the async stuff in the Server class (which is now
more spread around the code according to function).

This change replaces the use of Websockets with Server Side Events
(SSE). They are simpler and more suitable for the publish-style messages
used by Laminar, and typically require less configuration of the
reverse proxy HTTP server.

Use of gmock is also removed, which eases testing in certain envs.

Resolves #90.
2019-10-05 20:06:35 +03:00
Oliver Giles
4a07e24da3 split server into http and rpc parts
this is initial preparation for a larger refactor
2019-09-27 20:50:46 +03:00
Oliver Giles
4614ada1d3 log: use fully qualified namespace ref for __FILE_BASE__
helps prevent conflicts if "using namespace" is used
2019-09-27 10:48:00 +03:00
Oliver Giles
21c097a7a9 resolves #104: fix clang compiler error
provide a local typedef instead of using a pure anonymous struct

also fix inconsistent whitespace
2019-09-27 10:42:01 +03:00
Oliver Giles
7b418a546c add uint typedef
Needed for musl
2019-07-04 12:28:33 +03:00
Oliver Giles
448d8cfa48 log.h: null-terminate compile-time filename strings 2019-04-17 09:26:45 +03:00
Oliver Giles
21ea5363a9 resolves #89: ignore unknown http query params 2019-04-15 06:54:21 +03:00
Oliver Giles
0c67d4c844 logging: strip full paths from __FILE__ at compile-time 2019-04-11 22:14:26 +03:00
Oliver Giles
bcb8b438f3 laminarc: more explicit return codes 2019-04-11 21:00:00 +03:00
Oliver Giles
95482c78a5 resolves #80: reverse-proxy with custom base URL
Fix all hrefs and vue routes to correctly operate against the
<base href> tag. Add a configuration parameter to override the
content of the href attribute, and describe its use.
2019-03-29 22:43:16 +03:00
Oliver Giles
210787a352 log endpoint: hint to reverse-proxy not to buffer
As discussed in #88, nginx will buffer the chunked transfer-encoding
unless the proxy_buffering directive is disabled, or the
X-Accel-Buffering header is set to no. Do the latter to reduce
configuration burden on frontend reverse-proxy setups.
2019-03-29 22:40:46 +03:00
Vaclav Valicek
303fe7c6ae resolves #87: Fix archive url: missing slash
Terminate default URL with slash, add slash to custom URL when absent
2019-03-27 09:00:13 +02:00
Oliver Giles
bb81931ce9 regression fix: badge url
badge urls were returning 404 and an exception message since
cec4721e. Fixed by correctly extracting the job name from the
request URL
2019-03-08 08:20:41 +02:00
Oliver Giles
b15166e83b resolves #82: implement /latest endpoint
for run page on webui and archive (via symlink)
2019-02-18 23:06:11 +02:00
Oliver Giles
137f35bdd7 additional fixes for #79: chunked http log
fix a missing js function call that broke log output in the
webui, and replace TextDecoderStream with TextDecoder because
the former isn't supported in Firefox
2019-02-18 23:03:14 +02:00
Oliver Giles
807901c719 additional fixes for #79: chunked http log
use correct sqlite column name
remove redundant code, tidy implementation
2019-02-17 22:51:11 +02:00
Oliver Giles
cec4721e52 resolves #79: serve logs over plain chunked http 2019-02-15 19:05:44 +02:00
Oliver Giles
5c7421c833 minor valgrind fixes 2019-02-15 18:24:36 +02:00
Oliver Giles
31c64980f7 Catch exceptions in websockets and drop the connection 2018-12-30 08:26:58 +02:00
Oliver Giles
c0556b871b resolves #77: exit noisily on ::bind failure 2018-12-14 15:23:57 +02:00
Oliver Giles
77b8c8d601 resolves #69: job scripts as symlinks
Fixes some regressions introduced by the recent refactor
2018-10-14 22:16:42 +03:00
Oliver Giles
7cee824cee resolves #67: laminarc list jobs
Implements the following laminarc commands:
- show-jobs
- show-running
- show-queued
- abort
2018-10-12 17:22:21 +03:00
Oliver Giles
7c600c679f fix node/tag bugs introduced with fs refactor 2018-10-12 17:01:42 +03:00
Oliver Giles
787f8f1681 badge svg: define root element dimensions
This prevents default 300x150 sizing
2018-10-12 12:56:16 +03:00
Oliver Giles
b4df6f5c02 fix job-finished event on run page
fixes regression introduced in 63301c73
2018-10-05 17:53:37 +03:00
Oliver Giles
0bacaf2a3e fix ambiguous SQL query
Query did not always return the last run as required due to
implementation-defined behaviour of mixing aggregate and
non-aggregate columns with group-by
2018-09-30 13:08:34 +03:00
Oliver Giles
48854239a5 label per-job build-time graph axes
commonalize some js for configuring time axes
2018-09-30 13:00:23 +03:00
Oliver Giles
63301c73d9 resolves #61: clickable up/downstream triggers
Recognises triggers in build logs and converts them to
hyperlinks. Also separates upstream job from reason string
and allows both to be provided
2018-09-30 09:04:17 +03:00
Oliver Giles
f5e719ac02 improve graph labelling 2018-09-28 15:37:39 +03:00
Oliver Giles
fddaed02d6 remove some duplicated code in RpcImpl
Part of #49 refactor
2018-09-28 12:56:49 +03:00
Oliver Giles
18012a8d7a resolves #63: remove locks
Add an example to the User Manual for using flock instead
2018-09-28 12:43:46 +03:00
Oliver Giles
a7aac62897 fix SQLITE_DETERMINISTIC compile error under old sqlite3
the centos7 version of sqlite3 doesn't have SQLITE_DETERMINISTIC
2018-09-28 12:43:46 +03:00
Oliver Giles
08b3f25a22 Replace boost/filesystem with kj/filesystem
Lose the boost dependency since recent versions of capnproto's kj
also provide a nice filesystem library. Take the opportunity to
refactor the Run object to become more than POD and to encapsulate
some of the functionality that was done in the Laminar class

Part of #49 refactor
2018-09-28 12:43:40 +03:00
Oliver Giles
132d40e6a3 resolves #50: badge url
Implements serving of an SVG badge at the url /badge/JOB.svg which
prettily shows the job's current status
2018-09-10 14:51:43 +03:00
Oliver Giles
ab7be5a6c9 resolves #52: timeout prevents .after script
Mark .after scripts as executing even after a timeout abort
2018-09-09 12:15:23 +03:00
Oliver Giles
a2d30ad2ea resolves #62: add average line to build time graphs 2018-09-08 21:02:58 +03:00
Oliver Giles
010af57ed4 resolves #45: new graphs
- regressions and recoveries: list of jobs whose run status changed,
  ordered first by currently failing jobs, secondly by count of jobs
  since the status change, descending for currently failing jobs and
  ascending for currently passing jobs
- low pass rates: list of the jobs with the worst pass rates calculated
  over all time
- run time changes: jobs with the largest changes in build time. This
  is calculated as the difference between the range and the standard
  deviation over the past 10 runs.
- average run time distribution: shows the number of jobs in the
  system divided into buckets based on their average runtime
2018-09-08 18:16:30 +03:00
Oliver Giles
1f122518dd resolves #64: graph jumps to previous values
Ensure the old chart is completely removed before loading a new
set of values due to different page or sort options
2018-08-24 13:32:07 +03:00
Oliver Giles
f2bbfd91bb charts: set linear minimum to 0 2018-08-24 13:31:29 +03:00
Oliver Giles
2349791676 resolves #47: jobs don't refresh on jobs page
The computed list of filtered jobs wasn't updated when a notification
was received from the server. Switch to using a method rather than a
computed property to fix this. Also add tags to jobs reported in
job_started and job_completed notifications
2018-08-24 13:10:00 +03:00
Oliver Giles
8bcce4d5cc resolves #40: implement frontend sorting
This feature allows runs to be sorted by result, number, start time
or duration, in ascending or descending order, on the Job page. Request
is processed server-side so that the correct page division can be done.
Currently running jobs are not sorted.
2018-08-24 12:15:40 +03:00
Oliver Giles
a81492e5bc use kj's onChildExit mechanism
This reduces code and allows for more idiosyncratic use of Promises.
Requires latest capnproto git.

Part of #49 refactor
2018-08-03 14:36:24 +03:00
Oliver Giles
4ffc22c657 use promises to control job runs
This is a refactor that more cleanly uses the kj framework for handling
processes spawned by Runs. This obviates the workaround introduced back in
ff42dae7cc, and incidentally now requires c++14.

Part of #49 refactor
2018-07-20 17:40:56 +03:00
Oliver Giles
e506142fa4 Update Chart.js to latest: 2.7.2
Adapt to new API. This removes a few workarounds and should
contribute nicely to #44, #45 and #57
2018-07-20 14:18:12 +03:00
Oliver Giles
d29715c0ec Reuse MappedFileImpl for reading custom css
This is nicer than slurping and removes a whole function. A further
improvement could be to retain the mapping permanently open.

Part of #49 refactor
2018-07-06 13:45:13 +03:00
Oliver Giles
758b5f2e46 resolves #37: closed connection on large files
The old implementation slurped the whole artefact into memory, and
did not ensure it remained allocated beyond the first call to write().
The new implementation uses mmap and ensures the mapping lasts until
the file has been delivered
2018-07-06 13:18:04 +03:00
Oliver Giles
078e0e9882 improve websocket handling
The previous implementation meant that messages could get lost if
both sending and receiving were scheduled to be processed in the
same event loop cycle. This commit separates the two channels
more clearly, while still allowing the close event in the receive
side to cancel the whole pipeline

Part of #49 refactor
2018-07-06 12:33:04 +03:00
Oliver Giles
4c2aa2680f Implement websocket communication with kj-http
Now that capnp/kj provides http and websocket functions, replace
the excellent websocketpp library with the kj functions. This
removes a dependency and allows for more consistent idiomatic
code. Thanks websocketpp, it was great to have you along!

This should enable parts of the refactor described in #49
2018-06-30 20:34:56 +03:00
Oliver Giles
0b15939f90 resolves #59: pagination doesn't work after reconnect
A subtle tweak to the websocket logic needed to handle
this edge case. Better comments added.
2018-06-30 20:19:54 +03:00
Oliver Giles
d241d6757f resolves #58: 'connecting' overlay not removed
Now that the 'status' message can be used also as an update
(since 2a14567), extra care has to be taken with the popup
reconnecting overlay
2018-06-30 19:42:11 +03:00
Oliver Giles
2a14567b79 resolves #54: page number remembered between jobs 2018-06-16 17:07:04 +03:00
Oliver Giles
a0f586581d resolves #38: implement pagination for the job page 2018-06-01 14:51:34 +03:00
Oliver Giles
d1ca6392a4 resolves #43: limit the results displayed on home page
Limit "runs per job in last 24h" and "average runtime per job"
graphs to the top 5 in each case
2018-06-01 10:33:25 +03:00
Vaclav Valicek
fba2d226ef Show file sizes of artifacts (#53)
Show artifacts sizes in webui
2018-06-01 10:14:59 +03:00
Oliver Giles
180b5b7117 fix: spell out the constructor for gcc4.8 2018-05-14 20:54:12 +03:00
Oliver Giles
f1e4d10be3 resolves #36: queue/start/run 2018-05-12 17:56:56 +03:00
Oliver Giles
649caee297 resolves #30: job execution timeout
Add the ability to configure a timeout in seconds
after which a job run will be automatically aborted
2018-05-12 13:25:19 +03:00
Oliver Giles
ce81be85c7 resolves #48: custom css ineffectual behind reverse proxy
Caddy (and probably other webservers) add a Content-Type header
when one was not supplied by the application backend. Under Chromium,
the css file is not interpreted if the webserver delivers it with
Content-Type: text/plain, althugh it does work if no Content-Type
header is set. To prevent the frontend proxy from adding the wrong
header, set it correctly in the first place
2018-05-04 07:48:48 +03:00
Oliver Giles
083f136186 resolves #41: strange behaviour of limits
On a configuration change, update existing Nodes in Laminar's NodeMap
rather than replacing it with a new map.
2018-04-20 14:18:10 +03:00
Oliver Giles
c937362961 Update comment about loading configuration files
Dynamic reloading of config files was implemented in 216ecee7c5
2018-04-20 12:54:39 +03:00
Oliver Giles
216ecee7c5 resolves #34: watch for configuration changes
Reload the configuration if a change is detected
without requiring a server restart
2018-04-06 18:04:50 +03:00
Oliver Giles
a5d8b985f1 laminarc: replace start with run 2018-04-06 13:43:38 +03:00
Oliver Giles
4d2388c271 resolves #33: laminar start output should reference run number 2018-04-06 13:35:02 +03:00
Oliver Giles
9c256815e4 resolves #29: graceful shutdown
on SIGINT/SIGTERM:
1. stop accepting new connections
2. send SIGTERM to all child tasks
3. wait for processes to end
4. drop all websockets
2018-02-24 18:53:11 +02:00
Oliver Giles
30f2203a3b resolves #28: compensate for server/client clock skew 2018-02-03 16:52:46 +02:00
Oliver Giles
46efb07285 test: add LaminarTest stub 2018-02-03 16:47:41 +02:00
Oliver Giles
3b267967cf resolves #31: exception thrown on bad file descriptor
Read or writes to bad file descriptors threw exceptions, just log
this instead. Also make sure that LaminarClients are removed from
the list of clients when a connection is aggressively dropped, and
add test
2018-01-27 13:11:40 +02:00
Oliver Giles
5ff3bbe2bb add basic tests for conf, database and run 2018-01-26 13:07:02 +02:00
David Kalnischkies
ae961b97cb replace gif status indicators with unicode symbols 2018-01-08 08:03:46 +02:00
Oliver Giles
6e4c89bd73 improve web notification format 2018-01-05 10:50:50 +02:00
Oliver Giles
d7351c0c70 fix compile error on 32-bit Linux
On 32-bit Linux, time_t is a long. Laminar extensively uses
time_t but provided only int and int64 db access, making the
use of long ambiguous. Since there is no explicit use of int64,
and because on 32-bit Linux long and int are recognized as
different types despite being the same width, replacing the
int64 handlers with long handlers fixes the compile error
2018-01-04 08:40:10 +02:00
Oliver Giles
3b0efcac9d resolves #23: In-browser notification
This implements web notifications on job completion. Opt-in
by default, the preference is saved in js localStorage and
can be toggled directly on any page
2017-12-29 17:18:43 +02:00
Oliver Giles
93b428529e webui may be modified with custom style.css 2017-12-29 11:14:20 +02:00
Oliver Giles
e1a0c7bd0b resolves #24: notify and reconnect interrupted connections
A notification is shown on the webui when the websocket
connection is lost, and periodic retry is attempted
2017-12-23 17:15:48 +02:00
Václav Valíček
1bd4300d1b Enable colored output for output logs 2017-12-21 08:57:24 +02:00
Oliver Giles
1f23ec5fb2 escape html tags in log output
While normally this isn't enough to prevent XSS, this output will only
appear in the body of a <pre>, and anyway the scripts are semi-privileged
2017-12-21 08:46:00 +02:00
Oliver Giles
3129f0e73b fix pedantic compiler warnings 2017-12-21 08:19:45 +02:00
Oliver Giles
e0a130f33d add named getters to RunSet
this improves readability by removing the index-based
get<> methods in favour of explicitly named methods
2017-12-20 09:02:15 +02:00
Oliver Giles
bb9486e066 use compliant include guards 2017-12-20 08:24:25 +02:00
Oliver Giles
9e1a65ccee server: minor websocket client handler refactor
Now explicitly closed connections on the client side are
closed with a clean error code. This is motivated by upcoming
work to detect broken websockets and automatically reconnect
2017-12-16 18:21:33 +02:00
Oliver Giles
ff42dae7cc read remaining data in run pipe when reaping
This fixes a bug where the last pieces of console output were lost. In that
case, the event loop scheduled the ended child process's SIGCHLD handler
before the handler to read the last of the process's output. We work around
that by doing an additional (non-blocking) read in the SIGCHLD handler
2017-12-09 20:27:08 +02:00
Oliver Giles
76e0e9e62a resolves #22: allow keeping N rundirs
This replaces LAMINAR_KEEP_RUNDIR (bool) with LAMINAR_KEEP_RUNDIRS (int)
2017-12-09 20:23:24 +02:00
Oliver Giles
74443c292a Fix copyright years
This reverts commit 4e911756bc.

In addition, copyright years are now expressed in the form of
(year file added)-(year file last changed)
2017-12-09 12:21:34 +02:00
Oliver Giles
e371f8ca5a server: use regular char array as buffer
This approach finally solves the crash under hardened gentoo
discussed in #19
2017-12-07 18:28:12 +02:00
Oliver Giles
4c63cef7ac remove unnecessary attach() 2017-12-06 21:59:22 +02:00
Oliver Giles
272176a6a5 server: allocate a single buffer per file descriptor 2017-12-06 21:51:50 +02:00
Oliver Giles
b70e501d6d attempt to solve segfault under hardened gentoo
Can't reproduce this locally, but looks like using a std::string
as an arbitrary buffer is causing problems. See #19
2017-12-06 09:24:35 +02:00
Oliver Giles
9c92c5b514 don't leak file descriptors into runs 2017-12-04 20:31:23 +02:00
Oliver Giles
d91816097a resolves #19: laminard crashes under load
reading into a static buffer is a race condition that is only
manifested under load. There's no guarantee the clause in then()
will run before another task overwrites the buffer. Allocating
a local string is the only correct solution
2017-12-04 20:29:19 +02:00
Oliver Giles
7dce535264 webui: navbar with square corners 2017-12-02 20:52:34 +02:00
Oliver Giles
28a939316c resolves #18: don't error out when rundir already exists 2017-12-02 20:52:19 +02:00
Oliver Giles
07c024e6ed resolves #21: executors graph incorrect after refresh 2017-12-02 19:10:00 +02:00
Oliver Giles
288b950f9e resolves #20: queued runs lost on job page refresh 2017-12-02 19:06:54 +02:00
Oliver Giles
9685563338 debug: don't assert on signo != SIGCHLD 2017-12-02 18:54:39 +02:00