Skip to content

Commit d80b4f2

Browse files
committed
Merge pull request #47 from travis-ci/improve_github_commit_status
Improve some things and stuff and bits
2 parents d6bcc9e + 06c4c22 commit d80b4f2

File tree

14 files changed

+41
-339
lines changed

14 files changed

+41
-339
lines changed

Gemfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@ source 'https://rubygems.org'
33
ruby '2.1.6'
44

55
gem 'travis-support', github: 'travis-ci/travis-support'
6-
gem 'travis-config', '~> 1.0.0'
6+
gem 'travis-config', '~> 1.0.0'
77

88
gem 'sidekiq', '~> 4.0.0'
99
gem 'redis-namespace'
1010
gem 'sentry-raven'
11-
gem 'rollout', github: 'jamesgolick/rollout', :ref => 'v1.1.0'
1211
gem 'metriks'
1312
gem 'metriks-librato_metrics'
1413
gem 'jemalloc'
1514

16-
gem 'gh', github: 'travis-ci/gh'
15+
gem 'gh'
1716
gem 'aws-sdk'
1817
gem 'actionmailer', '~> 3.2.18'
1918
gem 'roadie'
2019
gem 'roadie-rails', '~> 1.0'
2120
gem 'multi_json'
22-
gem 'pusher', '~> 0.14.5'
2321

2422
group :test do
25-
gem 'rspec', '~> 2.14.0'
26-
gem 'mocha', '~> 0.10.0'
27-
gem 'webmock', '~> 1.8.0'
23+
gem 'rspec', '~> 2.14.0'
24+
gem 'mocha', '~> 0.10.0'
25+
gem 'webmock', '~> 1.8.0'
2826
gem 'guard'
2927
gem 'guard-rspec'
3028
end

