dapp 0.30.10 → 0.31.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4c1137d99bca8582e137ec38539839bf85b023c4c45447ee8c624beaa8d3cd7
4
- data.tar.gz: 4f072a87f2c5135af2a402c0572feef6078ff3b30b5ab2006b70b564bb44e670
3
+ metadata.gz: 5589825e906db3c287d0abc4cd312c9fcc8efc96e36945cb7e3655370d8b288d
4
+ data.tar.gz: a0164e08a37faf5f8c03bba714da833458ae7081549085e8aecf6a089f51f003
5
5
  SHA512:
6
- metadata.gz: 6abf78c9f3ecfb0b09ed6c21b468a6c1c9b7a7434e65ac055de082e74367bab1e9773e62d0a43cc2dc496c4a5951d44670d14aa410d9ba9536cc22edb1b95f19
7
- data.tar.gz: 7490558a078f43c40e40f745ab2369d8dcb58a9ce2e812bac70bec5eac5cbc190770fb2a78f276ec8dbb8d6f9b2029c161d74484356cd5acc40207d4e686e66d
6
+ metadata.gz: bafb007a39acc411b6add0c23a6f437120e7dd8235aeb9382de3ad025d8800e4cc1f7acd586d6eca933f0f45ef1d52e09bc358977f8d05f869098ffd0ba1076e
7
+ data.tar.gz: ea5c715b0f06b4170b424ec2231504e951e9b12f54a783dee04327cd662a802316a2274313d9cf61fd42eb0140d7be798643b17127f8230e7e33dd2cb6a44a16
data/bin/dapp CHANGED
@@ -10,29 +10,7 @@ Thread.abort_on_exception = true
10
10
  begin
11
11
  begin
12
12
  begin
13
- begin
14
- Dapp::CLI.new.run
15
- ensure
16
- if Time.now.to_date < Date.parse("2019-11-01")
17
- STDERR.puts
18
- STDERR.puts ::Paint["###################################################################", :red, :bold]
19
- STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
20
- STDERR.puts ::Paint["### Dapp will be deprecated for use starting with 01.11.2019! ###", :red, :bold]
21
- STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
22
- STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
23
- STDERR.puts ::Paint["###################################################################", :red, :bold]
24
- STDERR.puts
25
- else
26
- STDERR.puts
27
- STDERR.puts ::Paint["######################################################################", :red, :bold]
28
- STDERR.puts ::Paint["### DEPRECATION WARNING! ###", :red, :bold]
29
- STDERR.puts ::Paint["### Dapp is deprecated for use and will not receive any support! ###", :red, :bold]
30
- STDERR.puts ::Paint["### Please port your project to werf: ###", :red, :bold]
31
- STDERR.puts ::Paint["### https://werf.io ###", :red, :bold]
32
- STDERR.puts ::Paint["######################################################################", :red, :bold]
33
- STDERR.puts
34
- end
35
- end
13
+ Dapp::CLI.new.run
36
14
  rescue Dapp::Error::Base => e
37
15
  unless (message = Dapp::Helper::NetStatus.before_error_message(e)).empty?
38
16
  $stderr.puts(message)
@@ -166,6 +166,7 @@ require 'dapp/dimg/build/stage/mod/group'
166
166
  require 'dapp/dimg/build/stage/base'
167
167
  require 'dapp/dimg/build/stage/ga_base'
168
168
  require 'dapp/dimg/build/stage/ga_related_base'
169
+ require 'dapp/dimg/build/stage/instructions'
169
170
  require 'dapp/dimg/build/stage/artifact_base'
170
171
  require 'dapp/dimg/build/stage/artifact_default'
171
172
  require 'dapp/dimg/build/stage/from'
@@ -14,6 +14,10 @@ BANNER
14
14
  self.class.parse_options(self, argv)
15
15
  run_dapp_command(run_method, options: cli_options)
16
16
  end
17
+
18
+ def log_running_time
19
+ false
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -2,30 +2,16 @@ module Dapp
2
2
  module Dimg
3
3
  module Build
4
4
  module Stage
5
- class BeforeInstall < Base
5
+ class BeforeInstall < Instructions
6
6
  def initialize(dimg, next_stage)
7
7
  @prev_stage = From.new(dimg, self)
8
8
  super
9
9
  end
10
10
 
11
- def empty?
12
- !dimg.builder.before_install?
13
- end
14
-
15
11
  def dependencies
16
12
  [builder_checksum]
17
13
  end
18
14
 
19
- def builder_checksum
20
- dimg.builder.before_install_checksum
21
- end
22
-
23
- def prepare_image
24
- super do
25
- dimg.builder.before_install(image)
26
- end
27
- end
28
-
29
15
  def image_should_be_untagged_condition
