Skip to content

Commit

Permalink
Add Jenkins Build Status Script
Browse files Browse the repository at this point in the history
Adds a script to retrieve jenkins last completed build status for
$JOBNAME, returns 💚 for pass and 💔 for failure.

```
scripts/jenkins.rb jobname
```

Requires enviornment variable set for JENKINS_HOST

```
export JENKINS_HOST=https://ci.mycompany.net
```
  • Loading branch information
DVG committed Jul 5, 2016
1 parent 929c780 commit 504e2ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
20 changes: 20 additions & 0 deletions tmux/scripts/jenkins.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env ruby
# Encoding: utf-8

require 'httparty'
require 'json'

host = ENV.fetch("JENKINS_HOST")
job = ARGV.fetch(0, nil)
fail 'No job name provided' unless job

url = "#{host}/job/#{job}/lastSuccessfulBuild/api/json"

response = HTTParty.get(url)
parsed_response = JSON.parse(response.body, symbolize_names: true)

if parsed_response.fetch(:result) == "SUCCESS"
puts "💚"
else
puts "💔"
end
5 changes: 1 addition & 4 deletions tmux/tmux.conf.symlink
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source ~/.powerline/powerline/bindings/tmux/powerline.conf
set -g prefix C-a
unbind C-b

# Send C-a to undelyinng application by pressing it twice
# Send C-a to underlying application by pressing it twice
bind C-a send-prefix

# Split vertically with |
Expand Down Expand Up @@ -60,9 +60,6 @@ set -g status-justify left
set -g status-left-length 40
set -g status-left '#[fg=colour231, bg=colour31, bold] #S #[fg=colour31, bg=black]'

# show build status hostname, date, and time in status bar
set -g status-right-length 100

# color status bar
set -g status-bg colour235
set -g status-fg white
Expand Down

0 comments on commit 504e2ca

Please sign in to comment.