From 9588f816b0ab4b7acbccb711b61328cedc972a64 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Fri, 8 Jan 2016 14:31:49 +0100 Subject: [PATCH 01/46] do not require all of rack/contrib, it now assumes a git repository --- lib/travis/api/app.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index a2763fdd..71d7ab9c 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -9,7 +9,9 @@ require 'travis/support/amqp' require 'travis/states_cache' require 'rack' require 'rack/protection' -require 'rack/contrib' +require 'rack/contrib/config' +require 'rack/contrib/jsonp' +require 'rack/contrib/post_body_content_type_parser' require 'dalli' require 'memcachier' require 'rack/cache' From 7a5f477a0a0fd1794bf00abba4468f334c319173 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 12 Jan 2016 13:52:01 +0100 Subject: [PATCH 02/46] require raven/integrations/rack --- lib/travis/api/app.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 71d7ab9c..7216bcbe 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -20,6 +20,7 @@ require 'active_record' require 'redis' require 'gh' require 'raven' +require 'raven/integrations/rack' require 'sidekiq' require 'metriks/reporter/logger' require 'metriks/librato_metrics_reporter' From 3637061b762bdc2c0da0db0f2fbee4502f93c20a Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 12 Jan 2016 13:58:21 +0100 Subject: [PATCH 03/46] bump sentry-raven --- Gemfile | 2 +- Gemfile.lock | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 9334227c..c8eaf7f6 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: gem 'active_model_serializers' gem 'unicorn' -gem 'sentry-raven', github: 'getsentry/raven-ruby' +gem 'sentry-raven' gem 'yard-sinatra', github: 'rkh/yard-sinatra' gem 'rack-contrib', github: 'rack/rack-contrib' gem 'rack-cache', github: 'rtomayko/rack-cache' diff --git a/Gemfile.lock b/Gemfile.lock index 64aeb7c3..e456f646 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,14 +5,6 @@ GIT metriks-librato_metrics (1.0.2) metriks (>= 0.9.9.6) -GIT - remote: git://github.com/getsentry/raven-ruby.git - revision: 84392e5db701f0b5c66802aab9cc82ef9a5ad830 - specs: - sentry-raven (0.10.1) - faraday (>= 0.7.6) - uuidtools - GIT remote: git://github.com/rack/rack-contrib.git revision: 1b11346d729efd88b274cd7f704e0bca9eb3de7a @@ -171,7 +163,7 @@ GEM erubis (2.7.0) factory_girl (2.4.2) activesupport - faraday (0.9.1) + faraday (0.9.2) multipart-post (>= 1.2, < 3) ffi (1.9.6) foreman (0.64.0) @@ -269,6 +261,8 @@ GEM rspec-expectations (2.99.2) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.99.2) + sentry-raven (0.15.3) + faraday (>= 0.7.6) sidekiq (3.3.0) celluloid (>= 0.16.0) connection_pool (>= 2.0.0) @@ -321,7 +315,6 @@ GEM rack raindrops (~> 0.7) useragent (0.13.3) - uuidtools (2.1.5) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -355,7 +348,7 @@ DEPENDENCIES rerun rspec (~> 2.13) s3! - sentry-raven! + sentry-raven simplecov sinatra sinatra-contrib From 67d1d0956956868260b76b8aec16af6d0764e2b1 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Sun, 24 Jan 2016 23:55:38 +0100 Subject: [PATCH 04/46] use travis-amqp --- Gemfile | 1 + Gemfile.lock | 7 +++++++ lib/travis/api/app.rb | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index c8eaf7f6..2074c33b 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 's3', github: 'travis-ci/s3' gem 'travis-core', github: 'travis-ci/travis-core' gem 'travis-support', github: 'travis-ci/travis-support' +gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil gem 'travis-yaml', github: 'travis-ci/travis-yaml' diff --git a/Gemfile.lock b/Gemfile.lock index e456f646..0ef58701 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,12 @@ GIT s3 (0.3.21) proxies (~> 0.2.0) +GIT + remote: git://github.com/travis-ci/travis-amqp.git + revision: c388299757b7eda2cc0e33cdc7d90113cf283e6a + specs: + travis-amqp (0.0.1) + GIT remote: git://github.com/travis-ci/travis-core.git revision: 21793fc8b01f965b93cf98b7ab1458ee359a5a62 @@ -354,6 +360,7 @@ DEPENDENCIES sinatra-contrib skylight (~> 0.6.0.beta.1) stackprof + travis-amqp! travis-api! travis-config (~> 0.1.0) travis-core! diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 7216bcbe..bb34c61a 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -4,8 +4,8 @@ require 'active_record_postgres_variables' # now actually load travis require 'travis' +require 'travis/amqp' require 'travis/model' -require 'travis/support/amqp' require 'travis/states_cache' require 'rack' require 'rack/protection' @@ -179,7 +179,7 @@ module Travis::Api def self.setup_travis Travis::Async.enabled = true - Travis::Amqp.config = Travis.config.amqp + Travis::Amqp.setup(Travis.config.amqp) setup_database_connections From 197120a9eb68c8a629f05979a7f1d44050bc7b3c Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 22 Mar 2016 12:09:33 +0100 Subject: [PATCH 05/46] add buildpack url --- .buildpacks | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildpacks b/.buildpacks index 36201cad..08c5a04b 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,3 +1,4 @@ +https://github.com/ddollar/heroku-buildpack-multi https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git From 48880ad1843fc5ab37e36fd2dbbf187d1b9720d4 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 22 Mar 2016 12:27:10 +0100 Subject: [PATCH 06/46] Revert "add buildpack url" This reverts commit 197120a9eb68c8a629f05979a7f1d44050bc7b3c. --- .buildpacks | 1 - 1 file changed, 1 deletion(-) diff --git a/.buildpacks b/.buildpacks index 08c5a04b..36201cad 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,4 +1,3 @@ -https://github.com/ddollar/heroku-buildpack-multi https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git From b552544d190d49fa1f985a9d16cd9a58915f6d3e Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 22 Mar 2016 12:27:34 +0100 Subject: [PATCH 07/46] revert --- .buildpacks | 1 - 1 file changed, 1 deletion(-) diff --git a/.buildpacks b/.buildpacks index 08c5a04b..36201cad 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,4 +1,3 @@ -https://github.com/ddollar/heroku-buildpack-multi https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git From 71813bf92a67dd43a141a4f327a80e2ff6ed6692 Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 22 Mar 2016 12:35:28 +0100 Subject: [PATCH 08/46] move travis-migrations into main group --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index bf2e564b..9c08569e 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,7 @@ gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-config', '~> 0.1.0' gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil gem 'travis-yaml', github: 'travis-ci/travis-yaml' +gem 'travis-migrations', github: 'travis-ci/travis-migrations' gem 'mustermann', github: 'rkh/mustermann' gem 'sinatra' gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: nil @@ -41,7 +42,6 @@ group :test do gem 'factory_girl', '~> 2.4.0' gem 'mocha', '~> 0.12' gem 'database_cleaner', '~> 0.8.0' - gem 'travis-migrations', github: 'travis-ci/travis-migrations' end group :development do From 82b8512f413bcc61ee15cb2c1f2cd5b5100835b3 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Fri, 8 Jan 2016 14:31:49 +0100 Subject: [PATCH 09/46] do not require all of rack/contrib, it now assumes a git repository --- lib/travis/api/app.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 6b72b8ce..482e3b7e 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -9,7 +9,9 @@ require 'travis/support/amqp' require 'travis/states_cache' require 'rack' require 'rack/protection' -require 'rack/contrib' +require 'rack/contrib/config' +require 'rack/contrib/jsonp' +require 'rack/contrib/post_body_content_type_parser' require 'dalli' require 'memcachier' require 'rack/cache' From ba0e43c75a55b0f7dbf1d452050c73cfe2aeff1a Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 12 Jan 2016 13:52:01 +0100 Subject: [PATCH 10/46] require raven/integrations/rack --- lib/travis/api/app.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 482e3b7e..b476333c 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -20,6 +20,7 @@ require 'active_record' require 'redis' require 'gh' require 'raven' +require 'raven/integrations/rack' require 'sidekiq' require 'metriks/reporter/logger' require 'metriks/librato_metrics_reporter' From 1e69683c3cf73dd6d0f78a3edddffaa3f49c11d7 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Tue, 12 Jan 2016 13:58:21 +0100 Subject: [PATCH 11/46] bump sentry-raven --- Gemfile | 2 +- Gemfile.lock | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index bf2e564b..b8481a0b 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: gem 'active_model_serializers' gem 'unicorn' -gem 'sentry-raven', github: 'getsentry/raven-ruby' +gem 'sentry-raven' gem 'yard-sinatra', github: 'rkh/yard-sinatra' gem 'rack-contrib', github: 'rack/rack-contrib' gem 'rack-cache', github: 'rtomayko/rack-cache' diff --git a/Gemfile.lock b/Gemfile.lock index f4305853..327385fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,14 +5,6 @@ GIT metriks-librato_metrics (1.0.2) metriks (>= 0.9.9.6) -GIT - remote: git://github.com/getsentry/raven-ruby.git - revision: 84392e5db701f0b5c66802aab9cc82ef9a5ad830 - specs: - sentry-raven (0.10.1) - faraday (>= 0.7.6) - uuidtools - GIT remote: git://github.com/rack/rack-contrib.git revision: 1b11346d729efd88b274cd7f704e0bca9eb3de7a @@ -286,6 +278,8 @@ GEM rspec-core (>= 2.99.0.beta1) rspec-expectations (>= 2.99.0.beta1) rspec-mocks (2.99.2) + sentry-raven (0.15.3) + faraday (>= 0.7.6) sidekiq (3.3.0) celluloid (>= 0.16.0) connection_pool (>= 2.0.0) @@ -337,7 +331,6 @@ GEM rack raindrops (~> 0.7) useragent (0.13.3) - uuidtools (2.1.5) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -373,7 +366,7 @@ DEPENDENCIES rspec (~> 2.13) rspec-its s3! - sentry-raven! + sentry-raven simplecov sinatra sinatra-contrib From 1af7cd5f450bcfc3ff7c9524314c30e1d06307fe Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Sun, 24 Jan 2016 23:55:38 +0100 Subject: [PATCH 12/46] use travis-amqp --- Gemfile | 1 + Gemfile.lock | 7 +++++++ lib/travis/api/app.rb | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index b8481a0b..c296671d 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 's3', github: 'travis-ci/s3' gem 'travis-core', github: 'travis-ci/travis-core' gem 'travis-support', github: 'travis-ci/travis-support' +gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil gem 'travis-yaml', github: 'travis-ci/travis-yaml' diff --git a/Gemfile.lock b/Gemfile.lock index 327385fc..2dd61f90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,12 @@ GIT s3 (0.3.21) proxies (~> 0.2.0) +GIT + remote: git://github.com/travis-ci/travis-amqp.git + revision: c388299757b7eda2cc0e33cdc7d90113cf283e6a + specs: + travis-amqp (0.0.1) + GIT remote: git://github.com/travis-ci/travis-core.git revision: f7b3a76b3f39c28bb5cf7b9dc24acec13908a11a @@ -372,6 +378,7 @@ DEPENDENCIES sinatra-contrib skylight (~> 0.6.0.beta.1) stackprof + travis-amqp! travis-api! travis-config (~> 0.1.0) travis-core! diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index b476333c..7fe1a6b7 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -4,8 +4,8 @@ require 'active_record_postgres_variables' # now actually load travis require 'travis' +require 'travis/amqp' require 'travis/model' -require 'travis/support/amqp' require 'travis/states_cache' require 'rack' require 'rack/protection' @@ -181,7 +181,7 @@ module Travis::Api def self.setup_travis Travis::Async.enabled = true - Travis::Amqp.config = Travis.config.amqp + Travis::Amqp.setup(Travis.config.amqp) setup_database_connections From 1dd8b6aec57741dba6a90f6470714ebe6ca15f7a Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 22 Mar 2016 12:09:33 +0100 Subject: [PATCH 13/46] add buildpack url --- .buildpacks | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildpacks b/.buildpacks index 36201cad..08c5a04b 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,3 +1,4 @@ +https://github.com/ddollar/heroku-buildpack-multi https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git From 5af88d005c0a40a6adcfa321ab36ae2f87d91d81 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 22 Mar 2016 12:27:10 +0100 Subject: [PATCH 14/46] Revert "add buildpack url" This reverts commit 197120a9eb68c8a629f05979a7f1d44050bc7b3c. --- .buildpacks | 1 - 1 file changed, 1 deletion(-) diff --git a/.buildpacks b/.buildpacks index 08c5a04b..36201cad 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,4 +1,3 @@ -https://github.com/ddollar/heroku-buildpack-multi https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/drogus/last-commit-sha-buildpack.git https://github.com/ryandotsmith/nginx-buildpack.git From 8085710646ddd3dc6f9b7a410cd277969b96e1d2 Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 22 Mar 2016 12:35:28 +0100 Subject: [PATCH 15/46] move travis-migrations into main group --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c296671d..9cef1b4c 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil gem 'travis-yaml', github: 'travis-ci/travis-yaml' +gem 'travis-migrations', github: 'travis-ci/travis-migrations' gem 'mustermann', github: 'rkh/mustermann' gem 'sinatra' gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: nil @@ -42,7 +43,6 @@ group :test do gem 'factory_girl', '~> 2.4.0' gem 'mocha', '~> 0.12' gem 'database_cleaner', '~> 0.8.0' - gem 'travis-migrations', github: 'travis-ci/travis-migrations' end group :development do From f8bee8f80106e3cf12de7239e505948debf24453 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 23 Mar 2016 13:13:22 +0100 Subject: [PATCH 16/46] clean up rakefile, update gemspec --- Rakefile | 41 +++++++--------- travis-api.gemspec | 116 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 113 insertions(+), 44 deletions(-) diff --git a/Rakefile b/Rakefile index 93c7d171..9fc70650 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,3 @@ -require 'rake' -require 'travis/migrations' - -task default: :spec - namespace :db do if ENV["RAILS_ENV"] == 'test' desc 'Create and migrate the test database' @@ -21,25 +16,25 @@ end desc "generate gemspec" task 'travis-api.gemspec' do - content = File.read 'travis-api.gemspec' + content = File.read 'travis-api.gemspec' - fields = { - authors: `git shortlog -sn`.scan(/[^\d\s].*/), - email: `git shortlog -sne`.scan(/[^<]+@[^>]+/), - files: `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ } - } + fields = { + authors: `git shortlog -sn`.scan(/[^\d\s].*/), + email: `git shortlog -sne`.scan(/[^<]+@[^>]+/), + files: `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ } + } - fields.each do |field, values| - updated = " s.#{field} = [" - updated << values.map { |v| "\n %p" % v }.join(',') - updated << "\n ]" - content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated) - end + fields.each do |field, values| + updated = " s.#{field} = [" + updated << values.map { |v| "\n %p" % v }.join(',') + updated << "\n ]" + content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated) + end - File.open('travis-api.gemspec', 'w') { |f| f << content } - end + File.open('travis-api.gemspec', 'w') { |f| f << content } +end +task default: 'travis-api.gemspec' - task default: 'travis-api.gemspec' - - tasks_path = File.expand_path('../lib/tasks/*.rake', __FILE__) - Dir.glob(tasks_path).each { |r| import r } +## can this be removed? what other rakefiles need to be included? +# tasks_path = File.expand_path('../lib/tasks/*.rake', __FILE__) +# Dir.glob(tasks_path).each { |r| import r } diff --git a/travis-api.gemspec b/travis-api.gemspec index 92ee8839..472324a1 100644 --- a/travis-api.gemspec +++ b/travis-api.gemspec @@ -11,75 +11,85 @@ Gem::Specification.new do |s| s.authors = [ "Konstantin Haase", "Piotr Sarnacki", + "carlad", "Sven Fuchs", "Hiro Asari", "Mathias Meyer", "Josh Kalderimis", "Henrik Hodne", - "carlad", "Tyranja", - "Andre Arko", "Dan Buch", + "Andre Arko", "C. Scott Ananian", "Erik Michaels-Ober", "Brian Ford", + "Lisa P", "Steve Richert", + "Bryan Goldstein", + "Dan Rice", + "James Dennes", + "María de Antón", + "Nick Schonning", + "Patrick Williams", "Puneeth Chaganti", "Thais Camilo and Konstantin Haase", "Tim Carey-Smith", - "Bryan Goldstein", "Zachary Scott", - "James Dennes", - "rainsun", - "Nick Schonning", - "Patrick Williams", - "Dan Rice" + "rainsun" ] s.email = [ "konstantin.mailinglists@googlemail.com", "drogus@gmail.com", "me@svenfuchs.com", + "carla@travis-ci.com", "asari.ruby@gmail.com", "meyer@paperplanes.de", "josh.kalderimis@gmail.com", "me@henrikhodne.com", + "carlad@users.noreply.github.com", "henrik@hodne.io", - "konstantin.haase@gmail.com", "carla@travis-ci.org", + "konstantin.haase@gmail.com", "tyranja@cassiopeia.uberspace.de", "andre@arko.net", - "svenfuchs@artweb-design.de", "dan@travis-ci.org", - "sferik@gmail.com", + "svenfuchs@artweb-design.de", "cscott@cscott.net", - "henrik@travis-ci.com", - "steve.richert@gmail.com", + "sferik@gmail.com", "bford@engineyard.com", + "henrik@travis-ci.com", + "mail@lislis.de", + "steve.richert@gmail.com", + "brysgo@gmail.com", + "dan@meatballhat.com", + "dan@zoombody.com", + "jdennes@gmail.com", + "MariadeAnton@users.noreply.github.com", + "nschonni@gmail.com", "patrick@bittorrent.com", "punchagan@muse-amuse.in", - "carlad@users.noreply.github.com", - "dan@zoombody.com", - "rainsuner@gmail.com", "dev+narwen+rkh@rkh.im", "tim@spork.in", - "brysgo@gmail.com", "e@zzak.io", - "jdennes@gmail.com", - "nschonni@gmail.com", - "dan@meatballhat.com" + "rainsuner@gmail.com" ] s.files = [ "CONTRIBUTING.md", + "LICENSE", "Procfile", "README.md", "Rakefile", "bin/start-nginx", "config.ru", "config/database.yml", + "config/mime.types", + "config/nginx.conf.erb", "config/puma-config.rb", + "config/ruby_config.sh", "config/unicorn.rb", + "lib/active_record_postgres_variables.rb", "lib/conditional_skylight.rb", "lib/tasks/build_update_branch.rake", "lib/tasks/build_update_pull_request_data.rake", @@ -141,6 +151,7 @@ Gem::Specification.new do |s| "lib/travis/api/app/responders/xml.rb", "lib/travis/api/app/services/schedule_request.rb", "lib/travis/api/app/stack_instrumentation.rb", + "lib/travis/api/attack.rb", "lib/travis/api/instruments.rb", "lib/travis/api/serializer.rb", "lib/travis/api/v2.rb", @@ -184,6 +195,7 @@ Gem::Specification.new do |s| "lib/travis/api/v3/extensions/encrypted_column.rb", "lib/travis/api/v3/features.rb", "lib/travis/api/v3/github.rb", + "lib/travis/api/v3/metrics.rb", "lib/travis/api/v3/model.rb", "lib/travis/api/v3/models.rb", "lib/travis/api/v3/models/account.rb", @@ -201,14 +213,30 @@ Gem::Specification.new do |s| "lib/travis/api/v3/models/repository.rb", "lib/travis/api/v3/models/request.rb", "lib/travis/api/v3/models/ssl_key.rb", + "lib/travis/api/v3/models/star.rb", "lib/travis/api/v3/models/subscription.rb", "lib/travis/api/v3/models/token.rb", "lib/travis/api/v3/models/user.rb", "lib/travis/api/v3/opt_in.rb", + "lib/travis/api/v3/paginator.rb", + "lib/travis/api/v3/paginator/url_generator.rb", + "lib/travis/api/v3/permissions.rb", + "lib/travis/api/v3/permissions/account.rb", + "lib/travis/api/v3/permissions/build.rb", + "lib/travis/api/v3/permissions/generic.rb", + "lib/travis/api/v3/permissions/job.rb", + "lib/travis/api/v3/permissions/organization.rb", + "lib/travis/api/v3/permissions/repository.rb", + "lib/travis/api/v3/permissions/user.rb", "lib/travis/api/v3/queries.rb", "lib/travis/api/v3/queries/accounts.rb", "lib/travis/api/v3/queries/branch.rb", + "lib/travis/api/v3/queries/branches.rb", + "lib/travis/api/v3/queries/broadcasts.rb", "lib/travis/api/v3/queries/build.rb", + "lib/travis/api/v3/queries/builds.rb", + "lib/travis/api/v3/queries/job.rb", + "lib/travis/api/v3/queries/jobs.rb", "lib/travis/api/v3/queries/organization.rb", "lib/travis/api/v3/queries/organizations.rb", "lib/travis/api/v3/queries/owner.rb", @@ -224,15 +252,24 @@ Gem::Specification.new do |s| "lib/travis/api/v3/renderer/accounts.rb", "lib/travis/api/v3/renderer/avatar_url.rb", "lib/travis/api/v3/renderer/branch.rb", + "lib/travis/api/v3/renderer/branches.rb", + "lib/travis/api/v3/renderer/broadcast.rb", + "lib/travis/api/v3/renderer/broadcasts.rb", "lib/travis/api/v3/renderer/build.rb", + "lib/travis/api/v3/renderer/builds.rb", "lib/travis/api/v3/renderer/collection_renderer.rb", + "lib/travis/api/v3/renderer/commit.rb", "lib/travis/api/v3/renderer/error.rb", + "lib/travis/api/v3/renderer/job.rb", + "lib/travis/api/v3/renderer/jobs.rb", + "lib/travis/api/v3/renderer/lint.rb", "lib/travis/api/v3/renderer/model_renderer.rb", "lib/travis/api/v3/renderer/organization.rb", "lib/travis/api/v3/renderer/organizations.rb", "lib/travis/api/v3/renderer/owner.rb", "lib/travis/api/v3/renderer/repositories.rb", "lib/travis/api/v3/renderer/repository.rb", + "lib/travis/api/v3/renderer/request.rb", "lib/travis/api/v3/renderer/requests.rb", "lib/travis/api/v3/renderer/user.rb", "lib/travis/api/v3/result.rb", @@ -245,19 +282,34 @@ Gem::Specification.new do |s| "lib/travis/api/v3/services.rb", "lib/travis/api/v3/services/accounts/for_current_user.rb", "lib/travis/api/v3/services/branch/find.rb", + "lib/travis/api/v3/services/branches/find.rb", + "lib/travis/api/v3/services/broadcasts/for_current_user.rb", + "lib/travis/api/v3/services/build/cancel.rb", "lib/travis/api/v3/services/build/find.rb", + "lib/travis/api/v3/services/build/restart.rb", + "lib/travis/api/v3/services/builds/find.rb", + "lib/travis/api/v3/services/job/cancel.rb", + "lib/travis/api/v3/services/job/debug.rb", + "lib/travis/api/v3/services/job/find.rb", + "lib/travis/api/v3/services/job/restart.rb", + "lib/travis/api/v3/services/jobs/find.rb", + "lib/travis/api/v3/services/lint/lint.rb", "lib/travis/api/v3/services/organization/find.rb", "lib/travis/api/v3/services/organization/sync.rb", "lib/travis/api/v3/services/organizations/for_current_user.rb", "lib/travis/api/v3/services/owner/find.rb", "lib/travis/api/v3/services/repositories/for_current_user.rb", + "lib/travis/api/v3/services/repositories/for_owner.rb", "lib/travis/api/v3/services/repository/disable.rb", "lib/travis/api/v3/services/repository/enable.rb", "lib/travis/api/v3/services/repository/find.rb", + "lib/travis/api/v3/services/repository/star.rb", + "lib/travis/api/v3/services/repository/unstar.rb", "lib/travis/api/v3/services/requests/create.rb", "lib/travis/api/v3/services/requests/find.rb", "lib/travis/api/v3/services/user/current.rb", "lib/travis/api/v3/services/user/find.rb", + "lib/travis/api/v3/services/user/sync.rb", "lib/travis/api/workers/build_cancellation.rb", "lib/travis/api/workers/build_restart.rb", "lib/travis/api/workers/job_cancellation.rb", @@ -280,6 +332,8 @@ Gem::Specification.new do |s| "script/console", "script/repos_stats.rb", "script/server", + "script/web_concurrency", + "spec/active_record_postgres_variables_spec.rb", "spec/integration/error_handling_spec.rb", "spec/integration/formats_handling_spec.rb", "spec/integration/responders_spec.rb", @@ -344,7 +398,7 @@ Gem::Specification.new do |s| "spec/unit/endpoint/lint_spec.rb", "spec/unit/endpoint/logs_spec.rb", "spec/unit/endpoint/repos_spec.rb", - "spec/unit/endpoint/requests_spec.rb", + "spec/unit/endpoint/requests/throttle_spec.rb", "spec/unit/endpoint/users_spec.rb", "spec/unit/endpoint_spec.rb", "spec/unit/extensions/expose_pattern_spec.rb", @@ -358,20 +412,40 @@ Gem::Specification.new do |s| "spec/unit/middleware/user_agent_tracker_spec.rb", "spec/unit/responders/json_spec.rb", "spec/unit/responders/service_spec.rb", + "spec/v3/error_handling_spec.rb", "spec/v3/extensions/belongs_to_spec.rb", + "spec/v3/metrics_spec.rb", "spec/v3/renderer/avatar_url_spec.rb", "spec/v3/result_spec.rb", "spec/v3/service_index_spec.rb", "spec/v3/services/accounts/for_current_user_spec.rb", "spec/v3/services/branch/find_spec.rb", + "spec/v3/services/branches/find_spec.rb", + "spec/v3/services/broadcasts/for_current_user_spec.rb", + "spec/v3/services/build/cancel_spec.rb", + "spec/v3/services/build/find_spec.rb", + "spec/v3/services/build/restart_spec.rb", + "spec/v3/services/builds/find_spec.rb", + "spec/v3/services/job/cancel_spec.rb", + "spec/v3/services/job/debug_sepc.rb", + "spec/v3/services/job/find_spec.rb", + "spec/v3/services/job/restart_spec.rb", + "spec/v3/services/jobs/find_spec.rb", + "spec/v3/services/lint/lint_spec.rb", "spec/v3/services/organization/find_spec.rb", "spec/v3/services/organizations/for_current_user_spec.rb", "spec/v3/services/owner/find_spec.rb", "spec/v3/services/repositories/for_current_user_spec.rb", + "spec/v3/services/repositories/for_owner_spec.rb", + "spec/v3/services/repository/disable_spec.rb", + "spec/v3/services/repository/enable_spec.rb", "spec/v3/services/repository/find_spec.rb", + "spec/v3/services/repository/star_spec.rb", + "spec/v3/services/repository/unstar_spec.rb", "spec/v3/services/requests/create_spec.rb", "spec/v3/services/user/current_spec.rb", "spec/v3/services/user/find_spec.rb", + "spec/v3/services/user/sync_spec.rb", "tmp/.gitkeep", "travis-api.gemspec" ] From dd82c14f5b1e3d71e55771374925d5439a7b2f4f Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 23 Mar 2016 14:09:29 +0100 Subject: [PATCH 17/46] refactor db create, move migrations into dev/test group --- Gemfile | 5 ++++- Rakefile | 17 +++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 9cef1b4c..da99c923 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,6 @@ gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil gem 'travis-yaml', github: 'travis-ci/travis-yaml' -gem 'travis-migrations', github: 'travis-ci/travis-migrations' gem 'mustermann', github: 'rkh/mustermann' gem 'sinatra' gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: nil @@ -37,6 +36,10 @@ gem 'stackprof' gem 'jemalloc' gem 'customerio' +group :development, :test do + gem 'travis-migrations', github: 'travis-ci/travis-migrations' +end + group :test do gem 'rspec', '~> 2.13' gem 'rspec-its' diff --git a/Rakefile b/Rakefile index 9fc70650..d9cb1796 100644 --- a/Rakefile +++ b/Rakefile @@ -1,16 +1,9 @@ namespace :db do - if ENV["RAILS_ENV"] == 'test' - desc 'Create and migrate the test database' - task :create do - sh 'createdb travis_test' rescue nil - sh "psql -q travis_test < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" - end - else - desc 'Create and migrate the development database' - task :create do - sh 'createdb travis_development' rescue nil - sh "psql -q travis_development < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" - end + env = ENV["RAILS_ENV"] + desc "Create and migrate the #{env} database" + task :create do + sh "createdb travis_pro_#{env}" rescue nil + sh "psql -q travis_pro_#{env} < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" end end From 1d6ed1e3648b05db931c4b2492eee156eefc745d Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 23 Mar 2016 14:16:48 +0100 Subject: [PATCH 18/46] fix incorrect db name --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index d9cb1796..f1cee930 100644 --- a/Rakefile +++ b/Rakefile @@ -2,8 +2,8 @@ namespace :db do env = ENV["RAILS_ENV"] desc "Create and migrate the #{env} database" task :create do - sh "createdb travis_pro_#{env}" rescue nil - sh "psql -q travis_pro_#{env} < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" + sh "createdb travis_#{env}" rescue nil + sh "psql -q travis_#{env} < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" end end From 2db04f068cfbe441d5ced9d1ede800d1aa3c515a Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Wed, 23 Mar 2016 14:42:39 +0100 Subject: [PATCH 19/46] unsmart loading app extensions --- lib/travis/api/app/extensions.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/travis/api/app/extensions.rb b/lib/travis/api/app/extensions.rb index d7faa8fe..f6bb9c2e 100644 --- a/lib/travis/api/app/extensions.rb +++ b/lib/travis/api/app/extensions.rb @@ -1,8 +1,4 @@ -require 'travis/api/app' - -class Travis::Api::App - # Namespace for Sinatra extensions. - module Extensions - Dir.glob("#{__dir__}/extensions/*.rb").each { |f| require f[%r[(?<=lib/).+(?=\.rb$)]] } - end -end +require 'travis/api/app/extensions/expose_pattern' +require 'travis/api/app/extensions/scoping' +require 'travis/api/app/extensions/smart_constants' +require 'travis/api/app/extensions/subclass_tracker' From 30b8f2d772fabb619f8af7b87fb70188bc919a55 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Thu, 24 Mar 2016 12:53:57 +0100 Subject: [PATCH 20/46] unsmart requiring helpers --- Gemfile.lock | 3 --- lib/travis/api/app/helpers.rb | 13 ++++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2dd61f90..7f9f612b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -388,6 +388,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.11.2 diff --git a/lib/travis/api/app/helpers.rb b/lib/travis/api/app/helpers.rb index e09bbd8f..9612a43b 100644 --- a/lib/travis/api/app/helpers.rb +++ b/lib/travis/api/app/helpers.rb @@ -1,8 +1,7 @@ require 'travis/api/app' - -class Travis::Api::App - # Namespace for helpers. - module Helpers - Dir.glob("#{__dir__}/helpers/*.rb").each { |f| require f[%r[(?<=lib/).+(?=\.rb$)]] } - end -end +require 'travis/api/app/helpers/accept' +require 'travis/api/app/helpers/current_user' +require 'travis/api/app/helpers/db_follower' +require 'travis/api/app/helpers/flash' +require 'travis/api/app/helpers/mime_types' +require 'travis/api/app/helpers/respond_with' From aa211be12a3be72cd055ee25e89c68023adac873 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 24 Mar 2016 13:39:41 +0100 Subject: [PATCH 21/46] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f6aaee5..5ae72505 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This is the app running on https://api.travis-ci.org/ ### Database setup -NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name for development is hardcoded to `travis-development`. If you are using a different configuration you will have to make your own adjustments. +NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is conigured according to the RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. 1. `bundle exec rake db:create` 2. for testing 'RAILS_ENV=test bundle exec rake db:create --trace' From bcdd15f4cfa1f9593157908b1a61c99c19ef4765 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 24 Mar 2016 13:41:27 +0100 Subject: [PATCH 22/46] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ae72505..7dc23457 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This is the app running on https://api.travis-ci.org/ ### Database setup -NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is conigured according to the RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. +NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is configured according to the RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. 1. `bundle exec rake db:create` 2. for testing 'RAILS_ENV=test bundle exec rake db:create --trace' From 75937e45ee6f86bcfbe515fa2654c2ff19cf9b0a Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Thu, 24 Mar 2016 17:03:55 +0100 Subject: [PATCH 23/46] Remove load_endpoints, too --- lib/travis/api/app.rb | 8 ++------ lib/travis/api/app/base.rb | 4 +++- lib/travis/api/app/endpoint.rb | 23 ++++++++++++++++++++++- lib/travis/api/app/middleware.rb | 6 ++++++ 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 7fe1a6b7..624b3fc7 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -26,6 +26,8 @@ require 'metriks/reporter/logger' require 'metriks/librato_metrics_reporter' require 'travis/support/log_subscriber/active_record_metrics' require 'fileutils' +require 'travis/api/app/endpoint' +require 'travis/api/app/middleware' require 'travis/api/instruments' require 'travis/api/v2/http' require 'travis/api/v3' @@ -174,7 +176,6 @@ module Travis::Api def self.setup! setup_travis - load_endpoints setup_endpoints @setup = true end @@ -217,11 +218,6 @@ module Travis::Api Travis::Metrics.setup end - def self.load_endpoints - Dir.glob("#{__dir__}/app/middleware/*.rb").each { |f| require f[%r[(?<=lib/).+(?=\.rb$)]] } - Dir.glob("#{__dir__}/app/endpoint/*.rb").each { |f| require f[%r[(?<=lib/).+(?=\.rb$)]] } - end - def self.setup_endpoints Base.subclasses.each(&:setup) end diff --git a/lib/travis/api/app/base.rb b/lib/travis/api/app/base.rb index 1f5f4570..51e4e253 100644 --- a/lib/travis/api/app/base.rb +++ b/lib/travis/api/app/base.rb @@ -1,6 +1,8 @@ -require 'travis/api/app' require 'sinatra/base' require 'mustermann' +require 'travis/api/app' +require 'travis/api/app/extensions' +require 'travis/api/app/helpers' class Travis::Api::App # Superclass for any endpoint and middleware. diff --git a/lib/travis/api/app/endpoint.rb b/lib/travis/api/app/endpoint.rb index c4ef62f1..29323b3c 100644 --- a/lib/travis/api/app/endpoint.rb +++ b/lib/travis/api/app/endpoint.rb @@ -1,6 +1,7 @@ -require 'travis/api/app' require 'addressable/uri' require 'active_record/base' +require 'travis/api/app' +require 'travis/api/app/base' class Travis::Api::App # Superclass for HTTP endpoints. Takes care of prefixing. @@ -48,3 +49,23 @@ class Travis::Api::App end end end + +require 'travis/api/app/endpoint/accounts' +require 'travis/api/app/endpoint/authorization' +require 'travis/api/app/endpoint/branches' +require 'travis/api/app/endpoint/broadcasts' +require 'travis/api/app/endpoint/builds' +require 'travis/api/app/endpoint/documentation' +require 'travis/api/app/endpoint/endpoints' +require 'travis/api/app/endpoint/env_vars' +require 'travis/api/app/endpoint/home' +require 'travis/api/app/endpoint/hooks' +require 'travis/api/app/endpoint/jobs' +require 'travis/api/app/endpoint/lint' +require 'travis/api/app/endpoint/logs' +require 'travis/api/app/endpoint/repos' +require 'travis/api/app/endpoint/requests' +require 'travis/api/app/endpoint/setting_endpoint' +require 'travis/api/app/endpoint/singleton_settings_endpoint' +require 'travis/api/app/endpoint/uptime' +require 'travis/api/app/endpoint/users' diff --git a/lib/travis/api/app/middleware.rb b/lib/travis/api/app/middleware.rb index 619db9d6..8cdde661 100644 --- a/lib/travis/api/app/middleware.rb +++ b/lib/travis/api/app/middleware.rb @@ -3,5 +3,11 @@ require 'travis/api/app' class Travis::Api::App # Superclass for all middleware. class Middleware < Base + require 'travis/api/app/middleware/logging' + require 'travis/api/app/middleware/metriks' + require 'travis/api/app/middleware/rewrite' + require 'travis/api/app/middleware/scope_check' + require 'travis/api/app/middleware/skylight' + require 'travis/api/app/middleware/user_agent_tracker' end end From 1dd47df6bfcc8c640bfa701df7c4108c26539270 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 30 Mar 2016 12:18:05 +0200 Subject: [PATCH 24/46] add better condition check for rake --- Rakefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 5d4cd585..0b13d449 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,11 @@ namespace :db do env = ENV["RAILS_ENV"] - fail "Cannot run rake db:create in production." if env == 'production' - desc "Create and migrate the #{env} database" - task :create do - sh "createdb travis_#{env}" rescue nil - sh "psql -q travis_#{env} < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" + if env != 'production' + desc "Create and migrate the #{env} database" + task :create do + sh "createdb travis_#{env}" rescue nil + sh "psql -q travis_#{env} < #{Gem.loaded_specs['travis-migrations'].full_gem_path}/db/structure.sql" + end end end From d1848ba6f916f5afd6142960082a863f9005c3e9 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 30 Mar 2016 12:30:26 +0200 Subject: [PATCH 25/46] make settings visible in repository --- lib/travis/api/v3/models/repository.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/travis/api/v3/models/repository.rb b/lib/travis/api/v3/models/repository.rb index ed35b5a2..22c26d71 100644 --- a/lib/travis/api/v3/models/repository.rb +++ b/lib/travis/api/v3/models/repository.rb @@ -62,5 +62,9 @@ module Travis::API::V3 __send__(name, *args, &block) end + + def settings + @settings ||= JSON.load(super) + end end end From 2f870e6826feb876e4b852e15b47fe6e06ebb2c8 Mon Sep 17 00:00:00 2001 From: Tyranja Date: Wed, 30 Mar 2016 16:35:34 +0200 Subject: [PATCH 26/46] Bump travis-core --- Gemfile | 2 +- Gemfile.lock | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index da99c923..cf09b3c1 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core' +gem 'travis-core', github: 'travis-ci/travis-core', ref: 'sf-ar-te' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 7f9f612b..665485d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,8 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: f7b3a76b3f39c28bb5cf7b9dc24acec13908a11a + revision: fdcd69981dc9ccb6f85452213d8bdc096f4308be + ref: sf-ar-te specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -56,7 +57,7 @@ GIT coder (~> 0.4.0) data_migrations (~> 0.0.1) gh - hashr (~> 0.0.19) + hashr metriks (~> 0.9.7) multi_json pusher (~> 0.14.0) @@ -331,7 +332,7 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.47) + tzinfo (0.3.48) unicorn (4.8.3) kgio (~> 2.6) rack @@ -388,3 +389,6 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! + +BUNDLED WITH + 1.12.0.pre.1 From 49a6bb5d265870c93351b48bb339e8a9bad7bef5 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 31 Mar 2016 15:51:44 +0200 Subject: [PATCH 27/46] add debug to see what request contains --- lib/travis/api/attack.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/travis/api/attack.rb b/lib/travis/api/attack.rb index 17fcd44a..fbec755d 100644 --- a/lib/travis/api/attack.rb +++ b/lib/travis/api/attack.rb @@ -50,19 +50,22 @@ class Rack::Attack # Ban time: 5 hours # Ban after: 10 POST requests within five minutes to /auth/github blacklist('hammering /auth/github') do |request| - Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 2, findtime: 5.minutes, bantime: bantime(5.hours)) do - request.post? and request.path == '/auth/github' - end + Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 2, findtime: 5.minutes, bantime: bantime(5.hours)) do + request.post? and request.path == '/auth/github' + end end #### # Ban based on: IP address or access token # Ban time: 1 hour - # Ban after: 10 POST requests within 30 seconds + # Ban after: 10 POST requests within 30 seconds, unless api_builds_rate_limit is set in repository settings blacklist('spamming with POST requests') do |request| - Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 10, findtime: 30.seconds, bantime: bantime(1.hour)) do - request.post? and not POST_WHITELISTED.include? request.path - end + p "request.inspect ++++++++++++++++++++++++++++" + p request.inspect + p "+++++++++++++++++++++++++++++++++++++++++++++++++++" + Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 10, findtime: 30.seconds, bantime: bantime(1.hour)) do + request.post? and not POST_WHITELISTED.include? request.path + end end From d6c0621d7127eb59742d703574f6885793c230d8 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 31 Mar 2016 15:55:17 +0200 Subject: [PATCH 28/46] remove fail from rake tasks to allow heroku deployment --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 5d4cd585..80871975 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ namespace :db do env = ENV["RAILS_ENV"] - fail "Cannot run rake db:create in production." if env == 'production' + # fail "Cannot run rake db:create in production." if env == 'production' desc "Create and migrate the #{env} database" task :create do sh "createdb travis_#{env}" rescue nil From f51cf1a1d1ca51fca68ed09db02f54d1b3de02a1 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 31 Mar 2016 16:54:12 +0200 Subject: [PATCH 29/46] update rakefile to allow heroku deployment, update create.rb with api builds rate limit --- Gemfile.lock | 7 +++++-- Rakefile | 1 - lib/travis/api/attack.rb | 5 +---- lib/travis/api/v3/services/requests/create.rb | 9 +++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7f9f612b..30724ec1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: f7b3a76b3f39c28bb5cf7b9dc24acec13908a11a + revision: 57634c3103dec6472bf732de5f051702224dc345 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -331,7 +331,7 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.47) + tzinfo (0.3.48) unicorn (4.8.3) kgio (~> 2.6) rack @@ -388,3 +388,6 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! + +BUNDLED WITH + 1.10.6 diff --git a/Rakefile b/Rakefile index 80871975..f1cee930 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,5 @@ namespace :db do env = ENV["RAILS_ENV"] - # fail "Cannot run rake db:create in production." if env == 'production' desc "Create and migrate the #{env} database" task :create do sh "createdb travis_#{env}" rescue nil diff --git a/lib/travis/api/attack.rb b/lib/travis/api/attack.rb index fbec755d..d210b633 100644 --- a/lib/travis/api/attack.rb +++ b/lib/travis/api/attack.rb @@ -58,11 +58,8 @@ class Rack::Attack #### # Ban based on: IP address or access token # Ban time: 1 hour - # Ban after: 10 POST requests within 30 seconds, unless api_builds_rate_limit is set in repository settings + # Ban after: 10 POST requests within 30 seconds blacklist('spamming with POST requests') do |request| - p "request.inspect ++++++++++++++++++++++++++++" - p request.inspect - p "+++++++++++++++++++++++++++++++++++++++++++++++++++" Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 10, findtime: 30.seconds, bantime: bantime(1.hour)) do request.post? and not POST_WHITELISTED.include? request.path end diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index c3353daf..24254be1 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -22,14 +22,15 @@ module Travis::API::V3 accepted(remaining_requests: remaining, repository: repository, request: payload) end - def limit - Travis.config.requests_create_api_limit || LIMIT + def limit(repository) + repository.settings.try(:api_builds_rate_limit) || LIMIT end def remaining_requests(repository) - return limit if access_control.full_access? + api_builds_rate_limit = limit(repository) + return api_builds_rate_limit if access_control.full_access? count = query(:requests).count(repository, TIME_FRAME) - count > limit ? 0 : limit - count + count > api_builds_rate_limit ? 0 : api_builds_rate_limit - count end end end From 24b2abdfd0135e65a8c02fa1e3c19f09c178f555 Mon Sep 17 00:00:00 2001 From: carlad Date: Thu, 31 Mar 2016 17:15:43 +0200 Subject: [PATCH 30/46] add .rspec for formatting, add new test (still broken) --- .rspec | 3 +++ spec/v3/services/requests/create_spec.rb | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..262c08ba --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--colour +--tty +--format documentation diff --git a/spec/v3/services/requests/create_spec.rb b/spec/v3/services/requests/create_spec.rb index 23fd8460..12ee143b 100644 --- a/spec/v3/services/requests/create_spec.rb +++ b/spec/v3/services/requests/create_spec.rb @@ -239,6 +239,27 @@ describe Travis::API::V3::Services::Requests::Create do } end + describe "overrides default request limit if included in repository.settings" do + let(:repository) { Travis::API::V3::Models::Repository.create(owner_name: 'svenfuchs', name: 'minimal', settings: { "api_builds_rate_limit" => "11" } )} + before { 10.times { repository.requests.create(event_type: 'api', result: 'accepted') } } + before { post("/v3/repo/#{repository.id}/requests", params, headers) } + + example { expect(last_response.status).to be == 200 } + example { expect(JSON.load(body).to_s).to include( + "@type", + "error", + "error_type", + "request_limit_reached", + "error_message", + "request limit reached for resource", + "repository", + "representation", + "minimal", + "slug", + "svenfuchs/minimal") + } + end + describe "passing the token in params" do let(:params) {{ request: { token: 'foo-bar' }}} example { expect(sidekiq_params[:credentials]).to be == { From bc42810a53af90da5f4299dd31831272103e8079 Mon Sep 17 00:00:00 2001 From: Lennard Wolf Date: Fri, 1 Apr 2016 16:03:09 +0200 Subject: [PATCH 31/46] updated README to a functioning state. --- README.md | 75 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index bf00f730..775a209e 100644 --- a/README.md +++ b/README.md @@ -4,52 +4,67 @@ This is the app running on https://api.travis-ci.org/ ## Requirements +You will need the following packages to get travis-api to work: + 1. PostgreSQL 9.3 or higher -1. Redis -1. RabbitMQ -1. Nginx *NB: If working on Ubuntu please install Nginx manually from source. [This guide](http://www.rackspace.com/knowledge_center/article/ubuntu-and-debian-installing-nginx-from-source) is helpful but make sure you install the [latest stable version](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/#stable), include the user name on your ubuntu machine when compiling (add `--user=[yourusername]` as an option when running `./configure`), and don't follow any subsequent server configuration steps. Travis-api will start and configure its own nginx server when run locally. +2. Bundler +3. Redis Server +4. *Optional:* RabbitMQ Server +5. Nginx - + *If working in Ubuntu please install nginx manually from source: Download and extract latest nginx version, open a terminal in extracted folder and then run the following:* +```sh-session + $ sudo apt-get install libpcre3 libpcre3-dev + $ auto/configure --user=$USER + $ make + $ sudo make install + $ ln -s /usr/local/nginx/sbin/nginx /bin/nginx +``` ## Installation ### Setup - - $ bundle install - +```sh-session +$ bundle install +``` ### Database setup -NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is configured using the environment variable RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. - -1. `bundle exec rake db:create` -2. for testing 'RAILS_ENV=test bundle exec rake db:create --trace' -1. Clone `travis-logs` and copy the `logs` database (assume the PostgreSQL user is `postgres`): +*You might need to create a role first. For this you should run the following:* ```sh-session -cd .. -git clone https://github.com/travis-ci/travis-logs.git -cd travis-logs -rvm jruby do bundle exec rake db:migrate # `travis-logs` requires JRuby -psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_development -pg_dump -t logs travis_logs_development | psql -U postgres travis_development +$ sudo -u postgres psql -c "CREATE USER yourusername WITH SUPERUSER PASSWORD 'yourpassword'" ``` -Repeat the database steps for `RAILS_ENV=test`. +NB detail for how `rake` sets up the database can be found in the `Rakefile`. In the `namespace :db` block you will see the database name is configured using the environment variable RAILS_ENV. If you are using a different configuration you will have to make your own adjustments. ```sh-session -RAILS_ENV=test bundle exec rake db:create -pushd ../travis-logs -RAILS_ENV=test rvm jruby do bundle exec rake db:migrate -psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_test -pg_dump -t logs travis_logs_test | psql -U postgres travis_test -popd +$ RAILS_ENV=development bundle exec rake db:create +$ RAILS_ENV=test bundle exec rake db:create +``` +#### Optional +Clone `travis-logs` and copy the `logs` database (assume the PostgreSQL user is `postgres`): +```sh-session +$ cd .. +$ git clone https://github.com/travis-ci/travis-logs.git +$ cd travis-logs +$ rvm jruby do bundle exec rake db:migrate # `travis-logs` requires JRuby +$ psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_development +$ pg_dump -t logs travis_logs_development | psql -U postgres travis_development + +$ RAILS_ENV=test bundle exec rake db:create +$ pushd ../travis-logs +$ RAILS_ENV=test rvm jruby do bundle exec rake db:migrate +$ psql -c "DROP TABLE IF EXISTS logs CASCADE" -U postgres travis_test +$ pg_dump -t logs travis_logs_test | psql -U postgres travis_test +$ popd ``` ### Run tests - - $ rake spec - +```sh-session +$ bundle exec rspec +``` ### Run the server - - $ bundle exec script/server - +```sh-session +$ bundle exec script/server +``` ## Contributing 1. Fork it From c49819ca5274d14d19eea3c97b152faa717b66ee Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 1 Apr 2016 16:22:29 +0200 Subject: [PATCH 32/46] add missing sudo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 775a209e..890a583d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ You will need the following packages to get travis-api to work: $ auto/configure --user=$USER $ make $ sudo make install - $ ln -s /usr/local/nginx/sbin/nginx /bin/nginx + $ sudo ln -s /usr/local/nginx/sbin/nginx /bin/nginx ``` ## Installation From 0e8fe08f7cc6ebcffd003ddc3a77b18295134500 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Mon, 4 Apr 2016 16:13:14 +0200 Subject: [PATCH 33/46] Update limit method and finish test --- Gemfile.lock | 7 ++----- lib/travis/api/v3/services/requests/create.rb | 6 +++++- spec/v3/services/requests/create_spec.rb | 19 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 30724ec1..3342bc2a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 57634c3103dec6472bf732de5f051702224dc345 + revision: 9978518236afb520c8fff68bebe7beb62f8ad776 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -56,7 +56,7 @@ GIT coder (~> 0.4.0) data_migrations (~> 0.0.1) gh - hashr (~> 0.0.19) + hashr metriks (~> 0.9.7) multi_json pusher (~> 0.14.0) @@ -388,6 +388,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.10.6 diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 24254be1..81654bff 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -23,7 +23,11 @@ module Travis::API::V3 end def limit(repository) - repository.settings.try(:api_builds_rate_limit) || LIMIT + if repository.settings.nil? + LIMIT + else + repository.settings["api_builds_rate_limit"] || LIMIT + end end def remaining_requests(repository) diff --git a/spec/v3/services/requests/create_spec.rb b/spec/v3/services/requests/create_spec.rb index 12ee143b..c0dfb035 100644 --- a/spec/v3/services/requests/create_spec.rb +++ b/spec/v3/services/requests/create_spec.rb @@ -240,19 +240,18 @@ describe Travis::API::V3::Services::Requests::Create do end describe "overrides default request limit if included in repository.settings" do - let(:repository) { Travis::API::V3::Models::Repository.create(owner_name: 'svenfuchs', name: 'minimal', settings: { "api_builds_rate_limit" => "11" } )} - before { 10.times { repository.requests.create(event_type: 'api', result: 'accepted') } } - before { post("/v3/repo/#{repository.id}/requests", params, headers) } + before { repo.update_attribute(:settings, { api_builds_rate_limit: 12 }.to_json) } - example { expect(last_response.status).to be == 200 } - example { expect(JSON.load(body).to_s).to include( + before { 10.times { repo.requests.create(event_type: 'api', result: 'accepted') } } + before { post("/v3/repo/#{repo.id}/requests", {}, headers) } + + example { expect(last_response.status).to be == 202 } + example { expect(JSON.load(body).to_s).to include( "@type", - "error", - "error_type", - "request_limit_reached", - "error_message", - "request limit reached for resource", "repository", + "remaining_requests", + "2", + "request", "representation", "minimal", "slug", From 7f4d67ea8d23fdd6f8bd45e100041a2e67a31824 Mon Sep 17 00:00:00 2001 From: carlad Date: Mon, 4 Apr 2016 16:21:16 +0200 Subject: [PATCH 34/46] remove core pointing to branch --- Gemfile | 2 +- Gemfile.lock | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index cf09b3c1..da99c923 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core', ref: 'sf-ar-te' +gem 'travis-core', github: 'travis-ci/travis-core' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 665485d0..563536fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,8 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: fdcd69981dc9ccb6f85452213d8bdc096f4308be - ref: sf-ar-te + revision: 9978518236afb520c8fff68bebe7beb62f8ad776 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 9f9c5bf78947f1831f13bebaa1556ddfe09ba28e Mon Sep 17 00:00:00 2001 From: carlad Date: Tue, 5 Apr 2016 11:43:40 +0200 Subject: [PATCH 35/46] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index bf00f730..5ed8b817 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ pg_dump -t logs travis_logs_test | psql -U postgres travis_test popd ``` - ### Run tests $ rake spec From 5fc096f68b1c9ca0cbfe5f497adec3c3fa00944c Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 12:29:35 +0200 Subject: [PATCH 36/46] Update rate limit condition --- lib/travis/api/v3/services/requests/create.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 81654bff..1d4d0978 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -26,7 +26,7 @@ module Travis::API::V3 if repository.settings.nil? LIMIT else - repository.settings["api_builds_rate_limit"] || LIMIT + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT end end From 407d2abea152c769f37589156fe3c57dd95418bb Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 15:27:11 +0200 Subject: [PATCH 37/46] Use Travis.config to retrieve default values for api_builds_rate_limit --- lib/travis/api/v3/services/requests/create.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 1d4d0978..5eee314f 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -1,8 +1,7 @@ module Travis::API::V3 class Services::Requests::Create < Service TIME_FRAME = 1.hour - LIMIT = 10 - private_constant :TIME_FRAME, :LIMIT + private_constant :TIME_FRAME result_type :request params "request", "user", :config, :message, :branch, :token @@ -24,9 +23,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - LIMIT + Travis.config.requests_create_api_limit else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit end end From 679bbd79017ff4e10b8947c834d7459d5ad375c1 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 16:27:01 +0200 Subject: [PATCH 38/46] Use LIMIT constant as a backup limit number --- Gemfile | 2 +- Gemfile.lock | 6 ++---- lib/travis/api/v3/services/requests/create.rb | 7 ++++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index da99c923..fc31b22e 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core' +gem 'travis-core', github: 'travis-ci/travis-core', branch: 'cd-ar-rate-limit-on-travis-config' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 563536fb..d425f462 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,8 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 9978518236afb520c8fff68bebe7beb62f8ad776 + revision: 76ddca556f0eb9f40daa50789223db9e18174d46 + branch: cd-ar-rate-limit-on-travis-config specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -388,6 +389,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.12.0.pre.1 diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 5eee314f..ea3827de 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -1,7 +1,8 @@ module Travis::API::V3 class Services::Requests::Create < Service TIME_FRAME = 1.hour - private_constant :TIME_FRAME + LIMIT = 10 + private_constant :TIME_FRAME, :LIMIT result_type :request params "request", "user", :config, :message, :branch, :token @@ -23,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit + Travis.config.requests_create_api_limit || LIMIT else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT end end From 11ceaed333042d65872b31f877f9169aa36594ff Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 16:47:33 +0200 Subject: [PATCH 39/46] Test default limit --- lib/travis/api/v3/services/requests/create.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index ea3827de..372b299e 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -24,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit || LIMIT + Travis.config.requests_create_api_limit || 50 else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || 50 end end From 228b594237368d7f4f901f9f44e3dba95ce0db40 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 17:09:48 +0200 Subject: [PATCH 40/46] Return LIMIT if everything else fails --- lib/travis/api/v3/services/requests/create.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/travis/api/v3/services/requests/create.rb b/lib/travis/api/v3/services/requests/create.rb index 372b299e..ea3827de 100644 --- a/lib/travis/api/v3/services/requests/create.rb +++ b/lib/travis/api/v3/services/requests/create.rb @@ -24,9 +24,9 @@ module Travis::API::V3 def limit(repository) if repository.settings.nil? - Travis.config.requests_create_api_limit || 50 + Travis.config.requests_create_api_limit || LIMIT else - repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || 50 + repository.settings["api_builds_rate_limit"] || Travis.config.requests_create_api_limit || LIMIT end end From 03e992885ea15acd3df358cfc9c10fe94e373468 Mon Sep 17 00:00:00 2001 From: Ana Rosas Date: Tue, 5 Apr 2016 17:28:00 +0200 Subject: [PATCH 41/46] Bump travis-core --- Gemfile | 2 +- Gemfile.lock | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index fc31b22e..da99c923 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby '2.1.7' if ENV.key?('DYNO') gem 's3', github: 'travis-ci/s3' -gem 'travis-core', github: 'travis-ci/travis-core', branch: 'cd-ar-rate-limit-on-travis-config' +gem 'travis-core', github: 'travis-ci/travis-core' gem 'travis-support', github: 'travis-ci/travis-support' gem 'travis-amqp', github: 'travis-ci/travis-amqp' gem 'travis-config', '~> 0.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index d425f462..0a19a797 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,8 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 76ddca556f0eb9f40daa50789223db9e18174d46 - branch: cd-ar-rate-limit-on-travis-config + revision: e5740f49f18f826a2d4a246647e5e7f1a26494eb specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 1f0d26a01c91626b21214f79ac6091e125272966 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Tue, 5 Apr 2016 08:27:34 -1000 Subject: [PATCH 42/46] Update travis-core In particular, to include https://github.com/travis-ci/travis-core/pull/530 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a19a797..04ae6146 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: e5740f49f18f826a2d4a246647e5e7f1a26494eb + revision: 3a68fc4955cd5efb361ba283d49c6779edc7d4a3 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 482f037438e2adfea89d7dffb1480b592d1c4df1 Mon Sep 17 00:00:00 2001 From: carlad Date: Wed, 6 Apr 2016 15:03:12 +0200 Subject: [PATCH 43/46] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ed8b817..2dfb69bf 100644 --- a/README.md +++ b/README.md @@ -43,11 +43,13 @@ popd ### Run tests - $ rake spec + $ bundle exec spec ### Run the server $ bundle exec script/server + + If you have problems with Nginx because the websocket is already in use, try restarting your computer. ## Contributing From dc4d6f0208e1202dd696cddf34f361873cc5df84 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Apr 2016 11:40:44 +0200 Subject: [PATCH 44/46] Bump travis-core --- Gemfile.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 04ae6146..eb285248 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 3a68fc4955cd5efb361ba283d49c6779edc7d4a3 + revision: b559376003609cd8e13ff619d61844cae876912f specs: travis-core (0.0.1) actionmailer (~> 3.2.19) @@ -388,3 +388,6 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! + +BUNDLED WITH + 1.11.2 From efe26b03a1d8141ab32ee551d80a57f9aa898996 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 7 Apr 2016 11:43:46 +0200 Subject: [PATCH 45/46] Bump travis-core --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index eb285248..f7765800 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: b559376003609cd8e13ff619d61844cae876912f + revision: a66c345d44fd9c28884d694acfff3b1a0fbc5232 specs: travis-core (0.0.1) actionmailer (~> 3.2.19) From 1b9b422753dbc3df29d16b594840cb1ddd72dd8b Mon Sep 17 00:00:00 2001 From: Steffen Date: Fri, 8 Apr 2016 09:55:32 +0200 Subject: [PATCH 46/46] remove text from code block --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56e8af0c..4388b241 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ $ bundle exec rspec ```sh-session $ bundle exec script/server ``` - If you have problems with Nginx because the websocket is already in use, try restarting your computer. +If you have problems with Nginx because the websocket is already in use, try restarting your computer. ## Contributing