30
16
  false
31
17
  end
@@ -2,29 +2,11 @@ module Dapp
2
2
  module Dimg
3
3
  module Build
4
4
  module Stage
5
- class BeforeSetup < Base
5
+ class BeforeSetup < Instructions
6
6
  def initialize(dimg, next_stage)
7
7
  @prev_stage = AfterInstallArtifact.new(dimg, self)
8
8
  super
9
9
  end
10
-
11
- def empty?
12
- !dimg.builder.before_setup?
13
- end
14
-
15
- def context
16
- [git_artifacts_dependencies, builder_checksum]
17
- end
18
-
19
- def builder_checksum
20
- dimg.builder.before_setup_checksum
21
- end
22
-
23
- def prepare_image
24
- super do
25
- dimg.builder.before_setup(image)
26
- end
27
- end
28
10
  end # BeforeSetup
29
11
  end # Stage
30
12
  end # Build
@@ -2,29 +2,11 @@ module Dapp
2
2
  module Dimg
3
3
  module Build
4
4
  module Stage
5
- class BuildArtifact < Base
5
+ class BuildArtifact < Instructions
6
6
  def initialize(dimg)
7
7
  @prev_stage = GAArtifactPatch.new(dimg, self)
8
8
  @dimg = dimg
9
9
  end
10
-
11
- def empty?
12
- !dimg.builder.build_artifact?
13
- end
14
-
15
- def context
16
- [git_artifacts_dependencies, builder_checksum]
17
- end
18
-
19
- def builder_checksum
20
- dimg.builder.build_artifact_checksum
21
- end
22
-
23
- def prepare_image
24
- super do
25
- dimg.builder.build_artifact(image)
26
- end
27
- end
28
10
  end # BuildArtifact
29
11
  end # Stage
30
12
  end # Build
@@ -8,7 +8,7 @@ module Dapp
8
8
  end
9
9
 
10
10
  def empty?
11
- dimg.stage_by_name(related_stage_name).empty? || super
11
+ dimg.stage_by_name(related_stage_name).context.compact.empty? || super
12
12
  end
13
13
 
14
14
  def related_stage_name
@@ -3,31 +3,13 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  module Install
6
- class Install < Base
6
+ class Install < Instructions
7
7
  include Mod::Group
8
8
 
9
9
  def initialize(dimg, next_stage)
10
10
  @prev_stage = GAPreInstallPatch.new(dimg, self)
11
11
  super
12
12
  end
13
-
14
- def empty?
15
- !dimg.builder.install?
16
- end
17
-
18
- def context
19
- [git_artifacts_dependencies, builder_checksum]
20
- end
21
-
22
- def builder_checksum
23
- dimg.builder.install_checksum
24
- end
25
-
26
- def prepare_image
27
- super do
28
- dimg.builder.install(image)
29
- end
30
- end
31
13
  end # Install
32
14
  end # Install
33
15
  end # Stage
@@ -0,0 +1,27 @@
1
+ module Dapp
2
+ module Dimg
3
+ module Build
4
+ module Stage
5
+ class Instructions < Base
6
+ def empty?
7
+ !dimg.builder.public_send(:"#{name}?")
8
+ end
9
+
10
+ def context
11
+ [git_artifacts_dependencies, builder_checksum]
12
+ end
13
+
14
+ def builder_checksum
15
+ dimg.builder.public_send(:"#{name}_checksum")
16
+ end
17
+
18
+ def prepare_image
19
+ super do
20
+ dimg.builder.public_send(name, image)
21
+ end
22
+ end
23
+ end # Instructions
24
+ end # Stage
25
+ end # Build
26
+ end # Dimg
27
+ end # Dapp
@@ -3,31 +3,13 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  module Setup
6
- class Setup < Base
6
+ class Setup < Instructions
7
7
  include Mod::Group
8
8
 
9
9
  def initialize(dimg, next_stage)
10
10
  @prev_stage = GAPreSetupPatch.new(dimg, self)
11
11
  super
12
12
  end
13
-
14
- def empty?
15
- !dimg.builder.setup?
16
- end
17
-
18
- def context
19
- [git_artifacts_dependencies, builder_checksum]
20
- end
21
-
22
- def builder_checksum
23
- dimg.builder.setup_checksum
24
- end
25
-
26
- def prepare_image
27
- super do
28
- dimg.builder.setup(image)
29
- end
30
- end
31
13
  end # Setup
32
14
  end # Setup
33
15
  end # Stage
@@ -137,11 +137,14 @@ module Dapp
137
137
  }
138
138
 
139
139
  define_method("#{stage}_checksum") do
