nutkins 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/nutkins.rb +24 -19
- data/lib/nutkins/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9873753bcc6bffb9546adf4022433732facc78c0
|
4
|
+
data.tar.gz: 15bfa779ab8115550d137f02ebb1591524ff4763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec0681915beb261b91a511ec5f5bcd79b46722df1f230d5cbb3caf025ba6182ea99ce236f2a4bf0f8b82fd1666a7bb0824f6a1bff79d16fdeab5f257f261527
|
7
|
+
data.tar.gz: cd44f7e126e9feaf8253d0c0b6c94874b712ba168857657bcec282897761de689ba659d4ffb0a3e2d43ad3857b78f93da8636403536bf891f83b02d9e6a6130a
|
data/lib/nutkins.rb
CHANGED
@@ -15,6 +15,9 @@ require "nutkins/version"
|
|
15
15
|
|
16
16
|
require_relative "hash_dig"
|
17
17
|
|
18
|
+
# throughout this file "path" is a directory, it should be "." or a single path like "directory"
|
19
|
+
# which should correspond to a directory within the project root containing a nutkin.yaml
|
20
|
+
|
18
21
|
# Must be somedomain.net instead of somedomain.net/, otherwise, it will throw exception.
|
19
22
|
module Nutkins
|
20
23
|
CONFIG_FILE_NAME = 'nutkins.yaml'
|
@@ -48,9 +51,11 @@ module Nutkins
|
|
48
51
|
# TODO: flag to suppress building base image?
|
49
52
|
base = cfg['base']
|
50
53
|
unless @built[base]
|
51
|
-
|
54
|
+
base_cfg = config_for_image base
|
55
|
+
if base_cfg
|
56
|
+
base_path = base_cfg['path']
|
52
57
|
puts "building parent of #{img_name}: #{base}"
|
53
|
-
build
|
58
|
+
build base_path
|
54
59
|
end
|
55
60
|
end
|
56
61
|
prev_image_id = Docker.image_id_for_tag tag
|
@@ -204,15 +209,15 @@ module Nutkins
|
|
204
209
|
File.unlink secret if path_is_dir
|
205
210
|
end
|
206
211
|
|
207
|
-
def extract_secrets
|
208
|
-
if
|
209
|
-
|
212
|
+
def extract_secrets paths
|
213
|
+
if paths.empty?
|
214
|
+
paths = get_all_img_paths
|
210
215
|
# there may be secrets in the root even if there is no image build there
|
211
|
-
|
216
|
+
paths.push '.' unless paths.include? '.'
|
212
217
|
end
|
213
218
|
|
214
|
-
|
215
|
-
get_secrets(
|
219
|
+
paths.each do |path|
|
220
|
+
get_secrets(path).each do |secret|
|
216
221
|
loop do
|
217
222
|
puts "enter passphrase for #{secret}"
|
218
223
|
break if system 'gpg', secret
|
@@ -253,8 +258,8 @@ module Nutkins
|
|
253
258
|
'-advertise-client-urls', "http://#{gateway}:#{ETCD_PORT}",
|
254
259
|
'-listen-client-urls', "http://0.0.0.0:#{ETCD_PORT}"
|
255
260
|
|
256
|
-
|
257
|
-
configs =
|
261
|
+
all_paths = get_all_img_paths
|
262
|
+
configs = all_paths.map &method(:get_image_config)
|
258
263
|
etcd_store = {}
|
259
264
|
configs.each do |config|
|
260
265
|
etcd_store.merge! config['etcd']['data'] if config.dig('etcd', 'data')
|
@@ -328,19 +333,19 @@ module Nutkins
|
|
328
333
|
raise "missing #{img_cfg_path}" unless File.exists?(img_cfg_path)
|
329
334
|
img_cfg = YAML.load_file(img_cfg_path)
|
330
335
|
img_cfg['image'] ||= path if path != '.'
|
331
|
-
|
336
|
+
img_cfg['path'] = path
|
337
|
+
raise "#{img_cfg_path} must contain `image' entry" unless img_cfg['image']
|
332
338
|
|
333
339
|
img_cfg['shell'] ||= '/bin/sh'
|
334
|
-
img_cfg['path'] ||= img_cfg_path
|
335
340
|
img_cfg['directory'] = directory
|
336
341
|
img_cfg["version"] ||= @config.version if @config.version
|
337
342
|
img_cfg['version'] = img_cfg['version'].to_s
|
338
|
-
raise "#{img_cfg_path} must contain
|
343
|
+
raise "#{img_cfg_path} must contain `version' entry" unless img_cfg.has_key? 'version'
|
339
344
|
img_cfg['latest_tag'] = get_tag img_cfg
|
340
345
|
img_cfg['tag'] = img_cfg['latest_tag'] + ':' + img_cfg['version']
|
341
346
|
|
342
347
|
base = img_cfg['base']
|
343
|
-
raise "#{img_cfg_path} must include `base
|
348
|
+
raise "#{img_cfg_path} must include `base' field" unless base
|
344
349
|
@img_configs[path] = img_cfg
|
345
350
|
end
|
346
351
|
|
@@ -356,20 +361,20 @@ module Nutkins
|
|
356
361
|
repository + '/' + img_cfg['image']
|
357
362
|
end
|
358
363
|
|
359
|
-
def
|
364
|
+
def get_all_img_paths
|
360
365
|
Dir.glob("#{@project_root}{,/*}/nutkin.yaml").map do |path|
|
361
366
|
File.basename File.dirname(path)
|
362
367
|
end
|
363
368
|
end
|
364
369
|
|
365
|
-
def
|
366
|
-
|
370
|
+
def config_for_image image_name
|
371
|
+
get_all_img_paths.map(&method(:get_image_config)).find do |cfg|
|
367
372
|
cfg['image'] == image_name
|
368
373
|
end
|
369
374
|
end
|
370
375
|
|
371
|
-
def get_secrets
|
372
|
-
Dir.glob("#{
|
376
|
+
def get_secrets path
|
377
|
+
Dir.glob("#{path}/{volumes,secrets}/*.gpg")
|
373
378
|
end
|
374
379
|
|
375
380
|
private
|
data/lib/nutkins/version.rb
CHANGED