Gemfile.lock

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
GIT
2-
remote: git://github.com/jamesgolick/rollout.git
3-
revision: 3e7312cc018061b1ac6a8aeb9f11bbd0331da889
4-
ref: v1.1.0
5-
specs:
6-
rollout (1.1.0)
7-
8-
GIT
9-
remote: git://github.com/travis-ci/gh.git
10-
revision: 27e30fd01f6d5144d8d7d0c88db7875b95ed8939
11-
specs:
12-
gh (0.14.0)
13-
addressable
14-
backports
15-
faraday (~> 0.8)
16-
multi_json (~> 1.0)
17-
net-http-persistent (>= 2.7)
18-
net-http-pipeline
19-
201
GIT
212
remote: git://github.com/travis-ci/travis-support.git
223
revision: 2cd02d2a06fdd1e2fc2f129148c168b56f7c190f
@@ -72,6 +53,13 @@ GEM
7253
foreman (0.78.0)
7354
thor (~> 0.19.1)
7455
formatador (0.2.5)
56+
gh (0.14.0)
57+
addressable
58+
backports
59+
faraday (~> 0.8)
60+
multi_json (~> 1.0)
61+
net-http-persistent (>= 2.7)
62+
net-http-pipeline
7563
guard (2.13.0)
7664
formatador (>= 0.2.4)
7765
listen (>= 2.7, <= 4.0)
@@ -87,7 +75,6 @@ GEM
8775
hashr (2.0.0)
8876
hike (1.2.3)
8977
hitimes (1.2.3)
90-
httpclient (2.7.0.1)
9178
i18n (0.7.0)
9279
jemalloc (1.0.1)
9380
jmespath (1.1.3)
@@ -127,11 +114,6 @@ GEM
127114
coderay (~> 1.1.0)
128115
method_source (~> 0.8.1)
129116
slop (~> 3.4)
130-
pusher (0.14.6)
131-
httpclient (~> 2.5)
132-
multi_json (~> 1.0)
133-
pusher-signature (~> 0.1.8)
134-
pusher-signature (0.1.8)
135117
rack (1.4.7)
136118
rack-cache (1.5.1)
137119
rack (>= 0.4)
@@ -202,19 +184,17 @@ DEPENDENCIES
202184
actionmailer (~> 3.2.18)
203185
aws-sdk
204186
foreman
205-
gh!
187+
gh
206188
guard
207189
guard-rspec
208190
jemalloc
209191
metriks
210192
metriks-librato_metrics
211193
mocha (~> 0.10.0)
212194
multi_json
213-
pusher (~> 0.14.5)
214195
redis-namespace
215196
roadie
216197
roadie-rails (~> 1.0)
217-
rollout!
218198
rspec (~> 2.14.0)
219199
sentry-raven
220200
sidekiq (~> 4.0.0)

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tasks: bundle exec je sidekiq -c 25 -r ./lib/travis/tasks.rb -q campfire -q email -q flowdock -q github_commit_status -q github_status -q hipchat -q irc -q pusher -q sqwiggle -q webhook -q slack -q pushover
1+
tasks: bundle exec je sidekiq -c 25 -r ./lib/travis/tasks.rb -q notifications -q campfire -q email -q flowdock -q github_commit_status -q github_status -q hipchat -q irc -q sqwiggle -q webhook -q slack -q pushover

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Travis Task is a [Sidekiq](http://sidekiq.org/) based background processor whose
55

66
These notifications are all queued up by state changes which are processed by [Travis Hub](https://github.com/travis-ci/travis-hub) and [Travis Gatekeeper](https://github.com/travis-ci/travis-gatekeeper).
77

8-
And, to make Travis Tasks even more special, there is no database connection required! Travis Tasks is all about talking to 3rd party services, if it be [Pusher](http://pusher.com), [Mandrill](https://mandrillapp.com), [Campfire](http://campfirenow.com/), [Slack](http://slack.com/), or [Pushover](https://pushover.net/).
8+
And, to make Travis Tasks even more special, there is no database connection required! Travis Tasks is all about talking to 3rd party services, if it be, [Mandrill](https://mandrillapp.com), [Campfire](http://campfirenow.com/), [Slack](http://slack.com/), or [Pushover](https://pushover.net/).
99

1010
You can find the full list of addon services Travis natively talks to within [Travis Core](https://github.com/travis-ci/travis-core/tree/master/lib/travis/addons).
1111

@@ -20,6 +20,3 @@ Please file any issues on the [central Travis CI issue tracker](https://github.c
2020
See LICENSE file.
2121

2222
Copyright (c) 2011 [Travis CI development team](https://github.com/travis-ci).
23-
24-
25-

lib/travis/addons.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module Addons
66
require 'travis/addons/github_status'
77
require 'travis/addons/hipchat'
88
require 'travis/addons/irc'
9-
require 'travis/addons/pusher'
109
require 'travis/addons/sqwiggle'
1110
require 'travis/addons/util'
1211
require 'travis/addons/webhook'

lib/travis/addons/README.markdown

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ The Addons are event handlers that accepts events such as "build finished" and f
88
- GitHub Commit Statuses
99
- Hipchat
1010
- IRC
11-
- Pusher: Used to update our Web UI automatically.
1211
- Sqwiggle
13-
- States cache: Caches the state of each branch in Memcached for status images.
1412
- Webhook
1513
- Pushover
1614

17-
To add a new notification service, an event handler and a task is needed. The event handler is run by [`travis-hub`](https://github.com/travis-ci/travis-hub) and has access to the database. This should check whether the event should be forwarded at all, and pull out any necessary configuration values. It should then asynchronously run the corresponding Task. The Task is run by [`travis-tasks`](https://github.com/travis-ci/travis-tasks) via Sidekiq and should do the actual API calls needed. The event handler should finish very quickly, while the task is allowed to take longer.
15+
To add a new notification service, an event handler and a task is needed. The event handler is run by [`travis-hub`](https://github.com/travis-ci/travis-hub) and has access to the database. This should check whether the event should be forwarded at all, and pull out any necessary configuration values. It should then asynchronously run the corresponding Task. The Task is run by [`travis-tasks`](https://github.com/travis-ci/travis-tasks) via Sidekiq and should do the actual API calls needed. The event handler should finish very quickly, while the task is allowed to take longer.

lib/travis/addons/email/task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def type
2323
def process
2424
if recipients.any?
2525
Mailer::Build.finished_email(payload, recipients, broadcasts).deliver
26-
info "status=sent msg='email sent' #{recipients.map { |r| 'email=' + obfuscate_email_address(r) }.join(' ')}"
26+
info "type=email status=sent msg='email sent' #{recipients.map { |r| 'email=' + obfuscate_email_address(r) }.join(' ')}"
2727
end
2828
rescue Net::SMTPServerBusy => e
2929
error("Could not send email to: #{recipients} (error: #{e.message})")

lib/travis/addons/github_status/task.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@ def process_with_token(token)
4949
GH.post(url, :state => state, :description => description, :target_url => target_url, :context => context)
5050
end
5151
rescue GH::Error(:response_status => 401)
52+
error("type=github_status build=#{build[:id]} repo=#{repository[:slug]} state=#{state} commit=#{sha} response_status=401 reason=incorrect_auth")
53+
nil
54+
rescue GH::Error(:response_status => 403)
55+
raise if Travis.config.env == 'production'
56+
rescue GH::Error(:response_status => 404)
57+
error("type=github_status build=#{build[:id]} repo=#{repository[:slug]} state=#{state} commit=#{sha} response_status=404 reason=repo_not_found_or_incorrect_auth")
5258
nil
5359
rescue GH::Error(:response_status => 422)
5460
error("type=github_status build=#{build[:id]} repo=#{repository[:slug]} state=#{state} commit=#{sha} response_status=422 reason=maximum_number_of_statuses")
5561
nil
5662
rescue GH::Error => e
5763
message = "type=github_status build=#{build[:id]} repo=#{repository[:slug]} error=not_updated commit=#{sha} url=#{GH.api_host + url} message=#{e.message}"
5864
error(message)
59-
response_status = e.info[:response_status]
60-
case response_status
61-
when 401, 422, 404
62-
else
63-
raise message
64-
end
65+
raise message
6566
end
6667

6768
def target_url
@@ -95,7 +96,7 @@ def http_options(token)
9596

9697
def headers
9798
{
98-
"Accept" => "application/vnd.github.she-hulk-preview+json"
99+
"Accept" => "application/vnd.github.v3+json"
99100
}
100101
end
101102
end

lib/travis/addons/pusher.rb

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/travis/addons/pusher/task.rb

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)