resolve conflict
This commit is contained in:
commit
14866201ff
|
@ -1,3 +1,3 @@
|
|||
https://github.com/heroku/heroku-buildpack-ruby.git
|
||||
https://github.com/drogus/last-commit-sha-buildpack.git
|
||||
https://dl.signalsciences.net/heroku/sigsci-buildpack-nginx.tgz
|
||||
https://github.com/ryandotsmith/nginx-buildpack.git
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -3,7 +3,6 @@ gemspec
|
|||
|
||||
gem 's3', github: 'travis-ci/s3'
|
||||
|
||||
gem 'travis-core', path: 'vendor/travis-core'
|
||||
gem 'travis-support', github: 'travis-ci/travis-support'
|
||||
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
||||
gem 'travis-config', '~> 0.1.0'
|
||||
|
@ -11,7 +10,6 @@ gem 'travis-settings', github: 'travis-ci/travis-settings'
|
|||
gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs'
|
||||
|
||||
gem 'travis-yaml', github: 'travis-ci/travis-yaml'
|
||||
gem 'travis-settings', github: 'travis-ci/travis-settings'
|
||||
gem 'mustermann', github: 'rkh/mustermann'
|
||||
gem 'sinatra'
|
||||
gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: nil
|
||||
|
|
27
Gemfile.lock
27
Gemfile.lock
|
@ -101,29 +101,6 @@ PATH
|
|||
useragent
|
||||
virtus (~> 1.0.0)
|
||||
|
||||
PATH
|
||||
remote: vendor/travis-core
|
||||
specs:
|
||||
travis-core (0.0.1)
|
||||
activerecord (~> 3.2.19)
|
||||
coder (~> 0.4.0)
|
||||
data_migrations (~> 0.0.1)
|
||||
gh
|
||||
google-api-client (~> 0.9.4)
|
||||
hashr
|
||||
metriks (~> 0.9.7)
|
||||
multi_json
|
||||
pusher (~> 0.14.0)
|
||||
railties (~> 3.2.19)
|
||||
rake
|
||||
redis (~> 3.0)
|
||||
rollout (~> 1.1.0)
|
||||
s3 (~> 0.3)
|
||||
simple_states (~> 1.0.0)
|
||||
thor
|
||||
travis-config (~> 0.1.0)
|
||||
virtus (~> 1.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
@ -172,9 +149,6 @@ GEM
|
|||
customerio (1.0.0)
|
||||
multi_json (~> 1.0)
|
||||
dalli (2.7.6)
|
||||
data_migrations (0.0.1)
|
||||
activerecord
|
||||
rake
|
||||
database_cleaner (0.8.0)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
|
@ -412,7 +386,6 @@ DEPENDENCIES
|
|||
travis-amqp!
|
||||
travis-api!
|
||||
travis-config (~> 0.1.0)
|
||||
travis-core!
|
||||
travis-migrations!
|
||||
travis-settings!
|
||||
travis-sidekiqs!
|
||||
|
|
|
@ -77,5 +77,4 @@ If you have problems with Nginx because the websocket is already in use, try res
|
|||
|
||||
### API documentation
|
||||
|
||||
We use source code comments to add documentation. If the server is running, you
|
||||
can browse an HTML documentation at [`/docs`](http://localhost:5000/docs).
|
||||
v3 documentation can be found at https://developer.travis-ci.org which is a repository that can be found at https://github.com/travis-pro/developer
|
||||
|
|
12
Rakefile
12
Rakefile
|
@ -18,7 +18,7 @@ end
|
|||
# t.pattern = 'spec_core/**{,/*/**}/*_spec.rb'
|
||||
# end
|
||||
#
|
||||
# task :default => [:spec, :spec_core]
|
||||
# task :default => [:spec]
|
||||
# rescue LoadError => e
|
||||
# puts e.inspect
|
||||
# end
|
||||
|
@ -27,18 +27,8 @@ end
|
|||
namespace :spec do
|
||||
desc 'Run all specs'
|
||||
task :all do
|
||||
sh 'bundle exec rspec -r spec_helper spec spec_core'
|
||||
end
|
||||
|
||||
desc 'Run api specs'
|
||||
task :api do
|
||||
sh 'bundle exec rspec -r spec_helper spec'
|
||||
end
|
||||
|
||||
desc 'Run core specs'
|
||||
task :core do
|
||||
sh 'bundle exec rspec -r spec_helper spec_core'
|
||||
end
|
||||
end
|
||||
|
||||
task :default => :'spec:all'
|
||||
|
|
|
@ -13,10 +13,6 @@ http {
|
|||
gzip_comp_level 2;
|
||||
gzip_min_length 512;
|
||||
|
||||
<% unless ENV['SIGSCI_ENABLED'].nil? || ENV['SIGSCI_ENABLED'].empty? %>
|
||||
include "../sigsci-module-nginx/sigsci.conf";
|
||||
<% end %>
|
||||
|
||||
server_tokens off;
|
||||
|
||||
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
|
||||
|
|
BIN
heroku-buildpack-sigsci.tgz
Normal file
BIN
heroku-buildpack-sigsci.tgz
Normal file
Binary file not shown.
|
@ -1,7 +1,6 @@
|
|||
require 'pusher'
|
||||
require 'travis/support'
|
||||
require 'travis/support/database'
|
||||
require 'travis/version'
|
||||
require 'travis/redis_pool'
|
||||
require 'travis/errors'
|
||||
|
||||
|
@ -19,7 +18,6 @@ module Travis
|
|||
require 'travis/model'
|
||||
require 'travis/task'
|
||||
require 'travis/event'
|
||||
require 'travis/addons'
|
||||
require 'travis/api/serialize'
|
||||
require 'travis/config/defaults'
|
||||
require 'travis/features'
|
||||
|
@ -43,7 +41,6 @@ module Travis
|
|||
Travis.logger.info('Setting up Travis::Core')
|
||||
|
||||
Github.setup
|
||||
Addons.register
|
||||
Services.register
|
||||
Github::Services.register
|
||||
end
|
||||
|
|
|
@ -23,11 +23,6 @@ class Travis::Api::App
|
|||
Metriks.meter("api.request.cancel_build").mark
|
||||
|
||||
service = Travis::Enqueue::Services::CancelModel.new(current_user, { build_id: params[:id] })
|
||||
repository_owner = service.target.repository.owner
|
||||
|
||||
if !Travis::Features.enabled_for_all?(:enqueue_to_hub) && !Travis::Features.owner_active?(:enqueue_to_hub, repository_owner)
|
||||
service = self.service(:cancel_build, params.merge(source: 'api'))
|
||||
end
|
||||
|
||||
if !service.authorized?
|
||||
json = { error: {
|
||||
|
@ -48,11 +43,8 @@ class Travis::Api::App
|
|||
respond_with json
|
||||
else
|
||||
payload = { id: params[:id], user_id: current_user.id, source: 'api' }
|
||||
if service.respond_to?(:push)
|
||||
service.push("build:cancel", payload)
|
||||
else
|
||||
Travis::Sidekiq::BuildCancellation.perform_async(payload)
|
||||
end
|
||||
|
||||
service.push("build:cancel", payload)
|
||||
|
||||
Metriks.meter("api.request.cancel_build.success").mark
|
||||
status 204
|
||||
|
@ -62,24 +54,15 @@ class Travis::Api::App
|
|||
post '/:id/restart' do
|
||||
Metriks.meter("api.request.restart_build").mark
|
||||
service = Travis::Enqueue::Services::RestartModel.new(current_user, build_id: params[:id])
|
||||
repository_owner = service.target.repository.owner
|
||||
|
||||
if !Travis::Features.enabled_for_all?(:enqueue_to_hub) && !Travis::Features.owner_active?(:enqueue_to_hub, repository_owner)
|
||||
service = self.service(:reset_model, build_id: params[:id])
|
||||
end
|
||||
|
||||
result = if !service.accept?
|
||||
status 400
|
||||
false
|
||||
elsif service.respond_to?(:push)
|
||||
else
|
||||
payload = { id: params[:id], user_id: current_user.id }
|
||||
service.push("build:restart", payload)
|
||||
status 202
|
||||
true
|
||||
else
|
||||
Travis::Sidekiq::BuildRestart.perform_async(id: params[:id], user_id: current_user.id)
|
||||
status 202
|
||||
true
|
||||
end
|
||||
|
||||
respond_with(result: result, flash: service.messages)
|
||||
|
|
|
@ -30,10 +30,6 @@ class Travis::Api::App
|
|||
Metriks.meter("api.request.cancel_job").mark
|
||||
|
||||
service = Travis::Enqueue::Services::CancelModel.new(current_user, { job_id: params[:id] })
|
||||
repository_owner = service.target.repository.owner
|
||||
if !Travis::Features.enabled_for_all?(:enqueue_to_hub) && !Travis::Features.owner_active?(:enqueue_to_hub, repository_owner)
|
||||
service = self.service(:cancel_job, params.merge(source: 'api'))
|
||||
end
|
||||
|
||||
if !service.authorized?
|
||||
json = { error: {
|
||||
|
@ -54,11 +50,7 @@ class Travis::Api::App
|
|||
respond_with json
|
||||
else
|
||||
payload = { id: params[:id], user_id: current_user.id, source: 'api' }
|
||||
if service.respond_to?(:push)
|
||||
service.push("job:cancel", payload)
|
||||
else
|
||||
Travis::Sidekiq::JobCancellation.perform_async(payload)
|
||||
end
|
||||
service.push("job:cancel", payload)
|
||||
|
||||
Metriks.meter("api.request.cancel_job.success").mark
|
||||
status 204
|
||||
|
@ -69,23 +61,15 @@ class Travis::Api::App
|
|||
Metriks.meter("api.request.restart_job").mark
|
||||
|
||||
service = Travis::Enqueue::Services::RestartModel.new(current_user, { job_id: params[:id] })
|
||||
repository_owner = service.target.repository.owner
|
||||
if !Travis::Features.enabled_for_all?(:enqueue_to_hub) && !Travis::Features.owner_active?(:enqueue_to_hub, repository_owner)
|
||||
service = self.service(:reset_model, job_id: params[:id])
|
||||
end
|
||||
|
||||
result = if !service.accept?
|
||||
status 400
|
||||
false
|
||||
elsif service.respond_to?(:push)
|
||||
else
|
||||
payload = {id: params[:id], user_id: current_user.id}
|
||||
service.push("job:restart", payload)
|
||||
status 202
|
||||
true
|
||||
else
|
||||
Travis::Sidekiq::JobRestart.perform_async(id: params[:id], user_id: current_user.id)
|
||||
status 202
|
||||
result = true
|
||||
end
|
||||
|
||||
respond_with(result: result, flash: service.messages)
|
||||
|
|
|
@ -30,19 +30,10 @@ class Travis::Api::App
|
|||
# I think we need to properly deprecate this by publishing a blog post.
|
||||
Metriks.meter("api.request.restart").mark
|
||||
|
||||
service = Travis::Enqueue::Services::RestartModel.new(current_user, params)
|
||||
repository_owner = service.target.repository.owner
|
||||
|
||||
if !Travis::Features.enabled_for_all?(:enqueue_to_hub) && !Travis::Features.owner_active?(:enqueue_to_hub, repository_owner)
|
||||
respond_with service(:reset_model, params)
|
||||
elsif service.respond_to?(:push)
|
||||
params[:user_id] = repository_owner.id
|
||||
type ||= params[:build_id] ? 'build' : 'job'
|
||||
params[:id] = params[:build_id] || params[:job_id]
|
||||
|
||||
service.push("#{type}:restart", params)
|
||||
respond_with(result: true, flash: service.messages)
|
||||
end
|
||||
service = Travis::Enqueue::Services::RestartModel.new(current_user, { build_id: params[:build_id] })
|
||||
payload = {id: params[:build_id], user_id: current_user.id}
|
||||
service.push("job:restart", payload)
|
||||
status 202
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,26 +12,19 @@ module Travis::API::V3
|
|||
|
||||
def cancel(user)
|
||||
raise BuildNotCancelable if %w(passed failed canceled errored).include? find.state
|
||||
|
||||
payload = { id: id, user_id: user.id, source: 'api' }
|
||||
if Travis::Features.enabled_for_all?(:enqueue_to_hub) || Travis::Features.owner_active?(:enqueue_to_hub, find.repository.owner)
|
||||
service = Travis::Enqueue::Services::CancelModel.new(user, { build_id: id })
|
||||
service.push("build:cancel", payload)
|
||||
else
|
||||
perform_async(:build_cancellation, payload)
|
||||
end
|
||||
service = Travis::Enqueue::Services::CancelModel.new(user, { build_id: id })
|
||||
service.push("build:cancel", payload)
|
||||
payload
|
||||
end
|
||||
|
||||
def restart(user)
|
||||
raise BuildAlreadyRunning if %w(received queued started).include? find.state
|
||||
if Travis::Features.enabled_for_all?(:enqueue_to_hub) || Travis::Features.owner_active?(:enqueue_to_hub, find.repository.owner)
|
||||
service = Travis::Enqueue::Services::RestartModel.new(user, { build_id: id })
|
||||
payload = { id: id, user_id: user.id }
|
||||
service.push("build:restart", payload)
|
||||
else
|
||||
payload = { id: id, user_id: user.id, source: 'api' }
|
||||
perform_async(:build_restart, payload)
|
||||
end
|
||||
|
||||
service = Travis::Enqueue::Services::RestartModel.new(user, { build_id: id })
|
||||
payload = { id: id, user_id: user.id }
|
||||
service.push("build:restart", payload)
|
||||
payload
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,28 +12,19 @@ module Travis::API::V3
|
|||
|
||||
def cancel(user)
|
||||
raise JobNotCancelable if %w(passed failed canceled errored).include? find.state
|
||||
|
||||
payload = { id: id, user_id: user.id, source: 'api' }
|
||||
#look for repo.owner instead and look if the user belongs to the repo, instead of using user for the feature flag
|
||||
if Travis::Features.enabled_for_all?(:enqueue_to_hub) || Travis::Features.owner_active?(:enqueue_to_hub, find.repository.owner)
|
||||
service = Travis::Enqueue::Services::CancelModel.new(user, { job_id: id })
|
||||
service.push("job:cancel", payload)
|
||||
else
|
||||
perform_async(:job_cancellation, payload)
|
||||
end
|
||||
service = Travis::Enqueue::Services::CancelModel.new(user, { job_id: id })
|
||||
service.push("job:cancel", payload)
|
||||
payload
|
||||
end
|
||||
|
||||
def restart(user)
|
||||
raise JobAlreadyRunning if %w(received queued started).include? find.state
|
||||
|
||||
if Travis::Features.enabled_for_all?(:enqueue_to_hub) || Travis::Features.owner_active?(:enqueue_to_hub, find.repository.owner)
|
||||
service = Travis::Enqueue::Services::RestartModel.new(user, { job_id: id })
|
||||
payload = { id: id, user_id: user.id }
|
||||
service.push("job:restart", payload)
|
||||
else
|
||||
payload = { id: id, user_id: user.id, source: 'api' }
|
||||
perform_async(:job_restart, payload)
|
||||
end
|
||||
service = Travis::Enqueue::Services::RestartModel.new(user, { job_id: id })
|
||||
payload = { id: id, user_id: user.id }
|
||||
service.push("job:restart", payload)
|
||||
payload
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,11 +8,6 @@ module Travis
|
|||
#
|
||||
# Handler registrations are defined in Travis.config so they can be added or
|
||||
# removed easily for different environments.
|
||||
#
|
||||
# Note that Travis::Event#notify accepts an internal event name like
|
||||
# 'create' (coming from the simple_states implementation in the models) and
|
||||
# turns it into a namespaced client event name like 'job:test:created').
|
||||
# Notification handlers register for and deal with these client event names.
|
||||
module Event
|
||||
require 'travis/event/config'
|
||||
require 'travis/event/handler'
|
||||
|
@ -42,10 +37,6 @@ module Travis
|
|||
end
|
||||
end
|
||||
|
||||
def notify(event, *args)
|
||||
Travis.logger.info("DEPRECATED: Event.notify used: event=#{event}, args=#{args}")
|
||||
Travis::Event.dispatch(client_event(event, self), self, *args)
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
@ -11,7 +11,7 @@ module Travis
|
|||
GH.set(
|
||||
client_id: Travis.config.oauth2.client_id,
|
||||
client_secret: Travis.config.oauth2.client_secret,
|
||||
user_agent: "Travis-CI/#{Travis::VERSION} GH/#{GH::VERSION}",
|
||||
user_agent: "GH/#{GH::VERSION}",
|
||||
origin: Travis.config.host,
|
||||
api_url: Travis.config.github.api_url,
|
||||
ssl: Travis.config.ssl.to_h.merge(Travis.config.github.ssl || {}).to_h.compact
|
|
@ -28,21 +28,21 @@ class Build
|
|||
event :finish, to: :finished, if: :should_finish?
|
||||
event :reset, to: :created
|
||||
event :cancel, to: :canceled, if: :cancelable?
|
||||
event :all, after: [:denormalize, :notify]
|
||||
event :all, after: [:denormalize]
|
||||
end
|
||||
|
||||
def should_finish?
|
||||
matrix_finished? && !finished?
|
||||
end
|
||||
|
||||
#TODO remove?
|
||||
def receive(data = {})
|
||||
self.received_at = data[:received_at]
|
||||
end
|
||||
|
||||
#TODO remove?
|
||||
def start(data = {})
|
||||
self.started_at = data[:started_at]
|
||||
end
|
||||
|
||||
#TODO remove?
|
||||
def finish(data = {})
|
||||
self.state = matrix_state
|
||||
self.duration = matrix_duration
|
||||
|
@ -50,7 +50,7 @@ class Build
|
|||
|
||||
save!
|
||||
end
|
||||
|
||||
#TODO remove?
|
||||
def cancel(options = {})
|
||||
matrix.each do |job|
|
||||
job.cancel!
|
|
@ -21,11 +21,10 @@ class Job
|
|||
event :finish, to: :finished
|
||||
event :reset, to: :created, unless: :created?
|
||||
event :cancel, to: :canceled, if: :cancelable?
|
||||
event :all, after: [:propagate, :notify]
|
||||
event :all, after: [:propagate]
|
||||
|
||||
def enqueue # TODO rename to queue and make it an event, simple_states should support that now
|
||||
update_attributes!(state: :queued, queued_at: Time.now.utc)
|
||||
notify(:queue)
|
||||
end
|
||||
|
||||
def receive(data = {})
|
||||
|
@ -95,13 +94,6 @@ class Job
|
|||
state == nil
|
||||
end
|
||||
|
||||
def notify(event, *args)
|
||||
Metriks.timer("job.notify.#{event}").time do
|
||||
event = :create if event == :reset
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
delegate :id, :content, :to => :log, :prefix => true, :allow_nil => true
|
||||
end
|
||||
end
|
|
@ -37,8 +37,6 @@ module Travis
|
|||
end
|
||||
|
||||
require 'travis/services/base'
|
||||
require 'travis/services/cancel_job'
|
||||
require 'travis/services/cancel_build'
|
||||
require 'travis/services/delete_caches'
|
||||
require 'travis/services/find_admin'
|
||||
require 'travis/services/find_annotations'
|
||||
|
@ -63,7 +61,6 @@ require 'travis/services/find_user_permissions'
|
|||
require 'travis/services/next_build_number'
|
||||
require 'travis/services/regenerate_repo_key'
|
||||
require 'travis/services/remove_log'
|
||||
require 'travis/services/reset_model'
|
||||
require 'travis/services/sync_user'
|
||||
require 'travis/services/update_annotation'
|
||||
require 'travis/services/update_hook'
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user