#666: done
This commit is contained in:
parent
f9b9682c6d
commit
c7ea85c84c
@ -18,6 +18,7 @@ module Devops
|
|||||||
body = parser.deploy
|
body = parser.deploy
|
||||||
names = body["names"]
|
names = body["names"]
|
||||||
tags = body["tags"] || []
|
tags = body["tags"] || []
|
||||||
|
run_list = body["run_list"]
|
||||||
dir = DevopsConfig.config[:report_dir_v2]
|
dir = DevopsConfig.config[:report_dir_v2]
|
||||||
files = []
|
files = []
|
||||||
jid = nil
|
jid = nil
|
||||||
@ -33,6 +34,7 @@ module Devops
|
|||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
deploy_info = create_deploy_info(s, project, body["build_number"])
|
deploy_info = create_deploy_info(s, project, body["build_number"])
|
||||||
|
deploy_info["run_list"] = run_list if run_list
|
||||||
|
|
||||||
uri = Worker.start_async(DeployWorker, @request,
|
uri = Worker.start_async(DeployWorker, @request,
|
||||||
server_attrs: s.to_hash,
|
server_attrs: s.to_hash,
|
||||||
@ -70,6 +72,7 @@ module Devops
|
|||||||
body = parser.deploy
|
body = parser.deploy
|
||||||
names = body["names"]
|
names = body["names"]
|
||||||
tags = body["tags"] || []
|
tags = body["tags"] || []
|
||||||
|
run_list = body["run_list"]
|
||||||
status = []
|
status = []
|
||||||
owner = parser.current_user
|
owner = parser.current_user
|
||||||
@deploy_info_buf = {}
|
@deploy_info_buf = {}
|
||||||
@ -83,6 +86,7 @@ module Devops
|
|||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
deploy_info = create_deploy_info(s, project, body["build_number"])
|
deploy_info = create_deploy_info(s, project, body["build_number"])
|
||||||
|
deploy_info["run_list"] = run_list if run_list
|
||||||
res = Devops::Executor::ServerExecutor.new(s, out).deploy_server_with_tags(tags, deploy_info)
|
res = Devops::Executor::ServerExecutor.new(s, out).deploy_server_with_tags(tags, deploy_info)
|
||||||
status.push(res)
|
status.push(res)
|
||||||
rescue DeployInfoError => e
|
rescue DeployInfoError => e
|
||||||
|
|||||||
@ -10,6 +10,8 @@ module Devops
|
|||||||
names = check_array(r["names"], "Parameter 'names' should be a not empty array of strings")
|
names = check_array(r["names"], "Parameter 'names' should be a not empty array of strings")
|
||||||
tags = check_array(r["tags"], "Parameter 'tags' should be an array of strings", String, true)
|
tags = check_array(r["tags"], "Parameter 'tags' should be an array of strings", String, true)
|
||||||
build_number = check_string(r["build_number"], "Parameter 'build_number' should be a not empty string", true)
|
build_number = check_string(r["build_number"], "Parameter 'build_number' should be a not empty string", true)
|
||||||
|
rl = check_array(r["run_list"], "Parameter 'run_list' should be an array of string", String, true)
|
||||||
|
Validators::Helpers::RunList.new(rl).validate! unless rl.nil?
|
||||||
r
|
r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,8 @@ module Devops
|
|||||||
body = create_object_from_json_body
|
body = create_object_from_json_body
|
||||||
check_string(body["name"], "Parameter 'name' must be a not empty string")
|
check_string(body["name"], "Parameter 'name' must be a not empty string")
|
||||||
check_array(body["deploy_envs"], "Parameter 'deploy_envs' must be a not empty array of objects", Hash)
|
check_array(body["deploy_envs"], "Parameter 'deploy_envs' must be a not empty array of objects", Hash)
|
||||||
# check_array(body["run_list"], "Parameter 'run_list' must be a not empty array of string", String, false, true)
|
rl = check_array(body["run_list"], "Parameter 'run_list' should be an array of string", String, true)
|
||||||
|
Validators::Helpers::RunList.new(rl).validate! unless rl.nil?
|
||||||
Devops::Model::Project.new(body)
|
Devops::Model::Project.new(body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,8 @@ module Devops
|
|||||||
# {
|
# {
|
||||||
# "names": [], -> array of servers names to run chef-client
|
# "names": [], -> array of servers names to run chef-client
|
||||||
# "tags": [], -> array of tags to apply on each server before running chef-client
|
# "tags": [], -> array of tags to apply on each server before running chef-client
|
||||||
# "build_number": "" -> string, build number to deploy
|
# "build_number": "", -> string, build number to deploy
|
||||||
|
# "run_list": [], -> array of strings to set run_list for chef-client
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# * *Returns* : text stream
|
# * *Returns* : text stream
|
||||||
|
|||||||
@ -365,6 +365,10 @@ module Devops
|
|||||||
|
|
||||||
def create_run_list out, deploy_info
|
def create_run_list out, deploy_info
|
||||||
out << "\nGenerate run list hook...\n"
|
out << "\nGenerate run list hook...\n"
|
||||||
|
if deploy_info["run_list"]
|
||||||
|
out << "Deploy info already contains 'run_list': #{deploy_info["run_list"].join(",")}\n"
|
||||||
|
return
|
||||||
|
end
|
||||||
out << "Project run list: #{@project.run_list.join(", ")}\n"
|
out << "Project run list: #{@project.run_list.join(", ")}\n"
|
||||||
out << "Deploy environment run list: #{@deploy_env.run_list.join(", ")}\n"
|
out << "Deploy environment run list: #{@deploy_env.run_list.join(", ")}\n"
|
||||||
out << "Server run list: #{@server.run_list.join(", ")}\n"
|
out << "Server run list: #{@server.run_list.join(", ")}\n"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user