140
- dimg.hashsum [
141
- JSON.dump(stage_config(stage)['tasks']),
142
- dimg.config._ansible["#{stage}_version"],
143
- dimg.config._ansible["version"]
144
- ]
140
+ checksum_args = []
141
+ checksum_args << JSON.dump(stage_config(stage)['tasks']) unless stage_config(stage)['tasks'].empty?
142
+ checksum_args << public_send("#{stage}_version_checksum")
143
+ _checksum checksum_args
144
+ end
145
+
146
+ define_method("#{stage}_version_checksum") do
147
+ _checksum(dimg.config._ansible["#{stage}_version"], dimg.config._ansible['version'])
145
148
  end
146
149
 
147
150
  define_method(stage.to_s) do |image|
@@ -171,14 +174,14 @@ module Dapp
171
174
  end
172
175
 
173
176
  def stage_empty?(stage)
174
- stage_config(stage)['tasks'].empty?
177
+ stage_config(stage)['tasks'].empty? && public_send("#{stage}_version_checksum").nil?
175
178
  end
176
179
 
177
180
  # host directory in tmp_dir with directories structure
178
181
  def host_workdir(stage)
179
182
  @host_workdirs ||= {}
180
183
  @host_workdirs[stage.to_s] ||= begin
181
- dimg.tmp_path(dimg.dapp.consistent_uniq_slugify(dimg.config._name || "nameless"), "ansible-workdir-#{stage.to_s}").tap {|p| p.mkpath}
184
+ dimg.tmp_path(dimg.dapp.consistent_uniq_slugify(dimg.config._name || "nameless"), "ansible-workdir-#{stage}").tap {|p| p.mkpath}
182
185
  end
183
186
  end
184
187
 
@@ -186,7 +189,7 @@ module Dapp
186
189
  def host_tmpdir(stage)
187
190
  @host_tmpdirs ||= {}
188
191
  @host_tmpdirs[stage.to_s] ||= begin
189
- dimg.tmp_path(dimg.dapp.consistent_uniq_slugify(dimg.config._name || "nameless"), "ansible-tmpdir-#{stage.to_s}").tap do |p|
192
+ dimg.tmp_path(dimg.dapp.consistent_uniq_slugify(dimg.config._name || "nameless"), "ansible-tmpdir-#{stage}").tap do |p|
190
193
  p.mkpath
191
194
  p.join('local').mkpath
192
195
  p.join('remote').mkpath
@@ -72,6 +72,11 @@ module Dapp
72
72
  def build_artifact_checksum
73
73
  raise
74
74
  end
75
+
76
+ def _checksum(*args)
77
+ return if args.flatten.compact.delete_if { |val| val.respond_to?(:empty?) && val.empty? }.empty?
78
+ dimg.hashsum args
79
+ end
75
80
  end # Builder::Base
76
81
  end # Dimg
77
82
  end # Dapp
@@ -3,9 +3,13 @@ module Dapp
3
3
  class Builder::Shell < Builder::Base
4
4
  [:before_install, :before_setup, :install, :setup, :build_artifact].each do |stage|
5
5
  define_method("#{stage}_checksum") do
6
- [dimg.config._shell.public_send("_#{stage}_command"),
7
- dimg.config._shell.public_send("_#{stage}_version"),
8
- dimg.config._shell._version].flatten
6
+ _checksum(
7
+ dimg.config._shell.public_send("_#{stage}_command"),
8
+ public_send("#{stage}_version_checksum")
9
+ )
10
+ end
11
+ define_method("#{stage}_version_checksum") do
12
+ _checksum(dimg.config._shell.public_send("_#{stage}_version"), dimg.config._shell._version)
9
13
  end
10
14
  define_method("#{stage}?") { !stage_empty?(stage) }
11
15
  define_method(stage.to_s) do |image|
@@ -14,7 +18,7 @@ module Dapp
14
18
  end
15
19
 
16
20
  def stage_empty?(stage)
17
- stage_commands(stage).empty?
21
+ stage_commands(stage).empty? && public_send("#{stage}_version_checksum").nil?
18
22
  end
19
23
 
20
24
  def stage_commands(stage)
@@ -180,65 +180,59 @@ module Dapp
180
180
  # pod items[] spec containers[] image
181
181
  def pod_images(client)
182
182
  client.pod_list['items'].map do |item|
183
- images_from_pod_spec(item)
183
+ item['spec']['containers'].map{ |cont| cont['image'] }
184
184
  end
185
185
  end
186
186
 
187
187
  # cronjob items[] spec jobTemplate spec template spec containers[] image
188
188
  def cronjob_images(client)
