Merge branch 'dev' of git.stu.neva.ru:cloudtechlab/devops-service into achuchkalov
Conflicts: devops-service/config.ru devops-service/report.rb
This commit is contained in:
commit
81521ee52b
@ -19,14 +19,14 @@ else
|
|||||||
raise "No config file '#{config_file}' found"
|
raise "No config file '#{config_file}' found"
|
||||||
end
|
end
|
||||||
|
|
||||||
config[:devops_home] = File.join(ENV["HOME"], ".devops")
|
config[:devops_dir] = File.join(ENV["HOME"], ".devops") if config[:devops_dir].nil?
|
||||||
puts "Devops home: #{config[:devops_home]}"
|
puts "Devops home: #{config[:devops_dir]}"
|
||||||
unless File.exists?(config[:devops_home])
|
unless File.exists?(config[:devops_dir])
|
||||||
FileUtils.mkdir config[:devops_home]
|
FileUtils.mkdir_p config[:devops_dir]
|
||||||
puts "Directory '#{config[:devops_home]}' has been created"
|
puts "Directory '#{config[:devops_dir]}' has been created"
|
||||||
end
|
end
|
||||||
|
|
||||||
config[:report_dir_v2] = File.expand_path(File.join(config[:devops_home], "report", "v2")) unless config[:report_dir_v2]
|
config[:report_dir_v2] = File.expand_path(File.join(config[:devops_dir], "report", "v2")) unless config[:report_dir_v2]
|
||||||
[
|
[
|
||||||
:report_dir_v2
|
:report_dir_v2
|
||||||
].each {|key| d = config[key]; FileUtils.mkdir_p(d) unless File.exists?(d) }
|
].each {|key| d = config[key]; FileUtils.mkdir_p(d) unless File.exists?(d) }
|
||||||
@ -34,7 +34,7 @@ config[:report_dir_v2] = File.expand_path(File.join(config[:devops_home], "repor
|
|||||||
run Rack::URLMap.new({
|
run Rack::URLMap.new({
|
||||||
"#{config[:url_prefix]}/v2.0" => DevopsService.new(config),
|
"#{config[:url_prefix]}/v2.0" => DevopsService.new(config),
|
||||||
"#{config[:url_prefix]}/client" => Client.new(config),
|
"#{config[:url_prefix]}/client" => Client.new(config),
|
||||||
"#{config[:url_prefix]}/v2.0/report" => ReportServer.new(config, "v2"),
|
"#{config[:url_prefix]}/v2.0/report" => ReportRoutes.new(config, "v2"),
|
||||||
"#{config[:url_prefix]}/sidekiq" => Sidekiq::Web,
|
"#{config[:url_prefix]}/sidekiq" => Sidekiq::Web,
|
||||||
"#{config[:url_prefix]}/version" => DevopsVersion.new
|
"#{config[:url_prefix]}/version" => DevopsVersion.new
|
||||||
})
|
})
|
||||||
|
|||||||
@ -364,7 +364,7 @@ class MongoConnector
|
|||||||
|
|
||||||
def save_report r
|
def save_report r
|
||||||
r.created_at = Time.new
|
r.created_at = Time.new
|
||||||
@reports.insert(r.to_hash)
|
@reports.insert(r.to_mongo_hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reports
|
def reports
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
require 'sinatra/base'
|
require 'sinatra/base'
|
||||||
|
|
||||||
class ReportServer < Sinatra::Base
|
class ReportRoutes < Sinatra::Base
|
||||||
|
|
||||||
def initialize config, version
|
def initialize config, version
|
||||||
super()
|
super()
|
||||||
|
|||||||
@ -405,7 +405,7 @@ module Version2_0
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
dir = DevopsService.config[:deploy_report_dir_v2]
|
dir = DevopsService.config[:report_dir_v2]
|
||||||
files = []
|
files = []
|
||||||
uri = URI.parse(request.url)
|
uri = URI.parse(request.url)
|
||||||
servers.each do |s|
|
servers.each do |s|
|
||||||
@ -416,7 +416,7 @@ module Version2_0
|
|||||||
end
|
end
|
||||||
jid = DeployWorker.perform_async(dir, s.to_hash, [], DevopsService.config)
|
jid = DeployWorker.perform_async(dir, s.to_hash, [], DevopsService.config)
|
||||||
logger.info "Job '#{jid}' has been started"
|
logger.info "Job '#{jid}' has been started"
|
||||||
uri.path = "#{DevopsService.config[:url_prefix]}/v2.0/report/deploy/" + jid
|
uri.path = "#{DevopsService.config[:url_prefix]}/v2.0/report/" + jid
|
||||||
files.push uri.to_s
|
files.push uri.to_s
|
||||||
end
|
end
|
||||||
json files
|
json files
|
||||||
|
|||||||
10
devops-service/version.rb
Normal file
10
devops-service/version.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
require 'sinatra/base'
|
||||||
|
|
||||||
|
class DevopsVersion < Sinatra::Base
|
||||||
|
|
||||||
|
VERSION = "2.0.1"
|
||||||
|
|
||||||
|
get "/" do
|
||||||
|
VERSION
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue
Block a user