-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkins
More file actions
executable file
·28 lines (25 loc) · 1.01 KB
/
jenkins
File metadata and controls
executable file
·28 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Jenkins status lights at the command line
# by tlehman
#
# Assumes the following environment variables are defined:
# JENKINS_PASSWORD
# JENKINS_USERNAME
# JENKINS_HOSTNAME
function jenkins_data_table() {
curl --user $JENKINS_USERNAME:$JENKINS_PASSWORD https://$JENKINS_HOSTNAME/api/json 2> /dev/null | \
ruby -rjson -e 'def colorize(text, color_code); "\e[#{color_code}m#{text}\e[0m"; end
def colorize_blinking(text, color_code); "\e[#{color_code};5m#{text}\e[0m"; end
def aborted(text); colorize(text, 37); end
def aborted_anime(text); colorize_blinking(text, 37); end
def red(text); colorize(text, 31); end
def disabled(text); colorize(text, 2); end
def red_anime(text); colorize_blinking(text, 31); end
def green(text); colorize(text, 32); end
def green_anime(text); colorize_blinking(text, 32); end
JSON.parse(STDIN.read)["jobs"].each { |job|
color = job["color"].gsub(/blue/, "green")
puts self.send(color, job["name"])
}'
}
jenkins_data_table