dapp 0.24.6 → 0.24.7
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/dapp/dapp.rb +3 -0
- data/lib/dapp/dapp/deps/base.rb +1 -1
- data/lib/dapp/dapp/deps/gitartifact.rb +1 -1
- data/lib/dapp/dapp/deps/toolchain.rb +1 -1
- data/lib/dapp/dapp/lock.rb +2 -1
- data/lib/dapp/dimg/builder/chef.rb +1 -1
- data/lib/dapp/dimg/builder/chef/cookbook.rb +1 -1
- data/lib/dapp/dimg/cli/command/dimg/bp.rb +68 -12
- data/lib/dapp/dimg/dapp/command/bp.rb +0 -2
- data/lib/dapp/dimg/dapp/dimg.rb +4 -0
- data/lib/dapp/dimg/dimg.rb +6 -4
- data/lib/dapp/dimg/git_repo/remote.rb +1 -1
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0073271a0411a76dde658c5b3e5b44d5da2a1ede
|
4
|
+
data.tar.gz: 3817ba7a0bb6d5bb1fdb9f8e4ada6ecfe01eac64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a56c7b2ef49a8288ec40d23748e700dcd33cabf2e31af4c57541857ca6a505c337800612486cc4c7907a2e49e06dd90e2970df16b98429dca3fac013b50b0467
|
7
|
+
data.tar.gz: 78f8f794c7935074c852edb90bf521e3207e9cf82aeee2df9dcccd98b617182992e9bc108e72f2d55ee0e0445b17b99c3b6e361b8d890669b50a7d4ab2f7e511
|
data/lib/dapp/dapp.rb
CHANGED
@@ -35,6 +35,8 @@ module Dapp
|
|
35
35
|
Logging::I18n.initialize
|
36
36
|
validate_config_options!
|
37
37
|
Logging::Paint.initialize(option_color)
|
38
|
+
|
39
|
+
@_call_before_terminate = []
|
38
40
|
end
|
39
41
|
|
40
42
|
def options
|
@@ -120,6 +122,7 @@ module Dapp
|
|
120
122
|
end
|
121
123
|
|
122
124
|
def terminate
|
125
|
+
@_call_before_terminate.each {|on_terminate| on_terminate.call(self)}
|
123
126
|
FileUtils.rmtree(host_docker_tmp_config_dir)
|
124
127
|
end
|
125
128
|
|
data/lib/dapp/dapp/deps/base.rb
CHANGED
@@ -12,7 +12,7 @@ module Dapp
|
|
12
12
|
@base_container ||= begin
|
13
13
|
is_container_exist = proc{shellout("#{host_docker} inspect #{base_container_name}").exitstatus.zero?}
|
14
14
|
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{base_container_name}", default_timeout:
|
15
|
+
lock("dappdeps.container.#{base_container_name}", default_timeout: 600) do
|
16
16
|
if !is_container_exist.call
|
17
17
|
log_secondary_process(t(code: 'process.base_container_creating', data: {name: base_container_name}), short: true) do
|
18
18
|
shellout!(
|
@@ -12,7 +12,7 @@ module Dapp
|
|
12
12
|
@gitartifact_container ||= begin
|
13
13
|
is_container_exist = proc{shellout("#{host_docker} inspect #{gitartifact_container_name}").exitstatus.zero?}
|
14
14
|
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{gitartifact_container_name}", default_timeout:
|
15
|
+
lock("dappdeps.container.#{gitartifact_container_name}", default_timeout: 600) do
|
16
16
|
if !is_container_exist.call
|
17
17
|
log_secondary_process(t(code: 'process.gitartifact_container_creating', data: {name: gitartifact_container_name}), short: true) do
|
18
18
|
shellout!(
|
@@ -12,7 +12,7 @@ module Dapp
|
|
12
12
|
@toolchain_container ||= begin
|
13
13
|
is_container_exist = proc {shellout("#{host_docker} inspect #{toolchain_container_name}").exitstatus.zero?}
|
14
14
|
if !is_container_exist.call
|
15
|
-
lock("dappdeps.container.#{toolchain_container_name}", default_timeout:
|
15
|
+
lock("dappdeps.container.#{toolchain_container_name}", default_timeout: 600) do
|
16
16
|
if !is_container_exist.call
|
17
17
|
log_secondary_process(t(code: 'process.toolchain_container_creating', data: {name: toolchain_container_name}), short: true) do
|
18
18
|
shellout!(
|
data/lib/dapp/dapp/lock.rb
CHANGED
@@ -10,7 +10,8 @@ module Dapp
|
|
10
10
|
@_locks[name] ||= ::Dapp::Dimg::Lock::File.new(locks_dir, name)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
# default_timeout 24 hours
|
14
|
+
def lock(name, *_args, default_timeout: 86400, **kwargs, &blk)
|
14
15
|
if dry_run?
|
15
16
|
yield if block_given?
|
16
17
|
else
|
@@ -64,7 +64,7 @@ module Dapp
|
|
64
64
|
@chefdk_container ||= begin
|
65
65
|
is_container_exist = proc{dimg.dapp.shellout("#{dimg.dapp.host_docker} inspect #{chefdk_container_name}").exitstatus.zero?}
|
66
66
|
if !is_container_exist.call
|
67
|
-
dimg.dapp.lock("dappdeps.container.#{chefdk_container_name}", default_timeout:
|
67
|
+
dimg.dapp.lock("dappdeps.container.#{chefdk_container_name}", default_timeout: 600) do
|
68
68
|
if !is_container_exist.call
|
69
69
|
dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.chefdk_container_creating', data: {name: chefdk_container_name}), short: true) do
|
70
70
|
dimg.dapp.shellout!(
|
@@ -66,7 +66,7 @@ module Dapp
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def vendor_path
|
69
|
-
builder.dimg.dapp.lock(_vendor_lock_name, default_timeout:
|
69
|
+
builder.dimg.dapp.lock(_vendor_lock_name, default_timeout: 600) do
|
70
70
|
vendor! unless _vendor_path.join('.created_at').exist?
|
71
71
|
end
|
72
72
|
_vendor_path
|
@@ -12,25 +12,81 @@ Usage:
|
|
12
12
|
|
13
13
|
Options:
|
14
14
|
BANNER
|
15
|
+
|
16
|
+
# build options
|
17
|
+
|
18
|
+
introspected_stages = [
|
19
|
+
:from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
|
20
|
+
:g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
|
21
|
+
:g_a_pre_setup_patch, :setup, :g_a_post_setup_patch, :after_setup_artifact, :g_a_latest_patch, :docker_instructions
|
22
|
+
]
|
23
|
+
artifact_introspected_stages = [
|
24
|
+
:from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
|
25
|
+
:g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
|
26
|
+
:g_a_pre_setup_patch, :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact
|
27
|
+
]
|
28
|
+
|
15
29
|
option :tmp_dir_prefix,
|
16
|
-
|
17
|
-
|
30
|
+
long: '--tmp-dir-prefix PREFIX',
|
31
|
+
description: 'Tmp directory prefix (/tmp by default). Used for build process service directories.'
|
18
32
|
|
19
33
|
option :lock_timeout,
|
20
|
-
|
21
|
-
|
22
|
-
|
34
|
+
long: '--lock-timeout TIMEOUT',
|
35
|
+
description: 'Redefine resource locking timeout (in seconds)',
|
36
|
+
proc: ->(v) { v.to_i }
|
23
37
|
|
24
38
|
option :git_artifact_branch,
|
25
|
-
|
26
|
-
|
39
|
+
long: '--git-artifact-branch BRANCH',
|
40
|
+
description: 'Default branch to archive artifacts from'
|
41
|
+
|
42
|
+
option :introspect_error,
|
43
|
+
long: '--introspect-error',
|
44
|
+
boolean: true,
|
45
|
+
default: false
|
46
|
+
|
47
|
+
option :introspect_before_error,
|
48
|
+
long: '--introspect-before-error',
|
49
|
+
boolean: true,
|
50
|
+
default: false
|
51
|
+
|
52
|
+
option :introspect_stage,
|
53
|
+
long: '--introspect-stage STAGE',
|
54
|
+
description: "Introspect one of the following stages (#{list_msg_format(introspected_stages)})",
|
55
|
+
proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, introspected_stages) } }
|
56
|
+
|
57
|
+
option :introspect_artifact_stage,
|
58
|
+
long: '--introspect-artifact-stage STAGE',
|
59
|
+
description: "Introspect one of the following stages (#{list_msg_format(artifact_introspected_stages)})",
|
60
|
+
proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, artifact_introspected_stages) } }
|
27
61
|
|
28
62
|
option :ssh_key,
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
63
|
+
long: '--ssh-key SSH_KEY',
|
64
|
+
description: ['Enable only specified ssh keys ',
|
65
|
+
'(use system ssh-agent by default)'].join,
|
66
|
+
default: nil,
|
67
|
+
proc: ->(v) { composite_options(:ssh_key) << v }
|
68
|
+
|
69
|
+
option :build_context_directory,
|
70
|
+
long: '--build-context-directory DIR_PATH',
|
71
|
+
default: nil
|
72
|
+
|
73
|
+
option :use_system_tar,
|
74
|
+
long: '--use-system-tar',
|
75
|
+
boolean: true,
|
76
|
+
default: false
|
77
|
+
|
78
|
+
option :force_save_cache,
|
79
|
+
long: '--force-save-cache',
|
80
|
+
boolean: true,
|
81
|
+
default: false
|
82
|
+
|
83
|
+
# push options
|
84
|
+
|
85
|
+
extend ::Dapp::CLI::Command::Options::Tag
|
86
|
+
|
87
|
+
option :with_stages,
|
88
|
+
long: '--with-stages',
|
89
|
+
boolean: true
|
34
90
|
|
35
91
|
option :registry_username,
|
36
92
|
long: '--registry-username USERNAME'
|
data/lib/dapp/dimg/dapp/dimg.rb
CHANGED
@@ -9,6 +9,10 @@ module Dapp
|
|
9
9
|
def artifact_dimg(config:, **kwargs)
|
10
10
|
(@artifacts_dimgs ||= {})[config._name] ||= ::Dapp::Dimg::Artifact.new(config: config, dapp: self, **kwargs)
|
11
11
|
end
|
12
|
+
|
13
|
+
def _terminate_dimg_on_terminate(dimg)
|
14
|
+
@_call_before_terminate << proc{dimg.terminate}
|
15
|
+
end
|
12
16
|
end # Dimg
|
13
17
|
end # Dapp
|
14
18
|
end # Dimg
|
data/lib/dapp/dimg/dimg.rb
CHANGED
@@ -20,9 +20,15 @@ module Dapp
|
|
20
20
|
@ignore_git_fetch = ignore_git_fetch
|
21
21
|
@should_be_built = should_be_built
|
22
22
|
|
23
|
+
@dapp._terminate_dimg_on_terminate(self)
|
24
|
+
|
23
25
|
raise Error::Dimg, code: :dimg_not_built if should_be_built?
|
24
26
|
end
|
25
27
|
|
28
|
+
def terminate
|
29
|
+
cleanup_tmp
|
30
|
+
end
|
31
|
+
|
26
32
|
def build!
|
27
33
|
with_introspection do
|
28
34
|
dapp.lock("#{dapp.name}.images", readonly: true) do
|
@@ -36,8 +42,6 @@ module Dapp
|
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
39
|
-
ensure
|
40
|
-
cleanup_tmp
|
41
45
|
end
|
42
46
|
|
43
47
|
def after_stages_build!
|
@@ -196,8 +200,6 @@ module Dapp
|
|
196
200
|
cmd << " rm -rf #{tmp_path}"
|
197
201
|
end
|
198
202
|
dapp.shellout! cmd
|
199
|
-
|
200
|
-
artifacts.each(&:cleanup_tmp)
|
201
203
|
end
|
202
204
|
|
203
205
|
def stage_should_be_introspected?(name)
|
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.24.
|
4
|
+
version: 0.24.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|