189
189
  client.cronjob_list['items'].map do |item|
190
- images_from_pod_spec(item['spec']['jobTemplate']['spec']['template'])
190
+ item['spec']['jobTemplate']['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
191
191
  end
192
192
  end
193
193
 
194
194
  # daemonsets items[] spec template spec containers[] image
195
195
  def daemonset_images(client)
196
196
  client.daemonset_list['items'].map do |item|
197
- images_from_pod_spec(item['spec']['template'])
197
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
198
198
  end
199
199
  end
200
200
 
201
201
  # deployment items[] spec template spec containers[] image
202
202
  def deployment_images(client)
203
203
  client.deployment_list['items'].map do |item|
204
- images_from_pod_spec(item['spec']['template'])
204
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
205
205
  end
206
206
  end
207
207
 
208
208
  # job items[] spec template spec containers[] image
209
209
  def job_images(client)
210
210
  client.job_list['items'].map do |item|
211
- images_from_pod_spec(item['spec']['template'])
211
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
212
212
  end
213
213
  end
214
214
 
215
215
  # replicasets items[] spec template spec containers[] image
216
216
  def replicaset_images(client)
217
217
  client.replicaset_list['items'].map do |item|
218
- images_from_pod_spec(item['spec']['template'])
218
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
219
219
  end
220
220
  end
221
221
 
222
222
  # replicasets items[] spec template spec containers[] image
223
223
  def statefulset_images(client)
224
224
  client.statefulset_list['items'].map do |item|
225
- images_from_pod_spec(item['spec']['template'])
225
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
226
226
  end
227
227
  end
228
228
 
229
229
  # replicationcontroller items[] spec template spec containers[] image
230
230
  def replicationcontroller_images(client)
231
231
  client.replicationcontroller_list['items'].map do |item|
232
- images_from_pod_spec(item['spec']['template'])
232
+ item['spec']['template']['spec']['containers'].map{ |cont| cont['image'] }
233
233
  end
234
234
  end
235
235
 
236
- def images_from_pod_spec(pod_spec)
237
- containers = Array(pod_spec['spec']['containers'])
238
- initContainers = Array(pod_spec['spec']['initContainers'])
239
- (containers + initContainers).map { |cont| cont['image'] }
240
- end
241
-
242
236
  def without_kube?
243
237
  !!options[:without_kube]
244
238
  end
@@ -17,8 +17,7 @@ module Dapp
17
17
  "repo" => repo,
18
18
  "docker_tag" => docker_tag,
19
19
  },
20
- # TODO: enable again with chars escape
21
- # "ci" => ENV.select { |k, _| k.start_with?('CI_') && k != "CI_ENVIRONMENT_URL" },
20
+ "ci" => ENV.select { |k, _| k.start_with?('CI_') && k != "CI_ENVIRONMENT_URL" },
22
21
  }
23
22
  }
24
23
 
@@ -35,12 +35,6 @@ module Dapp
35
35
  '/apis/batch/v1' => [:job, ],
36
36
  '/apis/batch/v1beta1' => [:cronjob, ],
37
37
  },
38
- '1.11' => {
39
- '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
40
- '/apis/apps/v1' => [:daemonset, :deployment, :replicaset, :statefulset, ],
41
- '/apis/batch/v1' => [:job, ],
42
- '/apis/batch/v1beta1' => [:cronjob, ],
43
- },
44
38
  'stable' => {
45
39
  '/api/v1' => [:service, :replicationcontroller, :pod, :podtemplate, ],
46
40
  '/apis/batch/v1' => [:job, ],
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.30.10"
2
+ VERSION = "0.31.0"
3
3
  BUILD_CACHE_VERSION = 30
4
4
  end
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.30.10
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-08 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -527,6 +527,7 @@ files:
527
527
  - lib/dapp/dimg/build/stage/install/ga_post_install_patch.rb
528
528
  - lib/dapp/dimg/build/stage/install/ga_pre_install_patch.rb
529
529
  - lib/dapp/dimg/build/stage/install/install.rb
530
+ - lib/dapp/dimg/build/stage/instructions.rb
530
531
  - lib/dapp/dimg/build/stage/mod/group.rb
531
532
  - lib/dapp/dimg/build/stage/mod/logging.rb
532
533
  - lib/dapp/dimg/build/stage/setup/ga_post_setup_patch.rb
@@ -743,7 +744,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
743
744
  version: 2.5.0
744
745
  requirements: []
745
746
  rubyforge_project:
746
- rubygems_version: 2.7.6
747
+ rubygems_version: 2.7.7
747
748
  signing_key:
748
749
  specification_version: 4
749
750
  summary: Build docker packaged apps using chef or shell