use travis-core/sf-log-models
This commit is contained in:
parent
0aa2d6566c
commit
7e005aad1b
2
Gemfile
2
Gemfile
|
@ -3,7 +3,7 @@ ruby '1.9.3' rescue nil
|
||||||
source :rubygems
|
source :rubygems
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
gem 'travis-core', github: 'travis-ci/travis-core'
|
gem 'travis-core', github: 'travis-ci/travis-core', branch: 'sf-log-models'
|
||||||
gem 'travis-support', github: 'travis-ci/travis-support'
|
gem 'travis-support', github: 'travis-ci/travis-support'
|
||||||
gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil, ref: 'cde9741'
|
gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil, ref: 'cde9741'
|
||||||
gem 'sinatra' #github: 'sinatra/sinatra'
|
gem 'sinatra' #github: 'sinatra/sinatra'
|
||||||
|
|
17
Gemfile.lock
17
Gemfile.lock
|
@ -1,8 +1,8 @@
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/getsentry/raven-ruby.git
|
remote: git://github.com/getsentry/raven-ruby.git
|
||||||
revision: 0bf46f9e957b179a5d0ce1295840eaff89d8146a
|
revision: f6a97f1544480645c4dfdb4d1e9e97ede1e737a9
|
||||||
specs:
|
specs:
|
||||||
sentry-raven (0.4.2)
|
sentry-raven (0.4.3)
|
||||||
faraday (>= 0.7.6)
|
faraday (>= 0.7.6)
|
||||||
hashie
|
hashie
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
@ -45,7 +45,8 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/travis-ci/travis-core.git
|
remote: git://github.com/travis-ci/travis-core.git
|
||||||
revision: 4d4fc4f4d18624278ad552d037a574ce8fdd77b0
|
revision: 258d823c367a13db76db87d2f42942ee7af8a041
|
||||||
|
branch: sf-log-models
|
||||||
specs:
|
specs:
|
||||||
travis-core (0.0.1)
|
travis-core (0.0.1)
|
||||||
actionmailer (~> 3.2.11)
|
actionmailer (~> 3.2.11)
|
||||||
|
@ -161,7 +162,7 @@ GEM
|
||||||
hashie (1.2.0)
|
hashie (1.2.0)
|
||||||
hashr (0.0.22)
|
hashr (0.0.22)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
hitimes (1.1.1)
|
hitimes (1.2.0)
|
||||||
hubble (0.1.2)
|
hubble (0.1.2)
|
||||||
yajl-ruby (~> 1.1)
|
yajl-ruby (~> 1.1)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
|
@ -178,7 +179,7 @@ GEM
|
||||||
atomic (~> 1.0)
|
atomic (~> 1.0)
|
||||||
avl_tree (~> 1.1.2)
|
avl_tree (~> 1.1.2)
|
||||||
hitimes (~> 1.1)
|
hitimes (~> 1.1)
|
||||||
mime-types (1.20.1)
|
mime-types (1.21)
|
||||||
mocha (0.13.2)
|
mocha (0.13.2)
|
||||||
metaclass (~> 0.0.1)
|
metaclass (~> 0.0.1)
|
||||||
multi_json (1.5.0)
|
multi_json (1.5.0)
|
||||||
|
@ -204,7 +205,7 @@ GEM
|
||||||
pusher (0.11.3)
|
pusher (0.11.3)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
signature (~> 0.1.6)
|
signature (~> 0.1.6)
|
||||||
rack (1.4.4)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-protection (1.3.2)
|
rack-protection (1.3.2)
|
||||||
|
@ -228,7 +229,7 @@ GEM
|
||||||
redis (3.0.2)
|
redis (3.0.2)
|
||||||
redis-namespace (1.2.1)
|
redis-namespace (1.2.1)
|
||||||
redis (~> 3.0.0)
|
redis (~> 3.0.0)
|
||||||
rerun (0.7.1)
|
rerun (0.8.0)
|
||||||
listen
|
listen
|
||||||
rollout (1.1.0)
|
rollout (1.1.0)
|
||||||
rspec (2.12.0)
|
rspec (2.12.0)
|
||||||
|
@ -276,7 +277,7 @@ GEM
|
||||||
tzinfo (0.3.35)
|
tzinfo (0.3.35)
|
||||||
uuidtools (2.1.3)
|
uuidtools (2.1.3)
|
||||||
yajl-ruby (1.1.0)
|
yajl-ruby (1.1.0)
|
||||||
yard (0.8.3)
|
yard (0.8.4.1)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
|
@ -4,18 +4,12 @@ class Travis::Api::App
|
||||||
class Endpoint
|
class Endpoint
|
||||||
# Artifacts are generated by builds. Currently we only expose logs as
|
# Artifacts are generated by builds. Currently we only expose logs as
|
||||||
# artifacts
|
# artifacts
|
||||||
|
#
|
||||||
|
# DEPRECATED will be removed as soon as the client uses /logs/:id
|
||||||
class Artifacts < Endpoint
|
class Artifacts < Endpoint
|
||||||
# Fetches an artifact by it's *id*.
|
# Fetches an artifact by it's *id*.
|
||||||
get '/:id' do |id|
|
get '/:id' do |id|
|
||||||
respond_with service(:find_artifact, params)
|
respond_with service(:find_log, params)
|
||||||
end
|
|
||||||
|
|
||||||
put '/:id' do |id|
|
|
||||||
# TODO @rkh ... rather lost in the auth/scopes code.
|
|
||||||
token = env['HTTP_TOKEN']
|
|
||||||
halt 403, 'no token' unless token
|
|
||||||
halt 403, 'internal' unless token == Travis.config.tokens.internal
|
|
||||||
respond_with service(:update_artifact, params)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/:job_id/log' do
|
get '/:job_id/log' do
|
||||||
resource = service(:find_artifact, params).run
|
resource = service(:find_log, params).run
|
||||||
if !resource || resource.archived?
|
if !resource || resource.archived?
|
||||||
archived_log_path = archive_url("/jobs/#{params[:job_id]}/log.txt")
|
archived_log_path = archive_url("/jobs/#{params[:job_id]}/log.txt")
|
||||||
|
|
||||||
|
|
21
lib/travis/api/app/endpoint/logs.rb
Normal file
21
lib/travis/api/app/endpoint/logs.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
require 'travis/api/app'
|
||||||
|
|
||||||
|
class Travis::Api::App
|
||||||
|
class Endpoint
|
||||||
|
# Logs are generated by builds.
|
||||||
|
class Logs < Endpoint
|
||||||
|
# Fetches a log by it's *id*.
|
||||||
|
get '/:id' do |id|
|
||||||
|
respond_with service(:find_log, params)
|
||||||
|
end
|
||||||
|
|
||||||
|
put '/:id' do |id|
|
||||||
|
# TODO @rkh ... rather lost in the auth/scopes code.
|
||||||
|
token = env['HTTP_TOKEN']
|
||||||
|
halt 403, 'no token' unless token
|
||||||
|
halt 403, 'internal' unless token == Travis.config.tokens.internal
|
||||||
|
respond_with service(:update_log, params)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,12 +1,12 @@
|
||||||
module Travis::Api::App::Responders
|
module Travis::Api::App::Responders
|
||||||
class Plain < Base
|
class Plain < Base
|
||||||
def apply?
|
def apply?
|
||||||
# make sure that we don't leak anything by processing only Artifact::Log
|
# make sure that we don't leak anything by processing only Log
|
||||||
# instances here. I don't want to create entire new API builder just
|
# instances here. I don't want to create entire new API builder just
|
||||||
# for log's content for now.
|
# for log's content for now.
|
||||||
#
|
#
|
||||||
# TODO: think how to handle other formats correctly
|
# TODO: think how to handle other formats correctly
|
||||||
options[:format] == 'txt' && resource.is_a?(Artifact::Log)
|
options[:format] == 'txt' && resource.is_a?(Log)
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply
|
def apply
|
||||||
|
|
Loading…
Reference in New Issue
Block a user