-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ANSI color codes #40
Comments
I suspect this is a duplicate of #34! |
It is! I searched for ANSI but not terminal, haha |
sunshowers
added a commit
to oxidecomputer/omicron
that referenced
this issue
Nov 8, 2023
## Overview Implement a command-line interface to mupdates, with an eye to using this in CI. To achieve this, add two commands to wicket: ### `rack-update start` This command starts mupdates on one or more components. The help looks like: ``` Start one or more running updates Usage: wicket rack-update start [OPTIONS] Options: -h, --help Print help (see more with '--help') Component selectors: --sled <SLED> The sleds to operate on --switch <SWITCH> The switches to operate on --psc <PSC> The PSCs to operate on Update options: --force-update-rot Force update the RoT even if the version is the same --force-update-sp Force update the SP even if the version is the same -d, --detach Detach after starting the update Global options: --color <COLOR> Color output [default: auto] [possible values: auto, always, never] ``` ### `rack-update attach` This command attaches to any existing mupdates on one or more components. The help looks like: ``` Attach to one or more running updates Usage: wicket rack-update attach [OPTIONS] Options: -h, --help Print help (see more with '--help') Component selectors: --sled <SLED> The sleds to operate on --switch <SWITCH> The switches to operate on --psc <PSC> The PSCs to operate on Global options: --color <COLOR> Color output [default: auto] [possible values: auto, always, never] ``` ### What does this look like? Here's a screenshot: ![image](https://github.com/oxidecomputer/omicron/assets/180618/11cad6ec-cc29-48d8-ba74-c0b3e63adc9d) Buildomat doesn't yet support ANSI escape codes (oxidecomputer/buildomat#40), but if we add support for them then we'd get full color support. Otherwise, it'll look like this without colors. ## Implementation This is a somewhat large PR but almost all added code. The bulk of added code is in the update-engine, which has two new displayers: ### 1. Line display This displayer shows events line by line. Since this is meant to be used in CI, we have a hard constraint that we can't go back and change old lines. ### 2. Group display This displayer shows events across several possible executions. This is just a slightly more involved version of the line display, and shares most of its code (via `line_display_shared.rs`). The rest of this PR: * Hooks up a group displayer to wicket, which is pretty straightforward. * Adds some more to the `update-engine-basic` example. ## Testing this The wicket side can be tested with: ``` SSH_ORIGINAL_COMMAND='rack-update start --sled 1' cargo run -p wicket ``` For a more comprehensive example, run `cargo run --example update-engine-basic -- --display-style group`. Depends on #4429 (and a number of other PRs that have already landed.) ## Future work One bit of work that hasn't been done yet is doing an integration test with wicketd, wicket, MGS and sp-sim. One issue is that currently, we don't generate machine-readable output from wicket (maybe we should!), and given that that's not the case we only know how to exit with either the exit code 0 (success) or 1 (failure).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One of the neat things about GitHub Actions output is that it supports ANSI color codes. This makes the output easier to parse for commands that support it (e.g. cargo, nextest, etc).
It would be really nice if buildomat supported ANSI color codes as well.
The text was updated successfully, but these errors were encountered: