dapp 0.26.14 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dapp +0 -4
- data/config/en/common.yml +1 -0
- data/config/en/net_status.yml +2 -0
- data/lib/dapp.rb +1 -4
- data/lib/dapp/cli.rb +0 -4
- data/lib/dapp/cli/command/base.rb +1 -7
- data/lib/dapp/dapp.rb +4 -22
- data/lib/dapp/dapp/dappfile.rb +2 -2
- data/lib/dapp/dapp/deps/base.rb +6 -2
- data/lib/dapp/dapp/option_tags.rb +1 -7
- data/lib/dapp/dimg/artifact.rb +4 -0
- data/lib/dapp/dimg/build/stage/artifact_base.rb +7 -7
- data/lib/dapp/dimg/build/stage/artifact_default.rb +4 -5
- data/lib/dapp/dimg/build/stage/base.rb +1 -3
- data/lib/dapp/dimg/build/stage/before_install.rb +2 -3
- data/lib/dapp/dimg/build/stage/from.rb +31 -5
- data/lib/dapp/dimg/build/stage/ga_base.rb +1 -1
- data/lib/dapp/dimg/build/stage/ga_latest_patch.rb +1 -3
- data/lib/dapp/dimg/build/stage/import_artifact.rb +3 -4
- data/lib/dapp/dimg/builder/ansible.rb +167 -2
- data/lib/dapp/dimg/builder/ansible/assets.rb +332 -0
- data/lib/dapp/dimg/builder/chef.rb +2 -2
- data/lib/dapp/dimg/cli/command/base.rb +14 -0
- data/lib/dapp/dimg/cli/command/dimg/build.rb +15 -24
- data/lib/dapp/dimg/cli/command/dimg/run.rb +14 -1
- data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +2 -1
- data/lib/dapp/dimg/config/directive/dimg_group_base.rb +2 -2
- data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +4 -3
- data/lib/dapp/dimg/dapp/command/cleanup.rb +2 -2
- data/lib/dapp/dimg/dapp/command/common.rb +16 -5
- data/lib/dapp/dimg/dapp/command/mrproper.rb +6 -8
- data/lib/dapp/dimg/dapp/command/push.rb +1 -1
- data/lib/dapp/dimg/dapp/command/run.rb +3 -2
- data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +3 -0
- data/lib/dapp/dimg/dapp/command/tag.rb +1 -1
- data/lib/dapp/dimg/dapp/dimg.rb +8 -0
- data/lib/dapp/dimg/dimg.rb +14 -3
- data/lib/dapp/dimg/dimg/stages.rb +1 -1
- data/lib/dapp/dimg/docker_registry/base.rb +10 -0
- data/lib/dapp/dimg/docker_registry/base/authorization.rb +1 -16
- data/lib/dapp/dimg/git_artifact.rb +9 -2
- data/lib/dapp/dimg/git_repo/base.rb +2 -2
- data/lib/dapp/dimg/git_repo/local.rb +2 -2
- data/lib/dapp/kube/dapp/command/deploy.rb +0 -1
- data/lib/dapp/kube/dapp/command/lint.rb +11 -4
- data/lib/dapp/kube/helm/values.rb +7 -7
- data/lib/dapp/version.rb +2 -2
- metadata +5 -34
- data/lib/dapp/dapp/sentry.rb +0 -106
- data/lib/dapp/helper/url.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 745c76163ba1b96d6a8a73c478d7ea9de5a9aa32
|
4
|
+
data.tar.gz: d3ec2e586c4828ecd4044a7abf69109eb64f2cbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32391a66ad27f57986540b813cec39d279cd549224cc1d8b3fbc9b8fcbb50f50a5aae2692f90948e7fff2594668b5ba245dcb62d1f3b4ae31f242d9b35fba3be
|
7
|
+
data.tar.gz: 33b1e5a759aacd3f183d45869eedb475462b52615b7182f5931e25835ae0f0368f5726d6026c0f2d6d95487b8a39b65a5ce16502dee38999f68d385b6044358c
|
data/bin/dapp
CHANGED
data/config/en/common.yml
CHANGED
@@ -13,6 +13,7 @@ en:
|
|
13
13
|
process:
|
14
14
|
artifact_copy: "copying artifact `%{name}`"
|
15
15
|
artifact_building: "building artifact `%{name}`"
|
16
|
+
layer_building: "building layer `%{name}`"
|
16
17
|
git_artifact_clone: "cloning remote git_artifact `%{url}`"
|
17
18
|
git_artifact_fetch: "fetching remote git_artifact `%{url}`"
|
18
19
|
vendoring_builder_cookbooks: 'vendoring builder cookbooks'
|
data/config/en/net_status.yml
CHANGED
@@ -5,6 +5,7 @@ en:
|
|
5
5
|
shell_command_failed: ">>> START STREAM\n%{stream}\n>>> END STREAM"
|
6
6
|
dimg:
|
7
7
|
dimg_not_built: "Dimg hasn't been built yet!"
|
8
|
+
dimg_stage_not_built: "Dimg stage `%{stage_name}` hasn't been built yet!"
|
8
9
|
dimg_not_run: "Dimg run failed!"
|
9
10
|
dappfile:
|
10
11
|
incorrect: "Dappfile with `%{error}`:\n%{message}"
|
@@ -36,6 +37,7 @@ en:
|
|
36
37
|
no_helm_chart_spec_name: "Bad name `%{name}` in helm chart spec %{path}:\n%{raw_spec}"
|
37
38
|
file_not_exist: "File `%{path}` doesn't exist!"
|
38
39
|
helm_directory_not_exist: "Helm directory doesn't exist in project!"
|
40
|
+
chart_yaml_not_found: "Chart.yaml file `%{path}` not found!"
|
39
41
|
values_file_not_found: "Values file `%{path}` not found!"
|
40
42
|
secret_file_not_found: "Secret file `%{path}` not found!"
|
41
43
|
secret_file_empty: "Secret file `%{path}` can't be empty!"
|
data/lib/dapp.rb
CHANGED
@@ -28,8 +28,6 @@ require 'base64'
|
|
28
28
|
require 'io/console'
|
29
29
|
require 'net/http'
|
30
30
|
require 'progressbar'
|
31
|
-
require 'sentry-raven'
|
32
|
-
require 'toml-rb'
|
33
31
|
|
34
32
|
require 'dapp/version'
|
35
33
|
require 'dapp/core_ext/hash'
|
@@ -40,7 +38,6 @@ require 'dapp/helper/sha256'
|
|
40
38
|
require 'dapp/helper/net_status'
|
41
39
|
require 'dapp/helper/tar'
|
42
40
|
require 'dapp/helper/yaml'
|
43
|
-
require 'dapp/helper/url'
|
44
41
|
require 'dapp/prctl'
|
45
42
|
require 'dapp/error/mod/user'
|
46
43
|
require 'dapp/error/base'
|
@@ -61,7 +58,6 @@ require 'dapp/config/directive/base'
|
|
61
58
|
require 'dapp/config/config'
|
62
59
|
require 'dapp/dapp/lock'
|
63
60
|
require 'dapp/dapp/ssh_agent'
|
64
|
-
require 'dapp/dapp/sentry'
|
65
61
|
require 'dapp/dapp/git_artifact'
|
66
62
|
require 'dapp/dapp/dappfile'
|
67
63
|
require 'dapp/dapp/chef'
|
@@ -140,6 +136,7 @@ require 'dapp/dimg/builder/chef/berksfile'
|
|
140
136
|
require 'dapp/dimg/builder/chef/cookbook'
|
141
137
|
require 'dapp/dimg/builder/shell'
|
142
138
|
require 'dapp/dimg/builder/ansible'
|
139
|
+
require 'dapp/dimg/builder/ansible/assets'
|
143
140
|
require 'dapp/dimg/builder/none'
|
144
141
|
require 'dapp/dimg/build/stage/mod/logging'
|
145
142
|
require 'dapp/dimg/build/stage/mod/group'
|
data/lib/dapp/cli.rb
CHANGED
@@ -58,8 +58,6 @@ module Dapp
|
|
58
58
|
|
59
59
|
def run_dapp_command(run_method, options: {}, log_running_time: true, try_host_docker_login: false)
|
60
60
|
dapp = ::Dapp::Dapp.new(options: options)
|
61
|
-
::Dapp::CLI.dapp_object = dapp
|
62
|
-
dapp.sentry_message("Manual usage: `#{options[:dapp_command]}` command") unless ENV['CI']
|
63
61
|
|
64
62
|
log_dapp_running_time(dapp, ignore: !log_running_time) do
|
65
63
|
begin
|
@@ -76,10 +74,6 @@ module Dapp
|
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
79
|
-
def run_method
|
80
|
-
class_to_lowercase
|
81
|
-
end
|
82
|
-
|
83
77
|
def log_dapp_running_time(dapp, ignore: false)
|
84
78
|
return yield if ignore
|
85
79
|
|
@@ -101,7 +95,7 @@ module Dapp
|
|
101
95
|
self.class.print_error_with_help_and_die! self, "cannot use alias options --run-dir, --build-dir, --deploy-dir at the same time"
|
102
96
|
end
|
103
97
|
|
104
|
-
config.merge(build_dir: dirs.compact.first,
|
98
|
+
config.merge(build_dir: dirs.compact.first, **kwargs)
|
105
99
|
end
|
106
100
|
end
|
107
101
|
end
|
data/lib/dapp/dapp.rb
CHANGED
@@ -17,13 +17,10 @@ module Dapp
|
|
17
17
|
include Logging::Paint
|
18
18
|
|
19
19
|
include SshAgent
|
20
|
-
include Sentry
|
21
|
-
|
22
20
|
include Helper::Sha256
|
23
|
-
extend
|
21
|
+
extend Helper::Trivia
|
24
22
|
include Helper::Trivia
|
25
23
|
include Helper::Tar
|
26
|
-
include Helper::Url
|
27
24
|
|
28
25
|
include Deps::Toolchain
|
29
26
|
include Deps::Gitartifact
|
@@ -46,18 +43,6 @@ module Dapp
|
|
46
43
|
self.class.options
|
47
44
|
end
|
48
45
|
|
49
|
-
def settings
|
50
|
-
@settings ||= begin
|
51
|
-
settings_path = File.join(self.class.home_dir, "settings.toml")
|
52
|
-
|
53
|
-
if File.exists? settings_path
|
54
|
-
TomlRB.load_file(settings_path)
|
55
|
-
else
|
56
|
-
{}
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
46
|
def name
|
62
47
|
@name ||= begin
|
63
48
|
n = begin
|
@@ -111,8 +96,8 @@ module Dapp
|
|
111
96
|
self.class.tmp_base_dir
|
112
97
|
end
|
113
98
|
|
114
|
-
def
|
115
|
-
@
|
99
|
+
def build_path(*path)
|
100
|
+
@build_path ||= begin
|
116
101
|
if option_build_dir
|
117
102
|
Pathname.new(option_build_dir)
|
118
103
|
else
|
@@ -120,10 +105,7 @@ module Dapp
|
|
120
105
|
Pathname.new(dir)
|
121
106
|
end.expand_path.tap(&:mkpath)
|
122
107
|
end
|
123
|
-
|
124
|
-
|
125
|
-
def build_path(*path)
|
126
|
-
make_path(build_dir, *path)
|
108
|
+
make_path(@build_path, *path)
|
127
109
|
end
|
128
110
|
|
129
111
|
def local_git_artifact_exclude_paths(&blk)
|
data/lib/dapp/dapp/dappfile.rb
CHANGED
@@ -124,12 +124,12 @@ module Dapp
|
|
124
124
|
return if File.exists? dappfile_yml_bin_path
|
125
125
|
|
126
126
|
log_process("Downloading dappfile-yml dapp dependency") do
|
127
|
-
location = URI("https://dl.bintray.com/dapp
|
127
|
+
location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml")
|
128
128
|
|
129
129
|
tmp_bin_path = File.join(self.class.tmp_base_dir, "dappfile-yml-#{SecureRandom.uuid}")
|
130
130
|
::Dapp::Downloader.download(location, tmp_bin_path, show_progress: true, progress_titile: dappfile_yml_bin_path)
|
131
131
|
|
132
|
-
checksum_location = URI("https://dl.bintray.com/dapp
|
132
|
+
checksum_location = URI("https://dl.bintray.com/flant/dapp/#{::Dapp::VERSION}/dappfile-yml.sha")
|
133
133
|
tmp_bin_checksum_path = tmp_bin_path + ".checksum"
|
134
134
|
::Dapp::Downloader.download(checksum_location, tmp_bin_checksum_path)
|
135
135
|
|
data/lib/dapp/dapp/deps/base.rb
CHANGED
@@ -2,7 +2,7 @@ module Dapp
|
|
2
2
|
class Dapp
|
3
3
|
module Deps
|
4
4
|
module Base
|
5
|
-
BASE_VERSION = "0.2.
|
5
|
+
BASE_VERSION = "0.2.3"
|
6
6
|
|
7
7
|
def base_container_name # FIXME: hashsum(image) or dockersafe()
|
8
8
|
"dappdeps_base_#{BASE_VERSION}"
|
@@ -28,11 +28,15 @@ module Dapp
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def dappdeps_base_path
|
32
|
+
"/.dapp/deps/base/#{BASE_VERSION}/embedded/bin:/.dapp/deps/base/#{BASE_VERSION}/embedded/sbin"
|
33
|
+
end
|
34
|
+
|
31
35
|
%w(rm rsync diff date cat
|
32
36
|
stat readlink test sleep mkdir
|
33
37
|
install sed cp true find
|
34
38
|
bash tar sudo base64).each do |cmd|
|
35
|
-
define_method("#{cmd}_bin") { "/.dapp/deps/base/#{BASE_VERSION}/bin/#{cmd}" }
|
39
|
+
define_method("#{cmd}_bin") { "/.dapp/deps/base/#{BASE_VERSION}/embedded/bin/#{cmd}" }
|
36
40
|
end
|
37
41
|
|
38
42
|
def sudo_command(owner: nil, group: nil)
|
@@ -7,12 +7,6 @@ module Dapp
|
|
7
7
|
|
8
8
|
def tags_by_scheme
|
9
9
|
@tags_by_scheme_name ||= begin
|
10
|
-
if slug_tags[:custom].any?
|
11
|
-
if settings.fetch("sentry", {}).fetch("detect-push-tag-usage", false)
|
12
|
-
sentry_message("--tag or --tag-slug usage detected", extra: {"slug_tags" => slug_tags})
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
10
|
{}.tap do |tags_by_scheme|
|
17
11
|
[slug_tags, branch_tags, ci_tags].each do |_tags_by_scheme|
|
18
12
|
_tags_by_scheme.each do |scheme, tags|
|
@@ -95,4 +89,4 @@ module Dapp
|
|
95
89
|
end
|
96
90
|
end # Tags
|
97
91
|
end # Dapp
|
98
|
-
end # Dapp
|
92
|
+
end # Dapp
|
data/lib/dapp/dimg/artifact.rb
CHANGED
@@ -13,7 +13,7 @@ module Dapp
|
|
13
13
|
artifacts_labels = {}
|
14
14
|
artifacts.each do |artifact|
|
15
15
|
apply_artifact(artifact, image)
|
16
|
-
artifacts_labels["dapp-artifact-#{artifact[:name
|
16
|
+
artifacts_labels["dapp-artifact-#{artifact[:dimg].name}".to_sym] = artifact[:dimg].last_stage.image.built_id
|
17
17
|
end
|
18
18
|
image.add_service_change_label artifacts_labels
|
19
19
|
end
|
@@ -24,7 +24,7 @@ module Dapp
|
|
24
24
|
dimg.config.public_send("_#{name}").map do |artifact|
|
25
25
|
artifact_dimg = dimg.dapp.artifact_dimg(config: artifact._config,
|
26
26
|
ignore_git_fetch: dimg.ignore_git_fetch)
|
27
|
-
{
|
27
|
+
{ options: artifact._artifact_options, dimg: artifact_dimg }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -49,23 +49,23 @@ module Dapp
|
|
49
49
|
|
50
50
|
def artifacts_dimgs_build!
|
51
51
|
artifacts.uniq { |artifact| artifact[:dimg] }.each do |artifact|
|
52
|
-
process = dimg.dapp.t(code: 'process.artifact_building', data: { name: artifact[:name
|
52
|
+
process = dimg.dapp.t(code: 'process.artifact_building', data: { name: artifact[:dimg].name })
|
53
53
|
dimg.dapp.log_secondary_process(process) { artifact[:dimg].build! }
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def run_artifact_dimg(artifact_dimg,
|
57
|
+
def run_artifact_dimg(artifact_dimg, commands)
|
58
58
|
docker_options = ['--rm',
|
59
|
-
"--volume #{dimg.tmp_path('artifact',
|
59
|
+
"--volume #{dimg.tmp_path('artifact', artifact_dimg.name )}:#{artifact_dimg.container_tmp_path(artifact_dimg.name)}",
|
60
60
|
"--volumes-from #{dimg.dapp.toolchain_container}",
|
61
61
|
"--volumes-from #{dimg.dapp.base_container}",
|
62
62
|
"--entrypoint #{dimg.dapp.bash_bin}"]
|
63
|
-
dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.artifact_copy', data: { name:
|
63
|
+
dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.artifact_copy', data: { name: artifact_dimg.name }), short: true) do
|
64
64
|
artifact_dimg.run(docker_options, [%(-ec '#{dimg.dapp.shellout_pack(commands)}')])
|
65
65
|
end
|
66
66
|
rescue Error::Dimg => e
|
67
67
|
raise unless e.net_status[:code] == :dimg_not_run
|
68
|
-
raise Error::Build, code: :export_failed, data: { artifact_name:
|
68
|
+
raise Error::Build, code: :export_failed, data: { artifact_name: artifact_dimg.name }
|
69
69
|
end
|
70
70
|
# rubocop:enable Metrics/AbcSize
|
71
71
|
end # ArtifactBase
|
@@ -8,7 +8,6 @@ module Dapp
|
|
8
8
|
def apply_artifact(artifact, image)
|
9
9
|
return if dimg.dapp.dry_run?
|
10
10
|
|
11
|
-
artifact_name = artifact[:name]
|
12
11
|
artifact_dimg = artifact[:dimg]
|
13
12
|
cwd = artifact[:options][:cwd]
|
14
13
|
include_paths = artifact[:options][:include_paths]
|
@@ -17,12 +16,12 @@ module Dapp
|
|
17
16
|
group = artifact[:options][:group]
|
18
17
|
to = artifact[:options][:to]
|
19
18
|
|
20
|
-
command = safe_cp(cwd, artifact_dimg.container_tmp_path(
|
21
|
-
run_artifact_dimg(artifact_dimg,
|
19
|
+
command = safe_cp(cwd, artifact_dimg.container_tmp_path(artifact_dimg.name, 'data').to_s, nil, nil, include_paths, exclude_paths)
|
20
|
+
run_artifact_dimg(artifact_dimg, command)
|
22
21
|
|
23
|
-
command = safe_cp(dimg.container_tmp_path('artifact',
|
22
|
+
command = safe_cp(dimg.container_tmp_path('artifact', artifact_dimg.name, 'data').to_s, to, owner, group, include_paths, exclude_paths)
|
24
23
|
image.add_command command
|
25
|
-
image.add_volume "#{dimg.tmp_path('artifact',
|
24
|
+
image.add_volume "#{dimg.tmp_path('artifact', artifact_dimg.name)}:#{dimg.container_tmp_path('artifact', artifact_dimg.name)}:ro"
|
26
25
|
end
|
27
26
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
28
27
|
|
@@ -189,10 +189,8 @@ module Dapp
|
|
189
189
|
commits[git_artifact] ||= begin
|
190
190
|
if image.built?
|
191
191
|
image.labels[dimg.dapp.dimgstage_g_a_commit_label(git_artifact.paramshash)]
|
192
|
-
|
192
|
+
else
|
193
193
|
git_artifact.latest_commit
|
194
|
-
elsif prev_stage
|
195
|
-
prev_stage.layer_commit(git_artifact)
|
196
194
|
end
|
197
195
|
end
|
198
196
|
end
|
@@ -9,13 +9,12 @@ module Dapp
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def empty?
|
12
|
-
|
12
|
+
!dimg.builder.before_install?
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def dependencies
|
16
16
|
[builder_checksum]
|
17
17
|
end
|
18
|
-
alias dependencies context
|
19
18
|
|
20
19
|
def builder_checksum
|
21
20
|
dimg.builder.before_install_checksum
|
@@ -10,13 +10,29 @@ module Dapp
|
|
10
10
|
protected
|
11
11
|
|
12
12
|
def prepare_image
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
if !from_dimg.nil?
|
14
|
+
process = dimg.dapp.t(code: 'process.layer_building', data: { name: from_dimg.name })
|
15
|
+
dimg.dapp.log_secondary_process(process) { from_dimg.build! }
|
16
|
+
else
|
17
|
+
try_host_docker_login
|
18
|
+
from_image.pull!
|
19
|
+
raise Error::Build, code: :from_image_not_found, data: { name: from_image_name } unless from_image.tagged?
|
20
|
+
end
|
21
|
+
|
16
22
|
add_cleanup_mounts_dirs_command
|
17
23
|
super
|
18
24
|
end
|
19
25
|
|
26
|
+
def from_dimg
|
27
|
+
@from_dimg ||= begin
|
28
|
+
if !dimg.config._from_dimg.nil?
|
29
|
+
dimg.dapp.dimg_layer(config: dimg.config._from_dimg, ignore_git_fetch: dimg.ignore_git_fetch)
|
30
|
+
elsif !dimg.config._from_dimg_artifact.nil?
|
31
|
+
dimg.dapp.artifact_dimg_layer(config: dimg.config._from_dimg_artifact, ignore_git_fetch: dimg.ignore_git_fetch)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
20
36
|
def try_host_docker_login
|
21
37
|
return unless registry_from_image_name?
|
22
38
|
dimg.dapp.host_docker_login(ENV['CI_REGISTRY'])
|
@@ -55,11 +71,21 @@ module Dapp
|
|
55
71
|
private
|
56
72
|
|
57
73
|
def from_image_name
|
58
|
-
|
74
|
+
if !from_dimg.nil?
|
75
|
+
from_dimg.signature
|
76
|
+
else
|
77
|
+
dimg.config._docker._from
|
78
|
+
end
|
59
79
|
end
|
60
80
|
|
61
81
|
def from_image
|
62
|
-
@from_image ||=
|
82
|
+
@from_image ||= begin
|
83
|
+
if !from_dimg.nil?
|
84
|
+
from_dimg.last_stage.image
|
85
|
+
else
|
86
|
+
Image::Stage.image_by_name(name: from_image_name, dapp: dimg.dapp)
|
87
|
+
end
|
88
|
+
end
|
63
89
|
end
|
64
90
|
end # Prepare
|
65
91
|
end # Stage
|
@@ -10,7 +10,7 @@ module Dapp
|
|
10
10
|
image.add_volume "#{dimg.tmp_path('patches')}:#{dimg.container_tmp_path('patches')}:ro"
|
11
11
|
|
12
12
|
dimg.git_artifacts.each do |git_artifact|
|
13
|
-
image.add_service_change_label(dimg.dapp.dimgstage_g_a_commit_label(git_artifact.paramshash).to_sym =>
|
13
|
+
image.add_service_change_label(dimg.dapp.dimgstage_g_a_commit_label(git_artifact.paramshash).to_sym => git_artifact.latest_commit)
|
14
14
|
image.add_command git_artifact.send(apply_command_method, self)
|
15
15
|
end
|
16
16
|
end
|
@@ -28,9 +28,7 @@ module Dapp
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def commit_list
|
31
|
-
dimg.git_artifacts
|
32
|
-
.select { |ga| ga.repo.commit_exists?(prev_stage.layer_commit(ga)) && ga.patch_any_changes?(self) }
|
33
|
-
.map(&method(:layer_commit))
|
31
|
+
dimg.git_artifacts.map { |git_artifact| layer_commit(git_artifact) }
|
34
32
|
end
|
35
33
|
|
36
34
|
def git_artifacts_dev_patch_hashes
|
@@ -31,7 +31,6 @@ module Dapp
|
|
31
31
|
def apply_artifact(artifact, image)
|
32
32
|
return if dimg.dapp.dry_run?
|
33
33
|
|
34
|
-
artifact_name = artifact[:name]
|
35
34
|
artifact_dimg = artifact[:dimg]
|
36
35
|
cwd = artifact[:options][:cwd]
|
37
36
|
to = artifact[:options][:to]
|
@@ -46,15 +45,15 @@ module Dapp
|
|
46
45
|
credentials += "--group=#{group} " if group
|
47
46
|
credentials += '--numeric-owner'
|
48
47
|
|
49
|
-
archive_path = dimg.tmp_path('artifact',
|
50
|
-
container_archive_path = File.join(artifact_dimg.container_tmp_path(
|
48
|
+
archive_path = dimg.tmp_path('artifact', artifact_dimg.name, 'archive.tar.gz')
|
49
|
+
container_archive_path = File.join(artifact_dimg.container_tmp_path(artifact_dimg.name), 'archive.tar.gz')
|
51
50
|
|
52
51
|
exclude_paths = artifact[:options][:exclude_paths].map { |path| "--exclude=#{path}" }.join(' ')
|
53
52
|
include_paths = include_paths.empty? ? [File.join(cwd, '*')] : include_paths.map { |path| File.join(cwd, path, '*') }
|
54
53
|
include_paths.map! { |path| path[1..-1] } # relative path
|
55
54
|
|
56
55
|
command = "#{sudo} #{dimg.dapp.tar_bin} #{tar_option_transform(cwd, to)} -czf #{container_archive_path} #{exclude_paths} #{include_paths.join(' ')} #{credentials}"
|
57
|
-
run_artifact_dimg(artifact_dimg,
|
56
|
+
run_artifact_dimg(artifact_dimg, command)
|
58
57
|
|
59
58
|
image.add_archive archive_path
|
60
59
|
end
|