Today, we're open sourcing Terminal, the Ruby library behind our rendering of job logs.
$ gem install terminal
Terminal makes it easy to take arbitrary shell output, and turn it into beautifully rendered HTML. It has a simple API:
require "terminal" Terminal.render("...")
Terminal also ships with a command line utility, making it easy to test what the output will look like from the command line. For example, you can pipe rspec output to it:
$ rspec --color --tty | terminal
This will output the rendered HTML. That's not very useful by itself, but if you pass the
--preview flag, it will render the output in a browser for you to view.
$ rspec --color --tty | terminal --preview
Then, you can:
$JOB_LOG_URL="https://api.buildkite.com/v2/organizations/[org]/pipelines/[pipeline]/builds/[build]/jobs/[job]/log" echo $(curl -H "Authorization: Bearer [api-key]" $JOB_LOG_URL -s | jq '.content') | terminal
Once you've identified a problem, submit an issue, or if you're feeling adventurous, submit a Pull Request and contribute to Buildbox! :)
For more information on the Buildbox Builds API, see: https://buildkite.com/docs/api/builds.
You can check out Terminal on our GitHub repository: https://github.com/buildkite/terminal-to-html/.
Buildkite is the fastest, most secure way to test and deploy code at any scale.
Our self-hosted agents work in your environment with any source code tool, platform and language including but not limited to Ruby, Xcode, Go, Node, Python, Java, Haskell, .NET or pre-release tools.
Sign up for free, and
connect your first agent.