Visualizing CI/CD in a Terminal

Nick Mitchell
The Graphical Terminal
5 min readJun 11, 2019

Kui is a graphical terminal — the CLI with a GUI twist. At its heart, Kui is a plain terminal, with a command line approach to interacting with your cloud resources. In response to certain commands, Kui augments the ASCII art presented by those commands with graphics. In this blog, I will highlight using Kui to interact, visually, with your Tekton CI/CD pipelines

Tekton leverages Kubernetes to implement delivery pipelines. As part of the Kubernetes world, Tekton requires that you code a pipeline by writing YAML. A Tekton Pipeline is a potentially parallel flow of Tasks, and each Task is a sequence of Steps. To execute a Pipeline or Task, you write more YAML, e.g. to define the parameters of a TaskRun. For example, “hello world” is specified as a single-Step Task (reference):

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: echo-hello-world
spec:
steps:
- name: echo
image: ubuntu
command:
- echo
args:
- "hello world"

After defining your resources, you use kubectl apply to deploy and execute your delivery pipeline. To inspect the output of a pipeline run, issue kubectl get pipelinerun, and mentally parse out the resulting YAML. This is the world of Kubernetes, and, as a member, Tekton is not immune from the generally low-level nature of daily affairs.

Tooling can clearly help, but how can we deliver tools into the hands of productive users; i.e. those of us that have already navigated away from consoles and to the CLI, but would rather not waste too much time on monotonous crafting of jsonpathor jq?

If CLIs and their ASCII art are tedious, what are our options for making better tools? We could wrap the low-level kubectl commands inside of a second terminal tool. There is some precedence for this; witness istioctl and k9s. Of these two approaches, creating a wrapper on top of the base command set (istioctl) versus offering visual help with understanding and navigation (k9s), I prefer the latter approach. Still, both stay in the terminal, which means I can retain my highly tuned and productive daily grind.

A frequently employed alternate tooling strategy is the browser-based console. The Tekton team is working on such a tool, called the Tekton Dashboard. That approach has some undeniable attractions. Compared to k9s console, which is limited by the ASCII art of a conventional terminal, a browser-based tool can leverage the wealth of possibilities offered by modern HTML.

There are some negatives to a browser-based console. To leverage the graphics offered by a browser console, I need to context switch; first I will navigate to the console’s web page; once there, I probably will need to re-enter my login credentials; then, I will inevitably find my self navigating through a few levels of menu structure — even though I am here to accomplish a specific goal, the console has been designed to help with dozens of tasks. Because these are browser page switches, each one will likely be slow. Thus, despite the help offered by the console visualizations and abstractions, I find myself using them only when desperate enough that the benefits outweigh the context switch overheads.

The Kui terminal is designed to tackle these problems. Kui is a terminal that runs as a local application on your laptop. It has access to your local filesystem, unlike a browser. Kui is supported by a browser rendering engine (via Electron), which powers up its visualizations. In response to some commands, Kui responds with graphics instead of ASCII art.

Kui provides visualizations of Tekton pipelines, directly from a terminal. In this case, I have listed, then explored, some demos located on my local filesystem.

To the left is Kui in action. I first use ls to list an example directory on my local filesystem. I then click on a Tekton example. Kui then sweeps in the details of that resource in the Kui sidecar. In the sidecar, I am presented a flow visualization; note how I can also choose to view the raw YAML representation, as well.

Note how, when I click on the simple.yaml entry of the directory listing, Kui also displays the actuating command: tekton flow .... Kui strives for a spirit of transparency: do not hide the command line behind too much mousey gloss.

Kui also offers visual help for working with deployed Tekton resources.

Using Kui to visualize deployed Tekton resources.

In the GIF to the left, I use kubectl get to list my deployed pipelines. Kui renders the tabular output fairly identically to what you would see in any ASCII terminal, except that the names are clickable. So I click! Note again that the command to actuate the drilldown is shown. At the same time, Kui presents a more visual summary of the resource in the sidecar.

In the sidecar, Kui has recognized this resource, and that it has a registered view for this kind of resource: the Flow view. I click on the Flow tab, which gives me quick access to a visualization of my pipeline — directly from my terminal. No switching to a browser required, and I can use as much or little of the mousey gloss as I choose.

Finally, Kui offers some help for visualizing pipeline executions.

Using Kui to visualize the execution of a Tekton pipeline.

Kui offers three views to help. First, on the Flow tab, Kui overlays the flow with a color code that highlights failed steps in red. Second is a trace view that shows the events in a conventional sequence diagram. Third, Kui offers quick access to the logs of the various pipeline steps.

Kui came from IBM Research, but is open to everyone. It is Apache-2.0 licensed, and has a powerful and flexible extension and packaging mechanism. Join us on GitHub, or download a prebuilt binary.

The entirely personal views of Nick Mitchell, nighttime hacker and daytime hiker.

--

--