Commit f4ac402
Eric Bower
·
2026-05-06 21:13:13 -0400 EDT
parent 9aad8f0
chore: cleanup
3 files changed,
+49,
-8
+1,
-1
| ... | ... | @@ -1 +1 @@ | |
| 1 | - | {"type":"git.push","name":"pico","workspace":"/home/erock/dev/pico/"} | |
| 1 | + | {"type":"git.push","name":"pici","workspace":"/home/erock/dev/pici/"} |
M
main.go
+36,
-7
| ... | ... | @@ -146,6 +146,10 @@ func main() { | |
| 146 | 146 | os.Exit(1) | |
| 147 | 147 | } | |
| 148 | 148 | case "monitor": | |
| 149 | + | if flag.Arg(1) == "--help" || flag.Arg(1) == "help" { | |
| 150 | + | printMonitorHelp() | |
| 151 | + | return | |
| 152 | + | } | |
| 149 | 153 | cfg.Logger.Debug("starting monitor") | |
| 150 | 154 | if err := runMonitor(cfg); err != nil { | |
| 151 | 155 | cfg.Logger.Error("monitor failed", "err", err) |
| ... | ... | @@ -161,6 +165,33 @@ func main() { | |
| 161 | 165 | } | |
| 162 | 166 | } | |
| 163 | 167 | ||
| 168 | + | func printMonitorHelp() { | |
| 169 | + | fmt.Println(`pici monitor — poll ci.* zmx sessions, stage artifacts, publish status. | |
| 170 | + | ||
| 171 | + | USAGE | |
| 172 | + | pici monitor [flags] | |
| 173 | + | pici monitor --human | ssh pipe.pico.sh "pub build.status -b=false" | |
| 174 | + | ||
| 175 | + | OUTPUT MODES | |
| 176 | + | Default (JSONL): One JSON object per line to stdout, suitable for piping. | |
| 177 | + | pici monitor > status.jsonl | |
| 178 | + | pici monitor | while read -r line; do curl -sd"$line" $WEBHOOK; done | |
| 179 | + | ||
| 180 | + | --human: Selfci-style progress output for terminal viewing. | |
| 181 | + | pici monitor --human --status-filter all | |
| 182 | + | [2/3] 🚀 running: myrepo (1m23s) | |
| 183 | + | [3/3] ✅ success: myrepo (2m34s) | |
| 184 | + | ||
| 185 | + | FLAGS | |
| 186 | + | -pk <path> SSH private key for authenticating with pico services | |
| 187 | + | -ck <path> SSH certificate public key | |
| 188 | + | -artifact-dir <path> Local directory to stage artifacts (default: /tmp/pici-artifacts) | |
| 189 | + | -monitor-interval <dur> Poll interval (default: 5s) | |
| 190 | + | -status-filter <filter> "terminal" (default) or "all" | |
| 191 | + | -human Human-readable output instead of JSONL | |
| 192 | + | -log-level <level> Log level: debug, info, warn, error (default: info)`) | |
| 193 | + | } | |
| 194 | + | ||
| 164 | 195 | func printRunnerHelp() { | |
| 165 | 196 | fmt.Println(`pici runner — execute a CI job from an event JSON payload. | |
| 166 | 197 |
| ... | ... | @@ -179,15 +210,13 @@ EXAMPLE | |
| 179 | 210 | echo '{"type":"push","name":"myrepo","workspace":"git@github.com:user/myrepo.git"}' | pici runner | |
| 180 | 211 | ||
| 181 | 212 | FLAGS | |
| 182 | - | -pk <path> SSH private key for authenticating with pico services | |
| 183 | - | -ck <path> SSH certificate public key (required when using SSH certificates) | |
| 213 | + | -pk <path> SSH private key for authenticating with pico services | |
| 214 | + | -ck <path> SSH certificate public key (required when using SSH certificates) | |
| 215 | + | -event <json> Event JSON string (alternative to reading from stdin) | |
| 184 | 216 | -artifact-dir <path> Local directory to stage artifacts (default: /tmp/pici-artifacts) | |
| 185 | - | -event <json> Event JSON string (alternative to reading from stdin) | |
| 186 | - | -monitor-interval <dur> Interval for monitoring zmx sessions (default: 5s) | |
| 187 | 217 | -log-level <level> Log level: debug, info, warn, error (default: info) | |
| 188 | - | -structured Use structured key=value log output | |
| 189 | - | -status-filter <filter> Status output filter: terminal (default) or all | |
| 190 | - | -human Human-readable output instead of JSONL / slog`) | |
| 218 | + | -human Human-readable output (default: enabled for runner)`) | |
| 219 | + | ||
| 191 | 220 | } | |
| 192 | 221 | ||
| 193 | 222 | func RunRunner(cfg *Cfg) error { |
A
pico.sh
+12,
-0
| ... | ... | @@ -0,0 +1,12 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | set -xeuo pipefail | |
| 3 | + | ||
| 4 | + | export ZMX_SESSION_PREFIX="${ZMX_SESSION_PREFIX:-ci-}" | |
| 5 | + | ||
| 6 | + | printf "\x1b[33mrunning ci\x1b[0m\n" | |
| 7 | + | ||
| 8 | + | zmx run lint -d docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v2.11.4 golangci-lint run | |
| 9 | + | zmx run test -d docker run -t --rm -v $(pwd):/app -w /app golang:1.26 go test ./... | |
| 10 | + | zmx wait lint test | |
| 11 | + | ||
| 12 | + | printf "\x1b[32msuccess!\x1b[0m\n" |