This PR adds three related features that improve troubleshooting and
integration with command-line workflows:
1. On-Disk Log Preservation (LAMINAR_ON_DISK_LOGS)
- Adds optional uncompressed log files alongside database storage
- Controlled by LAMINAR_ON_DISK_LOGS=N environment variable
- Writes logs to ${LAMINAR_HOME}/archive/JOB/RUN/log
- Keeps N most recent logs per job with automatic rotation
- Independent of LAMINAR_KEEP_RUNDIRS (for remote build scenarios)
- Backward compatible (disabled by default when N=0)
2. Configurable Default LAMINAR_HOME
- Uses CMAKE_INSTALL_PREFIX to set default LAMINAR_HOME
- Enables self-contained installations (e.g., /opt/laminar)
- Falls back to /var/lib/laminar if not set
- Reduces configuration needed for non-standard installations
3. Log Output Command (laminarc output-log)
- New command: laminarc output-log JOB [RUN]
- Outputs build logs to stdout for command-line use
- Defaults to latest run if RUN not specified
- Shows header with actual run number
- Enables integration with grep, less, AI coding assistants, etc.
Motivation:
- Database-only logs require SQL queries and decompression for access
- Standard Unix tools (grep, tail, less) cannot be used directly
- AI coding assistants and automated tools need simple log access
- Custom installation paths require manual LAMINAR_HOME configuration
Benefits:
- Direct log access with standard Unix tools
- Better troubleshooting workflow for CI/CD debugging
- Easier integration with log analysis tools and AI assistants
- More flexible installation options
- No breaking changes to existing deployments
This allows build chains to be traced in the common case where
an upstream job calls `laminarc queue' instead of `laminarc start'.
Incomplete job runs now have database entries, which requires
some adjustments in queries. Queued jobs can now be viewed in
the frontend and there is a corresponding status icon.
only add the private ANSI sequence to the output of laminarc
start/run commands used for adding a hyperlink to the frontend if
we are within a job execution (tested with __LAMINAR_SETENV_PIPE).
this makes parsing the output easier, which is likely to be more
common when laminarc is invoked externally
add -h|--help usage messages to laminarc and laminard
add a mechanism to compile in a version number, and display the
version in the help messages and in the frontend.
resolves#119
the one-liner used to iterate on the results of the RPC
calls for show-jobs, show-queued and show-running meant
that the result collection was destroyed before we
finished with it. Hoist it out of the loop.
resolves#127
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.
Improve the boundary between RpcImpl and LaminarInterface such
that the Laminar class doesn't require any types from kj/async.h.
The necessary logic moved from Laminar to RpcImpl and the notification
now happens by abstract virtual callback instead of kj::Promise.
Also remove the fairly useless 'wait' RPC call and drop the wrappers
around kj::PromiseFulfillerPair