-
Notifications
You must be signed in to change notification settings - Fork 21
/
load_realease.rb
39 lines (33 loc) · 1.09 KB
/
load_realease.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env ruby
require 'json'
data = File.read("release.json")
versions = JSON.parse(data)
if ! ENV.key?("RELEASE_VERSION")
abort("Error: RELEASE_VERSION environment variable is not set")
end
if ! versions.key?(ENV["RELEASE_VERSION"])
abort("Error: version '#{ENV["RELEASE_VERSION"]}' does not exists in release.json")
end
release = versions[ENV["RELEASE_VERSION"]]
# checking that all mandatory variables are present in the release instead of
# failing later in the build
[
"AGENT_VERSION",
"AGENT_BRANCH",
"AGENT6_BRANCH",
"INTEGRATIONS_CORE_BRANCH",
"TRACE_AGENT_BRANCH",
"TRACE_AGENT_ADD_BUILD_VARS",
"PROCESS_AGENT_BRANCH",
"OMNIBUS_RUBY_BRANCH",
"OMNIBUS_SOFTWARE_BRANCH",
].each do |var|
if !release.key?(var)
abort("Error: missing '#{var}' variable in the '#{ENV["RELEASE_VERSION"]}' release. Add it to the release.json file.")
end
if release[var] == "" or release[var].nil?
abort("Error: variable '#{var}' in the '#{ENV["RELEASE_VERSION"]}' is empty.")
end
end
# printing every variables so they can be easily loaded by omnibus_build.sh
release.each do |k, v| puts "#{k} #{v}" end