dapp 0.6.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01ccef0d1d810b43eca5b590a2b2509eb66ef5f0
4
- data.tar.gz: 6b78e52904754a66a6789d73e9db2a3ecd4e1fe9
3
+ metadata.gz: 4b6165113f304afaf820870c5c598fee4e1479bd
4
+ data.tar.gz: 88972466d5e6c65afe11935e7f942bb9277053da
5
5
  SHA512:
6
- metadata.gz: 4a013f7409fc4a7a543d5cfc12d978dcc38d015b076e49f00161ab8e3012f58527c93d4cf22b44ff5d2401761afc4f5225be0812b4271acfc2cddb597c528aa8
7
- data.tar.gz: c7e382cd7d9010cb78bfb380e4fab60b7392cca4fc53596979ab56749dfb765c8a00f28bd1993faffa6c16a5549892c7712bd6811cea01fd70894cbc8222ba1f
6
+ metadata.gz: a3f72d1c7e43506f02d5df57543652f1b1d6e33d04552c340cf67b28ae35a2bd5b3e244ae8985ac176d03fdec08c1fb509edf40f1f77880af2ce0e176ef5725b
7
+ data.tar.gz: 7b51f113c56a01579955a6fb554baa10c69f5a22f8267f0998cc0117a0d2aaff01036971777a2ae849a0b245894df485cf9f4279100c7f90e58e8d1fbec4368a
@@ -56,11 +56,9 @@ module Dapp
56
56
  @gitartifact_container ||= begin
57
57
  if application.project.shellout("docker inspect #{g_a_container_name}").exitstatus.nonzero?
58
58
  application.project.log_secondary_process(application.project.t(code: 'process.git_artifact_loading'), short: true) do
59
- application.project.shellout ['docker run',
60
- '--restart=no',
59
+ application.project.shellout ['docker create',
61
60
  "--name #{g_a_container_name}",
62
- "--volume /.dapp/deps/gitartifact #{GITARTIFACT_IMAGE}",
63
- '2>/dev/null'].join(' ')
61
+ "--volume /.dapp/deps/gitartifact #{GITARTIFACT_IMAGE}"].join(' ')
64
62
  end
65
63
  end
66
64
 
@@ -60,6 +60,7 @@ module Dapp
60
60
  credentials += "-g #{group} " if group
61
61
 
62
62
  copy_files = lambda do |from_, cwd_, path_ = ''|
63
+ cwd_ = File.expand_path(File.join('/', cwd_))
63
64
  "find #{File.join(from_, cwd_, path_)} -type f -exec bash -ec 'install -D #{credentials} {} " \
64
65
  "#{File.join(to, "$(echo {} | sed -e \"s/#{File.join(from_, cwd_).gsub('/', '\\/')}//g\")")}' \\;"
65
66
  end
@@ -141,6 +141,7 @@ module Dapp
141
141
  application.paths_content_hashsum(paths),
142
142
  *paths.map { |p| p.relative_path_from(berksfile.home_path).to_s }.sort,
143
143
  (berksfile_lock_checksum unless application.project.cli_options[:dev]),
144
+ *enabled_recipes,
144
145
  *enabled_modules
145
146
  ].compact
146
147
  end
@@ -159,11 +160,9 @@ module Dapp
159
160
  if application.project.shellout("docker inspect #{chefdk_container_name}").exitstatus.nonzero?
160
161
  application.project.log_secondary_process(application.project.t(code: 'process.chefdk_loading'), short: true) do
161
162
  application.project.shellout(
162
- ['docker run',
163
- '--restart=no',
163
+ ['docker create',
164
164
  "--name #{chefdk_container_name}",
165
- "--volume /.dapp/deps/chefdk #{chefdk_image}",
166
- '2>/dev/null'].join(' ')
165
+ "--volume /.dapp/deps/chefdk #{chefdk_image}"].join(' ')
167
166
  )
168
167
  end
