watch a gitlab pipeline. ding when done.
$ glw
14:02:11 watching pipeline #987654 (root status: running)
14:02:11 #987654 running https://gitlab.com/foo/bar/-/pipelines/987654
14:03:42 #987654 → discovered downstream #987655 https://gitlab.com/foo/deploy/-/pipelines/987655
14:03:42 #987655 created https://gitlab.com/foo/deploy/-/pipelines/987655
14:04:11 #987655 manual https://gitlab.com/foo/deploy/-/pipelines/987655
↑ desktop notification fires here ("needs manual trigger")
14:06:31 #987655 running
14:08:01 #987654 success
14:08:11 #987655 success
14:08:11 ✓ done — success: #987654 #987655
↑ second notification fires here
one bash file. zero deps beyond glab. mac + linux. caveman tier.
prereq — install glab and log in once:
glab auth loginthen drop glw somewhere on your $PATH:
sudo install -m 0755 glw /usr/local/bin/glw(or just chmod +x glw && cp glw ~/bin/ — whatever. it's one script.)
glw # latest pipeline on current branch (run from inside the repo)
glw 1234567 # by pipeline id (uses current repo for project context)
glw https://gitlab.com/foo/bar/-/pipelines/1234567 # by url — works from anywhere, including cross-projectwhat it does, every GLW_POLL seconds:
- polls the pipeline you pointed it at
- discovers any downstream / triggered child pipelines via the
bridgesapi and adds them to the watch - fires a desktop notification + bell on any pipeline hitting
manual(it'll keep watching after you trigger it) - exits when the whole tree is done.
0if every pipeline endedsuccess/skipped.1if any endedfailed/canceled. final desktop notification + bell on the way out.
so you can chain:
glw && ./deploy.shctrl-c to stop watching at any time.
env vars (also see .env.example):
| var | default | what |
|---|---|---|
GLW_POLL |
10 |
seconds between polls |
glab itself handles auth / token / instance host — glw doesn't need any of that.
best to worst, glw tries each in turn:
- mac:
terminal-notifier→osascript(built-in) - linux:
notify-send(libnotify; usually preinstalled with most desktops) - fallback: terminal bell (
\a)
if you're on a headless box, the bell is all you'll get — that's fine, exit code still works for glw && deploy.
- pipeline tree state lives in parallel bash arrays keyed by globally-unique pipeline id; we map id → project id so cross-project downstreams just work.
- json parsing is
grep/sed— nojqdep. only the few fields we need (id,project_id,status,web_url). manualis treated as "stuck waiting on a human" — notify once, keep polling. onlysuccess/failed/canceled/skippedare terminal for exit.- the script polls
glab apidirectly rather thanglab ci ...text output, since the json shape is more stable than the cli's pretty-printing.