dapp 0.26.4 → 0.26.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d9e8f8d2fa7f410069b4b02556585308a99b85d
4
- data.tar.gz: f05375ed044a0c9f84c8acb2ea404c1c656f65e0
3
+ metadata.gz: ccf825a07836692f74d5cc646cd70097b4523df2
4
+ data.tar.gz: 7eeec05c6467aae9a5c93efcdab6e19fedec36e9
5
5
  SHA512:
6
- metadata.gz: 0566a3ba461e2aef89f22ece6e86bb1cb19f1e6cb6cd8d53681b75b5f6d923d0afccc33ac04d0f66a52752135b6449fe30b9d16c7b6e08d647643b037aa82516
7
- data.tar.gz: 89583da2b9c6844710ba58ac285662265e5b8b1b686fd3b4b36a19e27821d32e0ef99ad6473a2c43a79de424d0cc6cf434d6389244509e9081695348e854143a
6
+ metadata.gz: d61986ed6e35c8861cf2f503dd9db4abe534ea5a48ee8665598b1f9ec85c2ae7a72b0391c9b06aa8fc19583eadbf2d50add9b33f9392d673285b27c01b72e649
7
+ data.tar.gz: 8a6c2d8e70fc68ffcbf0e93d97741741952988e72ea4f24f2ccc6565d5bf110671796f1f7b9f341483928e8aaaf005b2cf838dde3bf69e73e584f1067f87ed47
@@ -21,6 +21,7 @@ en:
21
21
  toolchain_container_creating: 'creating dappdeps/toolchain container `%{name}`'
22
22
  base_container_creating: 'creating dappdeps/base container `%{name}`'
23
23
  chefdk_container_creating: 'creating dappdeps/chefdk container `%{name}`'
24
+ ansible_container_creating: 'creating dappdeps/ansible container `%{name}`'
24
25
  image_pull: "pulling image `%{name}`"
25
26
  image_push: "pushing image `%{name}`"
26
27
  image_save: "saving image `%{name}`"
@@ -135,6 +135,7 @@ require 'dapp/dimg/builder/chef/cookbook_metadata'
135
135
  require 'dapp/dimg/builder/chef/berksfile'
136
136
  require 'dapp/dimg/builder/chef/cookbook'
137
137
  require 'dapp/dimg/builder/shell'
138
+ require 'dapp/dimg/builder/ansible'
138
139
  require 'dapp/dimg/builder/none'
139
140
  require 'dapp/dimg/build/stage/mod/logging'
140
141
  require 'dapp/dimg/build/stage/mod/group'
@@ -140,13 +140,14 @@ module Dapp
140
140
 
141
141
  def try_host_docker_login
142
142
  return unless option_repo
143
-
144
143
  validate_repo_name!(option_repo)
144
+ host_docker_login(option_repo)
145
+ end
145
146
 
146
- if self.class.options_with_docker_credentials?
147
- username, password = self.class.docker_credentials
148
- shellout!("#{host_docker} login -u '#{username}' -p '#{password}' '#{option_repo}'")
149
- end
147
+ def host_docker_login(repo)
148
+ return unless self.class.options_with_docker_credentials?
149
+ username, password = self.class.docker_credentials
150
+ shellout!("#{host_docker} login -u '#{username}' -p '#{password}' '#{repo}'")
150
151
  end
151
152
 
152
153
  class << self
@@ -10,12 +10,22 @@ module Dapp
10
10
  protected
11
11
 
12
12
  def prepare_image
13
+ try_host_docker_login
13
14
  from_image.pull!
14
15
  raise Error::Build, code: :from_image_not_found, data: { name: from_image_name } unless from_image.tagged?
15
16
  add_cleanup_mounts_dirs_command
16
17
  super
17
18
  end
18
19
 
20
+ def try_host_docker_login
21
+ return unless registry_from_image_name?
22
+ dimg.dapp.host_docker_login(ENV['CI_REGISTRY'])
23
+ end
24
+
25
+ def registry_from_image_name?
26
+ ENV['CI_REGISTRY'] && from_image_name.start_with?(ENV['CI_REGISTRY'])
27
+ end
28
+
19
29
  def add_cleanup_mounts_dirs_command
20
30
  return if config_mounts_dirs.empty?
21
31
  image.add_service_command ["#{dimg.dapp.rm_bin} -rf %s",
@@ -0,0 +1,40 @@
1
+ module Dapp
2
+ module Dimg
3
+ class Builder::Ansible < Builder::Base
4
+ ANSIBLE_IMAGE_VERSION = "2.4.1.0-1"
5
+
6
+ def ansible_bin
7
+ "/.dapp/deps/ansible/#{ANSIBLE_IMAGE_VERSION}/bin/ansible"
8
+ end
9
+
10
+ def ansible_image
11
+ "dappdeps/ansible:#{ANSIBLE_IMAGE_VERSION}"
12
+ end
13
+
14
+ def ansible_container_name
15
+ "dappdeps_ansible_#{ANSIBLE_IMAGE_VERSION}"
16
+ end
17
+
18
+ def ansible_container
19
+ @ansible_container ||= begin
20
+ is_container_exist = proc{dimg.dapp.shellout("#{dimg.dapp.host_docker} inspect #{ansible_container_name}").exitstatus.zero?}
21
+ if !is_container_exist.call
22
+ dimg.dapp.lock("dappdeps.container.#{ansible_container_name}", default_timeout: 600) do
23
+ if !is_container_exist.call
24
+ dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.ansible_container_creating', data: {name: ansible_container_name}), short: true) do
25
+ dimg.dapp.shellout!(
26
+ ["#{dimg.dapp.host_docker} create",
27
+ "--name #{ansible_container_name}",
28
+ "--volume /.dapp/deps/ansible/#{ANSIBLE_IMAGE_VERSION} #{ansible_image}"].join(' ')
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ ansible_container_name
35
+ end
36
+ end
37
+
38
+ end # Builder::Ansible
39
+ end # Dimg
40
+ end # Dapp
@@ -32,6 +32,8 @@ module Dapp
32
32
  [].tap do |artifacts|
33
33
  artifacts << (artifact = ::Dapp::Dimg::GitArtifact.new(repo, self, **git_artifact_options))
34
34
  artifacts.concat(generate_git_embedded_artifacts(artifact))
35
+ end.select do |artifact|
36
+ !artifact.empty?
35
37
  end
36
38
  end
37
39
 
@@ -290,6 +290,10 @@ module Dapp
290
290
  any_changes?(*patch_stage_commits(stage))
291
291
  end
292
292
 
293
+ def empty?
294
+ repo_entries(latest_commit).empty?
295
+ end
296
+
293
297
  protected
294
298
 
295
299
  def hexdigest(*args)
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.26.4"
2
+ VERSION = "0.26.5"
3
3
  BUILD_CACHE_VERSION = 26
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.26.4
4
+ version: 0.26.5
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-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -534,6 +534,7 @@ files:
534
534
  - lib/dapp/dimg/build/stage/setup/ga_pre_setup_patch.rb
535
535
  - lib/dapp/dimg/build/stage/setup/setup.rb
536
536
  - lib/dapp/dimg/builder.rb
537
+ - lib/dapp/dimg/builder/ansible.rb
537
538
  - lib/dapp/dimg/builder/base.rb
538
539
  - lib/dapp/dimg/builder/chef.rb
539
540
  - lib/dapp/dimg/builder/chef/berksfile.rb