vanagon 0.18.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bin/build +3 -1
- data/bin/build_host_info +3 -1
- data/bin/build_requirements +3 -1
- data/bin/inspect +3 -1
- data/bin/render +3 -1
- data/bin/repo +3 -1
- data/bin/ship +3 -1
- data/bin/sign +3 -1
- data/lib/vanagon/cli.rb +4 -2
- data/lib/vanagon/cli/build.rb +2 -1
- data/lib/vanagon/cli/build_host_info.rb +3 -2
- data/lib/vanagon/cli/build_requirements.rb +4 -4
- data/lib/vanagon/cli/completion.rb +4 -3
- data/lib/vanagon/cli/inspect.rb +3 -2
- data/lib/vanagon/cli/list.rb +16 -6
- data/lib/vanagon/cli/render.rb +2 -1
- data/lib/vanagon/cli/ship.rb +4 -19
- data/lib/vanagon/cli/sign.rb +3 -2
- data/lib/vanagon/component.rb +13 -10
- data/lib/vanagon/component/dsl.rb +27 -20
- data/lib/vanagon/component/source.rb +2 -1
- data/lib/vanagon/component/source/git.rb +35 -10
- data/lib/vanagon/component/source/http.rb +3 -2
- data/lib/vanagon/component/source/local.rb +2 -1
- data/lib/vanagon/component/source/rewrite.rb +3 -2
- data/lib/vanagon/driver.rb +20 -23
- data/lib/vanagon/engine/always_be_scheduling.rb +12 -11
- data/lib/vanagon/engine/docker.rb +2 -1
- data/lib/vanagon/engine/ec2.rb +5 -4
- data/lib/vanagon/engine/hardware.rb +4 -3
- data/lib/vanagon/engine/pooler.rb +6 -5
- data/lib/vanagon/environment.rb +3 -2
- data/lib/vanagon/logger.rb +31 -0
- data/lib/vanagon/platform.rb +38 -5
- data/lib/vanagon/platform/defaults/debian-10-amd64.rb +11 -0
- data/lib/vanagon/platform/defaults/debian-8-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-8-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-9-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/debian-9-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/el-6-i386.rb +11 -0
- data/lib/vanagon/platform/defaults/el-6-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/el-7-aarch64.rb +13 -0
- data/lib/vanagon/platform/defaults/el-7-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/el-8-aarch64.rb +10 -0
- data/lib/vanagon/platform/defaults/el-8-x86_64.rb +10 -0
- data/lib/vanagon/platform/defaults/fedora-30-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/fedora-31-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/fedora-32-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/osx-10.14-x86_64.rb +22 -0
- data/lib/vanagon/platform/defaults/osx-10.15-x86_64.rb +21 -0
- data/lib/vanagon/platform/defaults/redhatfips-7-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/sles-12-x86_64.rb +11 -0
- data/lib/vanagon/platform/defaults/sles-15-x86_64.rb +10 -0
- data/lib/vanagon/platform/defaults/solaris-11-i386.rb +9 -0
- data/lib/vanagon/platform/defaults/solaris-11-sparc.rb +10 -0
- data/lib/vanagon/platform/defaults/ubuntu-16.04-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-16.04-i386.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-18.04-amd64.rb +12 -0
- data/lib/vanagon/platform/defaults/ubuntu-20.04-aarch64.rb +11 -0
- data/lib/vanagon/platform/defaults/ubuntu-20.04-amd64.rb +11 -0
- data/lib/vanagon/platform/dsl.rb +30 -6
- data/lib/vanagon/platform/windows.rb +3 -1
- data/lib/vanagon/project.rb +25 -15
- data/lib/vanagon/project/dsl.rb +6 -5
- data/lib/vanagon/utilities.rb +5 -4
- data/resources/deb/control.erb +1 -1
- data/resources/deb/postinst.erb +24 -13
- data/resources/deb/postrm.erb +9 -6
- data/resources/deb/prerm.erb +18 -8
- data/resources/osx/postinstall.erb +6 -2
- data/resources/rpm/project.spec.erb +12 -12
- data/resources/solaris/10/depend.erb +2 -2
- data/resources/solaris/10/postinstall.erb +11 -3
- data/resources/solaris/11/p5m.erb +2 -2
- data/spec/lib/vanagon/cli_spec.rb +57 -9
- data/spec/lib/vanagon/component/dsl_spec.rb +54 -10
- data/spec/lib/vanagon/component/source/git_spec.rb +4 -4
- data/spec/lib/vanagon/component_spec.rb +15 -2
- data/spec/lib/vanagon/engine/always_be_scheduling_spec.rb +4 -4
- data/spec/lib/vanagon/platform_spec.rb +80 -0
- data/spec/lib/vanagon/utilities_spec.rb +4 -1
- metadata +58 -31
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/component'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'vanagon/patch'
|
3
4
|
require 'ostruct'
|
4
5
|
require 'json'
|
@@ -131,8 +132,8 @@ class Vanagon
|
|
131
132
|
# component
|
132
133
|
#
|
133
134
|
# @param requirement [String] a package that is required at runtime for this component
|
134
|
-
def requires(requirement)
|
135
|
-
@component.requires << requirement
|
135
|
+
def requires(requirement, version = nil)
|
136
|
+
@component.requires << OpenStruct.new(:requirement => requirement, :version => version)
|
136
137
|
end
|
137
138
|
|
138
139
|
# Indicates that this component replaces a system level package. Replaces can be collected and used by the project and package.
|
@@ -167,37 +168,42 @@ class Vanagon
|
|
167
168
|
# @param service_file [String] path to the service file relative to the source
|
168
169
|
# @param default_file [String] path to the default file relative to the source
|
169
170
|
# @param service_name [String] name of the service
|
170
|
-
# @param
|
171
|
-
#
|
172
|
-
|
173
|
-
|
171
|
+
# @param options optional extra parameters
|
172
|
+
# service_type [String] type of the service (network, application, system, etc)
|
173
|
+
# init_system [String] the init system on which to install service (sysv, systemd)
|
174
|
+
# link_target [String] executable service file should be linked to
|
175
|
+
def install_service(service_file, default_file = nil, service_name = @component.name, **options) # rubocop:disable Metrics/AbcSize
|
176
|
+
init_system = options[:init_system] || @component.platform.servicetype
|
177
|
+
servicedir = @component.platform.get_service_dir(init_system)
|
178
|
+
|
179
|
+
case init_system
|
174
180
|
when "sysv"
|
175
|
-
target_service_file = File.join(
|
181
|
+
target_service_file = File.join(servicedir, service_name)
|
176
182
|
target_default_file = File.join(@component.platform.defaultdir, service_name)
|
177
183
|
target_mode = '0755'
|
178
184
|
default_mode = '0644'
|
179
185
|
when "systemd"
|
180
|
-
target_service_file = File.join(
|
186
|
+
target_service_file = File.join(servicedir, "#{service_name}.service")
|
181
187
|
target_default_file = File.join(@component.platform.defaultdir, service_name)
|
182
188
|
target_mode = '0644'
|
183
189
|
default_mode = '0644'
|
184
190
|
when "launchd"
|
185
|
-
target_service_file = File.join(
|
191
|
+
target_service_file = File.join(servicedir, "#{service_name}.plist")
|
186
192
|
target_mode = '0644'
|
187
193
|
default_mode = '0644'
|
188
194
|
when "smf"
|
189
195
|
# modify version in smf manifest so service gets restarted after package upgrade
|
190
196
|
@component.install << %{#{@component.platform.sed} -ri 's/(<service.*version=)(".*")/\\1"#{Time.now.to_i}"/' #{service_file}}
|
191
|
-
target_service_file = File.join(
|
197
|
+
target_service_file = File.join(servicedir, options[:service_type].to_s, "#{service_name}.xml")
|
192
198
|
target_default_file = File.join(@component.platform.defaultdir, service_name)
|
193
199
|
target_mode = '0644'
|
194
200
|
default_mode = '0755'
|
195
201
|
when "aix"
|
196
|
-
@component.service
|
202
|
+
@component.service << OpenStruct.new(:name => service_name, :service_command => File.read(service_file).chomp)
|
197
203
|
# Return here because there is no file to install, just a string read in
|
198
204
|
return
|
199
205
|
when "windows"
|
200
|
-
@component.service
|
206
|
+
@component.service << OpenStruct.new(\
|
201
207
|
:bindir_id => "#{service_name.gsub(/[^A-Za-z0-9]/, '').upcase}BINDIR", \
|
202
208
|
:service_file => service_file, \
|
203
209
|
:component_group_id => "#{service_name.gsub(/[^A-Za-z0-9]/, '')}Component"\
|
@@ -205,13 +211,13 @@ class Vanagon
|
|
205
211
|
# return here as we are just collecting the name of the service file to put into the harvest filter list.
|
206
212
|
return
|
207
213
|
else
|
208
|
-
fail "Don't know how to install the #{
|
214
|
+
fail "Don't know how to install the #{init_system}. Please teach #install_service how to do this."
|
209
215
|
end
|
210
216
|
|
211
217
|
# Install the service and default files
|
212
|
-
if link_target
|
213
|
-
install_file(service_file, link_target, mode: target_mode)
|
214
|
-
link link_target, target_service_file
|
218
|
+
if options[:link_target]
|
219
|
+
install_file(service_file, options[:link_target], mode: target_mode)
|
220
|
+
link options[:link_target], target_service_file
|
215
221
|
else
|
216
222
|
install_file(service_file, target_service_file, mode: target_mode)
|
217
223
|
end
|
@@ -222,7 +228,8 @@ class Vanagon
|
|
222
228
|
end
|
223
229
|
|
224
230
|
# Register the service for use in packaging
|
225
|
-
@component.service
|
231
|
+
@component.service << OpenStruct.new(:name => service_name, :service_file => target_service_file,
|
232
|
+
:type => options[:service_type], :init_system => init_system)
|
226
233
|
end
|
227
234
|
|
228
235
|
# Copies a file from source to target during the install phase of the component
|
@@ -237,7 +244,7 @@ class Vanagon
|
|
237
244
|
|
238
245
|
if @component.platform.is_windows?
|
239
246
|
unless mode.nil? && owner.nil? && group.nil?
|
240
|
-
|
247
|
+
VanagonLogger.info "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!"
|
241
248
|
end
|
242
249
|
else
|
243
250
|
mode ||= '0644'
|
@@ -407,7 +414,7 @@ class Vanagon
|
|
407
414
|
install_flags = ['-d']
|
408
415
|
if @component.platform.is_windows?
|
409
416
|
unless mode.nil? && owner.nil? && group.nil?
|
410
|
-
|
417
|
+
VanagonLogger.info "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!"
|
411
418
|
end
|
412
419
|
else
|
413
420
|
install_flags << "-m '#{mode}'" unless mode.nil?
|
@@ -422,7 +429,7 @@ class Vanagon
|
|
422
429
|
# @param env [Hash] mapping of keys to values to add to the environment for the component
|
423
430
|
def environment(*env)
|
424
431
|
if env.size == 1 && env.first.is_a?(Hash)
|
425
|
-
|
432
|
+
VanagonLogger.info <<-WARNING.undent
|
426
433
|
the component DSL method signature #environment({Key => Value}) is deprecated
|
427
434
|
and will be removed by Vanagon 1.0.0.
|
428
435
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fustigit'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'vanagon/component/source/http'
|
3
4
|
require 'vanagon/component/source/git'
|
4
5
|
require 'vanagon/component/source/local'
|
@@ -66,7 +67,7 @@ class Vanagon
|
|
66
67
|
timeout = 5
|
67
68
|
if Vanagon::Component::Source::Git.valid_remote?(uri, timeout)
|
68
69
|
if uri =~ /^http/
|
69
|
-
|
70
|
+
VanagonLogger.info "Passing git URLs as http(s) addresses is deprecated! Please prefix your source URL with `git:`"
|
70
71
|
end
|
71
72
|
return :git
|
72
73
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'vanagon/utilities'
|
2
2
|
require 'vanagon/errors'
|
3
|
+
require 'vanagon/logger'
|
3
4
|
# This stupid library requires a capital 'E' in its name
|
4
5
|
# but it provides a wealth of useful constants
|
5
6
|
require 'English'
|
@@ -25,14 +26,38 @@ class Vanagon
|
|
25
26
|
# git command has failed. Useful in instances where a URL
|
26
27
|
# prompts for credentials despite not being a git remote
|
27
28
|
# @return [Boolean] whether #url is a valid Git repo or not
|
29
|
+
|
30
|
+
# [RE-13837] This ought to be the way to do this. Unfortunately,
|
31
|
+
# there's a bug in Git.ls_remote that when ssh prints something like
|
32
|
+
# Warning: Permanently added 'github.com,192.30.255.113' (RSA)
|
33
|
+
# Git.ls_remote attempts to parse it as actual git output and fails
|
34
|
+
# with: NoMethodError: undefined method `split' for nil:NilClass
|
35
|
+
#
|
36
|
+
# We'll work around that case by calling 'git ls-remote' directly ourselves.
|
37
|
+
#
|
38
|
+
# I'm leaving in the broken version here for a time when the ruby-git library
|
39
|
+
# is fixed.
|
40
|
+
|
41
|
+
#def valid_remote?(url, timeout = 0)
|
42
|
+
# Timeout.timeout(timeout) do
|
43
|
+
# !!::Git.ls_remote(url)
|
44
|
+
# end
|
45
|
+
#rescue ::Git::GitExecuteError
|
46
|
+
# false
|
47
|
+
#rescue Timeout::Error
|
48
|
+
# false
|
49
|
+
#end
|
50
|
+
|
28
51
|
def valid_remote?(url, timeout = 0)
|
29
52
|
Timeout.timeout(timeout) do
|
30
|
-
|
53
|
+
Vanagon::Utilities.local_command("git ls-remote #{url} > /dev/null 2>&1")
|
54
|
+
return false unless $?.exitstatus.zero?
|
55
|
+
return true
|
31
56
|
end
|
32
|
-
rescue ::Git::GitExecuteError
|
33
|
-
false
|
34
57
|
rescue Timeout::Error
|
35
|
-
false
|
58
|
+
return false
|
59
|
+
rescue RuntimeError
|
60
|
+
return false
|
36
61
|
end
|
37
62
|
end
|
38
63
|
|
@@ -81,7 +106,7 @@ class Vanagon
|
|
81
106
|
# There is no md5 to manually verify here, so this is a noop.
|
82
107
|
def verify
|
83
108
|
# nothing to do here, so just tell users that and return
|
84
|
-
|
109
|
+
VanagonLogger.info "Nothing to verify for '#{dirname}' (using Git reference '#{ref}')"
|
85
110
|
end
|
86
111
|
|
87
112
|
# The dirname to reference when building from the repo
|
@@ -131,8 +156,8 @@ class Vanagon
|
|
131
156
|
# Clone a remote repo, make noise about it, and fail entirely
|
132
157
|
# if we're unable to retrieve the remote repo
|
133
158
|
def clone!
|
134
|
-
|
135
|
-
|
159
|
+
VanagonLogger.info "Cloning Git repo '#{url}'"
|
160
|
+
VanagonLogger.info "Successfully cloned '#{dirname}'" if clone
|
136
161
|
rescue ::Git::GitExecuteError
|
137
162
|
raise Vanagon::InvalidRepo, "Unable to clone from '#{url}'"
|
138
163
|
end
|
@@ -141,7 +166,7 @@ class Vanagon
|
|
141
166
|
# Checkout desired ref/sha, make noise about it, and fail
|
142
167
|
# entirely if we're unable to checkout that given ref/sha
|
143
168
|
def checkout!
|
144
|
-
|
169
|
+
VanagonLogger.info "Checking out '#{ref}' from Git repo '#{dirname}'"
|
145
170
|
clone.checkout(ref)
|
146
171
|
rescue ::Git::GitExecuteError
|
147
172
|
raise Vanagon::CheckoutFailed, "unable to checkout #{ref} from '#{url}'"
|
@@ -151,7 +176,7 @@ class Vanagon
|
|
151
176
|
# Attempt to update submodules, and do not panic
|
152
177
|
# if there are no submodules to initialize
|
153
178
|
def update_submodules
|
154
|
-
|
179
|
+
VanagonLogger.info "Attempting to update submodules for repo '#{dirname}'"
|
155
180
|
clone.update_submodules(init: true)
|
156
181
|
end
|
157
182
|
private :update_submodules
|
@@ -163,7 +188,7 @@ class Vanagon
|
|
163
188
|
def describe
|
164
189
|
clone.describe(ref, tags: true)
|
165
190
|
rescue ::Git::GitExecuteError
|
166
|
-
|
191
|
+
VanagonLogger.info "Directory '#{dirname}' cannot be versioned by Git. Maybe it hasn't been tagged yet?"
|
167
192
|
end
|
168
193
|
private :describe
|
169
194
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/utilities'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
require 'vanagon/component/source/local'
|
3
4
|
require 'net/http'
|
4
5
|
require 'uri'
|
@@ -93,7 +94,7 @@ class Vanagon
|
|
93
94
|
#
|
94
95
|
# @raise [RuntimeError] an exception is raised if the sum does not match the sum of the file
|
95
96
|
def verify # rubocop:disable Metrics/AbcSize
|
96
|
-
|
97
|
+
VanagonLogger.info "Verifying file: #{file} against sum: '#{sum}'"
|
97
98
|
actual = get_sum(File.join(workdir, file), sum_type)
|
98
99
|
return true if sum == actual
|
99
100
|
|
@@ -107,7 +108,7 @@ class Vanagon
|
|
107
108
|
uri = URI.parse(target_url.to_s)
|
108
109
|
target_file ||= File.basename(uri.path)
|
109
110
|
|
110
|
-
|
111
|
+
VanagonLogger.info "Downloading file '#{target_file}' from url '#{target_url}'"
|
111
112
|
|
112
113
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
113
114
|
http.request(Net::HTTP::Get.new(uri, headers)) do |response|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/utilities'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
|
3
4
|
class Vanagon
|
4
5
|
class Component
|
@@ -57,7 +58,7 @@ class Vanagon
|
|
57
58
|
#
|
58
59
|
# @raise [RuntimeError, Vanagon::Error] an exception is raised if the URI scheme cannot be handled
|
59
60
|
def copy
|
60
|
-
|
61
|
+
VanagonLogger.info "Copying file '#{url.basename}' to workdir"
|
61
62
|
|
62
63
|
FileUtils.cp_r(url, file)
|
63
64
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vanagon/component/source'
|
2
|
+
require 'vanagon/logger'
|
2
3
|
|
3
4
|
class Vanagon
|
4
5
|
class Component
|
@@ -16,7 +17,7 @@ class Vanagon
|
|
16
17
|
# @deprecated Please use the component DSL method #mirror(<URI>)
|
17
18
|
# instead. This method will be removed before Vanagon 1.0.0.
|
18
19
|
def register_rewrite_rule(protocol, rule)
|
19
|
-
|
20
|
+
VanagonLogger.info <<-HERE.undent
|
20
21
|
rewrite rule support is deprecated and will be removed before Vanagon 1.0.0.
|
21
22
|
Rewritten URLs will be automatically converted into mirror URLs for now but
|
22
23
|
please use the component DSL method '#mirror url' to define new mirror URL
|
@@ -76,7 +77,7 @@ class Vanagon
|
|
76
77
|
def parse_and_rewrite(uri)
|
77
78
|
return uri if rewrite_rules.empty?
|
78
79
|
if !!uri.match(/^git:http/)
|
79
|
-
|
80
|
+
VanagonLogger.info <<-HERE.undent
|
80
81
|
`fustigit` parsing doesn't get along with how we specify the source
|
81
82
|
type by prefixing `git`. As `rewrite_rules` are deprecated, we'll
|
82
83
|
replace `git:http` with `http` in your uri. At some point this will
|
data/lib/vanagon/driver.rb
CHANGED
@@ -4,6 +4,7 @@ require 'vanagon/component'
|
|
4
4
|
require 'vanagon/utilities'
|
5
5
|
require 'vanagon/common'
|
6
6
|
require 'vanagon/errors'
|
7
|
+
require 'vanagon/logger'
|
7
8
|
require 'tmpdir'
|
8
9
|
require 'logger'
|
9
10
|
|
@@ -50,32 +51,28 @@ class Vanagon
|
|
50
51
|
# flatten all the results in to one array and set project.components to that.
|
51
52
|
@project.components = only_build.flat_map { |comp| @project.filter_component(comp) }.uniq
|
52
53
|
if @verbose
|
53
|
-
|
54
|
-
@project.components.each { |comp|
|
54
|
+
VanagonLogger.info "Only building:"
|
55
|
+
@project.components.each { |comp| VanagonLogger.info comp.name }
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
59
|
def pick_engine(options) # rubocop:disable Metrics/PerceivedComplexity
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
return default_engine
|
60
|
+
if options[:engine] && !options[:target]
|
61
|
+
options[:engine]
|
62
|
+
elsif @platform.build_hosts
|
63
|
+
'hardware'
|
64
|
+
elsif @platform.aws_ami
|
65
|
+
'ec2'
|
66
|
+
elsif @platform.docker_image
|
67
|
+
'docker'
|
68
|
+
elsif options[:target]
|
69
|
+
'base'
|
70
|
+
else
|
71
|
+
'always_be_scheduling'
|
72
|
+
end
|
74
73
|
end
|
75
74
|
|
76
75
|
def load_engine_object(engine_type, platform, target)
|
77
|
-
engine_type = 'base' if target
|
78
|
-
|
79
76
|
require "vanagon/engine/#{engine_type}"
|
80
77
|
@engine = Object::const_get("Vanagon::Engine::#{camelize(engine_type)}")
|
81
78
|
.new(platform, target, remote_workdir: remote_workdir)
|
@@ -138,7 +135,7 @@ class Vanagon
|
|
138
135
|
end
|
139
136
|
|
140
137
|
@engine.startup(workdir)
|
141
|
-
|
138
|
+
VanagonLogger.info "Target is #{@engine.target}"
|
142
139
|
Vanagon::Utilities.retry_with_timeout(retry_count, timeout) do
|
143
140
|
install_build_dependencies
|
144
141
|
end
|
@@ -163,8 +160,8 @@ class Vanagon
|
|
163
160
|
@engine.teardown
|
164
161
|
cleanup_workdir
|
165
162
|
end
|
166
|
-
|
167
|
-
|
163
|
+
VanagonLogger.error(e)
|
164
|
+
VanagonLogger.error e.backtrace.join("\n")
|
168
165
|
raise e
|
169
166
|
ensure
|
170
167
|
if ["hardware", "ec2"].include?(@engine.name)
|
@@ -178,7 +175,7 @@ class Vanagon
|
|
178
175
|
raise Vanagon::Error, "Project requires a version set, all is lost."
|
179
176
|
end
|
180
177
|
|
181
|
-
|
178
|
+
VanagonLogger.info "rendering Makefile"
|
182
179
|
@project.fetch_sources(workdir, retry_count, timeout)
|
183
180
|
@project.make_bill_of_materials(workdir)
|
184
181
|
@project.generate_packaging_artifacts(workdir)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'vanagon/engine/base'
|
3
|
+
require 'vanagon/logger'
|
3
4
|
require 'yaml'
|
4
5
|
|
5
6
|
class Vanagon
|
@@ -141,14 +142,14 @@ class Vanagon
|
|
141
142
|
absolute_path = File.expand_path(path)
|
142
143
|
return nil unless File.exist?(absolute_path)
|
143
144
|
|
144
|
-
|
145
|
+
VanagonLogger.info "Reading ABS token from: #{path}"
|
145
146
|
contents = File.read(absolute_path).chomp
|
146
147
|
lines = contents.each_line.map(&:chomp)
|
147
148
|
|
148
149
|
abs = lines.shift
|
149
150
|
@token_vmpooler = lines.shift
|
150
151
|
|
151
|
-
|
152
|
+
VanagonLogger.info "Please add a second line with the vmpooler token to be able to modify or see the VM in floaty/bit-bar" if @token_vmpooler.nil?
|
152
153
|
return abs
|
153
154
|
end
|
154
155
|
private :read_vanagon_token
|
@@ -217,7 +218,7 @@ class Vanagon
|
|
217
218
|
message.concat(" with a vmpooler_fallback token")
|
218
219
|
end
|
219
220
|
end
|
220
|
-
|
221
|
+
VanagonLogger.info message
|
221
222
|
return abs_token
|
222
223
|
end
|
223
224
|
private :read_vmfloaty_token
|
@@ -235,7 +236,7 @@ class Vanagon
|
|
235
236
|
def select_target_from(pooler) # rubocop:disable Metrics/AbcSize
|
236
237
|
request_object = build_request_object
|
237
238
|
|
238
|
-
|
239
|
+
VanagonLogger.info "Requesting VMs with job_id: #{@saved_job_id}. Will poll for up to an hour."
|
239
240
|
#the initial request is always replied with "come back again"
|
240
241
|
response = Vanagon::Utilities.http_request_generic(
|
241
242
|
"#{pooler}/request",
|
@@ -245,10 +246,10 @@ class Vanagon
|
|
245
246
|
)
|
246
247
|
|
247
248
|
unless response.code == "202"
|
248
|
-
|
249
|
+
VanagonLogger.info "failed to request ABS with code #{response.code}"
|
249
250
|
if valid_json?(response.body)
|
250
251
|
response_json = JSON.parse(response.body)
|
251
|
-
|
252
|
+
VanagonLogger.info "reason: #{response_json['reason']}"
|
252
253
|
end
|
253
254
|
return ''
|
254
255
|
end
|
@@ -278,12 +279,12 @@ class Vanagon
|
|
278
279
|
|
279
280
|
sleep_seconds = 10 if i >= 10
|
280
281
|
sleep_seconds = i if i < 10
|
281
|
-
|
282
|
+
VanagonLogger.info "Waiting #{sleep_seconds} seconds to check if ABS request has been filled. (x#{i})"
|
282
283
|
|
283
284
|
sleep(sleep_seconds)
|
284
285
|
end
|
285
286
|
rescue SystemExit, Interrupt
|
286
|
-
|
287
|
+
VanagonLogger.error "\nVanagon interrupted during mains ABS polling. Make sure you delete the requested job_id #{@saved_job_id}"
|
287
288
|
raise
|
288
289
|
end
|
289
290
|
response_body = translated(response_body, @saved_job_id)
|
@@ -321,14 +322,14 @@ class Vanagon
|
|
321
322
|
)
|
322
323
|
if response && response.body == 'OK'
|
323
324
|
Vanagon::Driver.logger.info "#{@saved_job_id} has been scheduled for removal"
|
324
|
-
|
325
|
+
VanagonLogger.info "#{@saved_job_id} has been scheduled for removal"
|
325
326
|
else
|
326
327
|
Vanagon::Driver.logger.info "#{@saved_job_id} could not be scheduled for removal: #{response.body}"
|
327
|
-
|
328
|
+
VanagonLogger.info "#{@saved_job_id} could not be scheduled for removal"
|
328
329
|
end
|
329
330
|
rescue Vanagon::Error => e
|
330
331
|
Vanagon::Driver.logger.info "#{@saved_job_id} could not be scheduled for removal (#{e.message})"
|
331
|
-
|
332
|
+
VanagonLogger.info "#{@saved_job_id} could not be scheduled for removal (#{e.message})"
|
332
333
|
end
|
333
334
|
|
334
335
|
private
|