Lars Wirzenius
211bb3a7d1
refactor: use engine in main
...
Also introduce exit codes: 0 for success, 1 for problem in the
repository under test, 2 for engine problem.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-16 19:20:27 +02:00
Lars Wirzenius
52ba6a9081
refactor: add new engine to execute a CI run
...
In the old engine it's hard to follow how various errors are handled.
This new engine should make it clearer.
This isn't entirely a pure refactoring. It subtly changed how the
external behavior is, to fix problems.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-16 19:19:50 +02:00
Lars Wirzenius
e786def6cd
refactor: rename log or logfile to adminlog, for clarity
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 18:09:16 +02:00
Lars Wirzenius
3a56190257
refactor: rename LogFile to AdminLog
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 18:00:52 +02:00
Lars Wirzenius
7cab669cca
improve error handling
...
Incl. fix tests.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 17:37:49 +02:00
Lars Wirzenius
bd74aeeccc
feat: show absolute path name for runcmd "in directory"
...
This is more helpful than ".".
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 14:41:27 +02:00
Lars Wirzenius
c949db7e6f
fix: write the run log
...
It turns out that writing the to a file is sometimes a useful thing to
do. Who could've foreseen this. Well, they're using a paper bag on
their head as they're writing this commit message.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 14:41:27 +02:00
Lars Wirzenius
3a20cb66e6
feat! drop the env logging
...
We have a run log, aimed at the developer for whose project CI is run,
and the node admin log, aimed at the node admin. We don't need a third
log aimed at the developer of the native CI engine itself.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 14:38:58 +02:00
Lars Wirzenius
9225ef0d31
pass in RunLog, not filename for it
...
RunLog knows how to construct a whole log, rather than just writing
individual messages to it.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 14:38:00 +02:00
Lars Wirzenius
8be0bbd59d
fix run log filename suffix
...
We're about to make HTML logs, to .html is the right suffix, not .txt.
Also drop a commented-out log message.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 14:36:02 +02:00
Lars Wirzenius
aafb251254
feat: add a module to construct HTML run logs
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-12 13:12:44 +02:00
Lars Wirzenius
cced880813
chore: remove unused argument to report::build_report
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-12 11:37:55 +02:00
Lars Wirzenius
9a3f4c99e1
fix: mangled source file
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 18:23:35 +02:00
Lars Wirzenius
fd2dd65ef2
fix: indicate time zone as UTC
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 18:22:51 +02:00
Lars Wirzenius
30e297a725
feat: add a "last update" time stamp to the report page
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 18:20:04 +02:00
Lars Wirzenius
ed2678e2bb
fix: headings start a new line, or are preceded by a newline
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 18:05:07 +02:00
Lars Wirzenius
6627cd29e0
fix: undo rename of run info field id
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 18:00:51 +02:00
Lars Wirzenius
87f91e2474
feat: allow setting max duration of a CI run
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
ddfedf5985
refactor: don't write run info file unless requested
...
Also, rename id to run_id for clarity. Found this out the hard way
while debugging.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
6083f087d7
tests: no stdin for adapter
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
f660492c48
tests: malformed trigger request message
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
2cfafb8075
tests: commit is missing
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
1dad8cb66f
tests: make test for missing repo more precise
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
61e8554a62
refactor: pass in trigger to _run_ci
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
2d370a4191
refactor: use _create_ci
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
161a3635b4
refactor: use _get_repo_info
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
5336bf8195
refactor: use _create_valid_native_yaml
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
84ed4678d8
refactor: use _create_git_repo
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
b252e87e0a
refactor: rename _ci to _create_ci
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
eecbd7084a
refactor: add helper method to get repository rid and head commit
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
ef1f1bb092
refactor: add helper method to create a valid native.yaml
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
20fab34125
refactor: add helper method to create a git repository
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
a8fc705087
refactor: drop dead code
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
a99dec5007
tests: config file missing
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
ca657dbf9a
tests: verify error message mentions shell and string
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
f4aa9e9977
tests: check "shell" is mentioned in stderr
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
453c741570
tests: check env var is mentioned in stderr
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
f42eee12e9
refactor: return stderr from NativeCI.run
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
150a7cdc7a
chore: drop obsolete test suite
2024-01-10 17:38:05 +02:00
Lars Wirzenius
26f9982401
refactor: only expose the writeln method
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
703c5c5a7c
refactor: drop the method that takes a String, leave the slice one
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
8e9b908b07
reactor: add methods to write lines
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
4ed550de3d
refactor: add higher level API to LogFile
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
5c6369731a
refactor: add helper function to git checkout
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
407fc97914
refactor: add helper function to git clone
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
32486e8254
refactor: add helper function to send "triggered" message
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
a0aee4df4e
refactor: add helper functions to log
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
31e39d5a9b
refactor: open run log file when creating Runner
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
5266ca1cb9
refactor: get rid of function with too many arguments using builder
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00
Lars Wirzenius
bc7ffbad0f
refactor: split one Rust main module into many small module
...
This lets me see the core logic easier.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-10 17:38:05 +02:00