Last active
December 12, 2018 20:10
-
-
Save kazazes/576909ef64b49884dacd4c11c38075c2 to your computer and use it in GitHub Desktop.
Tired of waiting for your GC console to load while you spam-commit to a new repo? Sick of copy pasting build UUIDs from your terminal? Commit, run this puppy, and relax while tmux keeps you appraised of your menial progress. Tested with 20 simultaneous builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "Checking for running Google Cloud Build jobs..." | |
BUILDS=$(gcloud builds list | grep WORKING | cut -f1 -d " " | tr "\n" " " | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' ) | |
[[ -z "$BUILDS" ]] && echo "No running builds." && exit 1 | |
tmux start-server | |
tmux -f /dev/null new-session -c $PWD -d -s "GC Build" | |
for build in $BUILDS | |
do | |
TITLE=$(gcloud builds describe $build | head -n 3 | tail -n 1) | |
tmux new-window -a -c $PWD -n "$TITLE" "gcloud builds log --stream $build" | |
tmux setw status-position top | |
tmux setw mouse on | |
tmux setw status on | |
tmux setw status-justify centre | |
tmux setw monitor-silence 15 | |
tmux setw remain-on-exit on | |
done | |
tmux select-window -t "GC Build":1 | |
tmux -2 attach-session -t "GC Build" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've needed this for so long...