169
168
  end
@@ -92,7 +92,7 @@ module Dapp
92
92
  end
93
93
 
94
94
  def diff_command(from, to, quiet: false)
95
- "diff --binary --full-index #{'--quiet' if quiet} #{from}..#{to} #{"--relative=#{cwd}" if cwd} -- #{paths(true)}"
95
+ "diff --binary #{'--quiet' if quiet} #{from}..#{to} #{"--relative=#{cwd}" if cwd} -- #{paths(true)}"
96
96
  end
97
97
  end
98
98
  end
@@ -21,13 +21,23 @@ module Dapp
21
21
  raise Dapp::Lock::Error::Timeout, code: :timeout,
22
22
  data: { name: name, timeout: timeout }
23
23
  end
24
+
25
+ self.class.counter += 1
24
26
  end
25
27
 
26
28
  def unlock
27
- @file.flock(::File::LOCK_UN)
28
29
  @file.close
29
30
  @file = nil
31
+ self.class.counter -= 1
30
32
  end
33
+
34
+ class << self
35
+ attr_writer :counter
36
+
37
+ def counter
38
+ @counter ||= 0
39
+ end
40
+ end # << self
31
41
  end # File
32
42
  end # Lock
33
43
  end # Dapp
@@ -8,12 +8,14 @@ module Dapp
8
8
  def stages_cleanup(repo)
9
9
  repo_applications = repo_applications(repo)
10
10
  build_configs.map(&:_basename).uniq.each do |basename|
11
- log(basename)
12
- containers_flush(basename)
13
- apps, stages = project_images(basename).partition { |_, image_id| repo_applications.values.include?(image_id) }
14
- apps, stages = apps.to_h, stages.to_h
15
- apps.each { |_, aiid| stages = clear_stages(aiid, stages) }
16
- run_command(%(docker rmi #{stages.keys.join(' ')})) unless stages.keys.empty?
11
+ lock("#{basename}.images") do
12
+ log(basename)
13
+ containers_flush(basename)
14
+ apps, stages = project_images(basename).partition { |_, image_id| repo_applications.values.include?(image_id) }
15
+ apps, stages = apps.to_h, stages.to_h
16
+ apps.each { |_, aiid| stages = clear_stages(aiid, stages) }
17
+ run_command(%(docker rmi #{stages.keys.join(' ')})) unless stages.keys.empty?
18
+ end
17
19
  end
18
20
  end
19
21
 
@@ -26,7 +28,7 @@ module Dapp
26
28
  break if (iid = image_parent(iid)).empty?
27
29
  end
28
30
  else
29
- stages.delete_if { |_, siid| siid == iid }
31
+ stages.delete_if { |_, siid| siid == image_id }
30
32
  end
31
33
  stages
32
34
  end
@@ -7,9 +7,11 @@ module Dapp
7
7
  module StagesFlush
8
8
  def stages_flush
9
9
  build_configs.map(&:_basename).uniq.each do |basename|
10
- log(basename)
11
- containers_flush(basename)
12
- remove_images(%(docker images --format="{{.Repository}}:{{.Tag}}" #{stage_cache(basename)}))
10
+ lock("#{basename}.images") do
11
+ log(basename)
12
+ containers_flush(basename)
13
+ remove_images(%(docker images --format="{{.Repository}}:{{.Tag}}" #{stage_cache(basename)}))
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -10,6 +10,8 @@ module Dapp
10
10
  end # << self
11
11
 
12
12
  def run_ssh_agent
13
+ raise "Cannot fork dapp process: there are active file locks" unless ::Dapp::Lock::File.counter == 0
14
+
13
15
  sock_name = "dapp-ssh-#{SecureRandom.uuid}"
14
16
 
15
17
  "/tmp/#{sock_name}".tap do |sock_path|
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.6.1'.freeze
4
4
  BUILD_CACHE_VERSION = 3
5
5
  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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout