diff options
Diffstat (limited to 'bootstrap/pillar_config.rb')
| -rwxr-xr-x | bootstrap/pillar_config.rb | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/bootstrap/pillar_config.rb b/bootstrap/pillar_config.rb index 56bdb3d..6d9d3fb 100755 --- a/bootstrap/pillar_config.rb +++ b/bootstrap/pillar_config.rb @@ -1,6 +1,5 @@ #!/usr/bin/ruby -require_relative 'http_client' require 'digest' require 'getoptlong' require "json" @@ -28,40 +27,20 @@ def get_ip_address() end end -def get_jar_versions(yml, branch) - ret = Hash.new - begin - http_client = HttpClient.new(url: yml["jars"]["url"], - username: yml["jars"]["username"], - password: yml["jars"]["password"]) - http_client.do_http(method: :propfind) - http_client.response.each_line do |line| - if line =~ /D:href.*#{branch}.*\.jar/ - jar_name = line.chomp.split(/[<>]/)[2] - jarparts = jar_name.split(/\//) - name, *version_parts, junk1 = jarparts[jarparts.length - 1].split(".") - ret["#{name.gsub("-", "_").gsub("_#{branch}", "")}"] = { - "jar_name" => jarparts[jarparts.length - 1], - "jar_version" => version_parts.join("."), - "image_name" => "openbook_#{name.gsub("-", "_")}", - "container_name" => "#{name.gsub("-", "_")}", - "build_dir" => "/root/openbook_build/#{name.gsub("-", "_").gsub("_#{branch}", "")}" - } - end - end - rescue Exception => e - STDERR.puts "Error while contacting webdav endpoint: #{e.message}" - exit(1) - end - ret -end - -def process_yaml() +def process_yaml(branch) env_yaml_path = "#{File.dirname($0)}/config.yaml" if ! File.file?(env_yaml_path) STDERR.puts "Unable to find config.yaml. Exiting." exit(1) end + components = [ + "admin-api-server", + "customer-api-server", + "admin-web-ui", + "customer-web-ui", + "job-scheduler-server", + "workflow-server" + ] yml = YAML.load_file(env_yaml_path) yml["database"] = {} yml["database"]["image_name"] = "openbook_database" @@ -69,6 +48,14 @@ def process_yaml() yml["database"]["build_dir"] = "/root/openbook_build/database" yml["ansible"] = Hash.new yml["ansible"]["build_dir"] = "/root/openbook_build/ansible" + components.each do |component| + yml["#{component.gsub("-", "_")}"] = { + "jar_name" => "#{component}-#{branch}", + "image_name" => "openbook_#{component.gsub("-", "_")}_#{branch}", + "container_name" => "#{component.gsub("-", "_")}_#{branch}", + "build_dir" => "/root/openbook_build/#{component.gsub("-", "_")}" + } + end yml end @@ -83,8 +70,8 @@ def main() end end - yml = process_yaml() - puts yml.merge(get_jar_versions(yml, branch)).to_json + yml = process_yaml(branch) + puts yml.to_json end main() |
