dapp 0.6.10 → 0.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/en/common.yml +1 -0
- data/lib/dapp/builder/chef.rb +9 -3
- data/lib/dapp/builder/chef/berksfile.rb +11 -2
- data/lib/dapp/config/application.rb +1 -1
- data/lib/dapp/config/main.rb +1 -1
- data/lib/dapp/docker_registry/base.rb +3 -0
- data/lib/dapp/docker_registry/mod/authorization.rb +1 -0
- data/lib/dapp/image/stage.rb +1 -1
- data/lib/dapp/project/command/stages/common.rb +10 -2
- data/lib/dapp/project/logging/base.rb +2 -0
- data/lib/dapp/project/shellout/system.rb +13 -3
- 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: bfc6a68fd3d125233e595953664e147e4a209091
|
4
|
+
data.tar.gz: 369287b73a66da2d400db0ce1db3602e1d395f55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01ae25ee3031a89f7dff9990307286acb747f08f469eba7524c5ec558b3fe06a5dd96ed0d9b628a14217dba0a00634b533ea18bac56d00141a847912b1997af3
|
7
|
+
data.tar.gz: bb3d48378904ff32abecd2efbbefe05c1e3143ee2bcc49698d398b313e59489e01a46fafa7166b1c25bcaa1e930dc515785ebcbe79ea153f804ac7e1f27721a0
|
data/config/en/common.yml
CHANGED
@@ -45,6 +45,7 @@ en:
|
|
45
45
|
excess_name_instruction: "WARNING: Excessive use of the 'name' instruction. Given name corresponds to default name."
|
46
46
|
another_image_already_tagged: 'WARNING: image with other id already exist.'
|
47
47
|
tag_ignored: "WARNING: tag '%{tag}' ignored."
|
48
|
+
dimg_not_found_in_registry: "WARNING: Dimg not found in registry."
|
48
49
|
group:
|
49
50
|
install_group: 'Install group'
|
50
51
|
setup_group: 'Setup group'
|
data/lib/dapp/builder/chef.rb
CHANGED
@@ -229,9 +229,15 @@ module Dapp
|
|
229
229
|
"#{application.project.mkdir_path} -p ~/.ssh",
|
230
230
|
"echo \"Host *\" >> ~/.ssh/config",
|
231
231
|
"echo \" StrictHostKeyChecking no\" >> ~/.ssh/config",
|
232
|
-
*berksfile
|
233
|
-
|
234
|
-
|
232
|
+
*berksfile
|
233
|
+
.local_cookbooks
|
234
|
+
.values
|
235
|
+
.map {|cookbook|
|
236
|
+
["#{application.project.rsync_path} --archive",
|
237
|
+
*cookbook[:chefignore].map {|path| "--exclude #{path}"},
|
238
|
+
"--relative #{cookbook[:path]} /tmp/local_cookbooks",
|
239
|
+
].join(' ')
|
240
|
+
},
|
235
241
|
"cd /tmp/local_cookbooks/#{berksfile_path.parent}",
|
236
242
|
*before_vendor_commands,
|
237
243
|
'/.dapp/deps/chefdk/bin/berks vendor /tmp/cookbooks',
|
@@ -41,10 +41,19 @@ module Dapp
|
|
41
41
|
raise(::Dapp::Builder::Chef::Error, code: :berksfile_absolute_path_forbidden,
|
42
42
|
data: { cookbook: name, path: path }) if path.start_with? '/'
|
43
43
|
|
44
|
-
|
44
|
+
desc = {
|
45
45
|
name: name,
|
46
|
-
path: home_path.join(path)
|
46
|
+
path: home_path.join(path),
|
47
|
+
chefignore: [],
|
47
48
|
}
|
49
|
+
|
50
|
+
if desc[:path].join('chefignore').exist?
|
51
|
+
chefignore_patterns = desc[:path].join('chefignore').read.split("\n").map(&:strip)
|
52
|
+
desc[:chefignore] = Dir[*chefignore_patterns.map {|pattern| desc[:path].join(pattern)}]
|
53
|
+
.map(&Pathname.method(:new))
|
54
|
+
end
|
55
|
+
|
56
|
+
@local_cookbooks[name] = desc
|
48
57
|
end
|
49
58
|
|
50
59
|
def local_cookbook?(name)
|
@@ -45,7 +45,7 @@ module Dapp
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def builder(type)
|
48
|
-
project.log_warning(desc: { code: 'excess_builder_instruction'
|
48
|
+
project.log_warning(desc: { code: 'excess_builder_instruction' }) if @_chef.send(:empty?) && @_shell.send(:empty?)
|
49
49
|
raise Error::Config, code: :builder_type_unsupported, data: { type: type } unless [:chef, :shell].include?((type = type.to_sym))
|
50
50
|
another_builder = [:chef, :shell].find { |t| t != type }
|
51
51
|
instance_variable_set(:"@_#{another_builder}", instance_variable_get(:"@_#{another_builder}").class.new)
|
data/lib/dapp/config/main.rb
CHANGED
@@ -12,7 +12,7 @@ module Dapp
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def name(value)
|
15
|
-
project.log_warning(desc: { code: 'excess_name_instruction'
|
15
|
+
project.log_warning(desc: { code: 'excess_name_instruction' }) if @_basename == value.to_s
|
16
16
|
@_basename = value
|
17
17
|
end
|
18
18
|
end
|
@@ -24,6 +24,9 @@ module Dapp
|
|
24
24
|
|
25
25
|
def tags
|
26
26
|
@tags ||= api_request(repo_suffix, 'tags/list')['tags'] || []
|
27
|
+
rescue Error::Registry => e
|
28
|
+
raise Exception::Registry, code: :dimg_not_found_in_registry if e.net_status[:code] == :page_not_found
|
29
|
+
raise
|
27
30
|
end
|
28
31
|
|
29
32
|
def image_id(tag)
|
@@ -9,6 +9,7 @@ module Dapp
|
|
9
9
|
case authenticate_header = raw_request(url).headers['Www-Authenticate']
|
10
10
|
when /Bearer/ then { headers: { Authorization: "Bearer #{authorization_token(authenticate_header)}" } }
|
11
11
|
when /Basic/ then { headers: { Authorization: "Basic #{authorization_auth}" } }
|
12
|
+
when nil then {}
|
12
13
|
else raise Error::Registry, code: :authenticate_type_not_supported
|
13
14
|
end
|
14
15
|
end
|
data/lib/dapp/image/stage.rb
CHANGED
@@ -44,7 +44,7 @@ module Dapp
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def tag!
|
47
|
-
project.log_warning(desc: { code: :another_image_already_tagged
|
47
|
+
project.log_warning(desc: { code: :another_image_already_tagged }) if !(existed_id = id).nil? && built_id != existed_id
|
48
48
|
project.shellout!("docker tag #{built_id} #{name}")
|
49
49
|
cache_reset
|
50
50
|
end
|
@@ -16,16 +16,24 @@ module Dapp
|
|
16
16
|
format = proc do |arr|
|
17
17
|
arr.map do |tag|
|
18
18
|
if (id = registry.image_id(tag)).nil?
|
19
|
-
log_warning(desc: { code: 'tag_ignored',
|
19
|
+
log_warning(desc: { code: 'tag_ignored', data: { tag: tag } })
|
20
20
|
else
|
21
21
|
[tag, id]
|
22
22
|
end
|
23
23
|
end.compact.to_h
|
24
24
|
end
|
25
|
-
applications, stages = registry.
|
25
|
+
applications, stages = registry_tags(registry).partition { |tag| !tag.start_with?('dappstage') }
|
26
26
|
[format.call(applications), format.call(stages)]
|
27
27
|
end
|
28
28
|
|
29
|
+
def registry_tags(registry)
|
30
|
+
registry.tags
|
31
|
+
rescue Exception::Registry => e
|
32
|
+
raise unless e.net_status[:code] == :dimg_not_found_in_registry
|
33
|
+
log_warning(desc: { code: 'dimg_not_found_in_registry' })
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
|
29
37
|
def delete_repo_image(registry, image_tag)
|
30
38
|
if dry_run?
|
31
39
|
log(image_tag)
|
@@ -5,7 +5,7 @@ module Dapp
|
|
5
5
|
# System
|
6
6
|
module System
|
7
7
|
SYSTEM_SHELLOUT_IMAGE = 'ubuntu:14.04'.freeze
|
8
|
-
SYSTEM_SHELLOUT_VERSION =
|
8
|
+
SYSTEM_SHELLOUT_VERSION = 3
|
9
9
|
|
10
10
|
def system_shellout_container_name
|
11
11
|
"dapp_system_shellout_#{hashsum [SYSTEM_SHELLOUT_VERSION,
|
@@ -19,10 +19,20 @@ module Dapp
|
|
19
19
|
|
20
20
|
@system_shellout_container ||= begin
|
21
21
|
lock(system_shellout_container_name) do
|
22
|
-
|
22
|
+
cmd = shellout("docker inspect -f {{.State.Running}} #{system_shellout_container_name}")
|
23
|
+
if cmd.exitstatus.nonzero?
|
24
|
+
start_container = true
|
25
|
+
elsif cmd.stdout.strip == 'false'
|
26
|
+
shellout!("docker rm -f #{system_shellout_container_name}")
|
27
|
+
start_container = true
|
28
|
+
else
|
29
|
+
start_container = false
|
30
|
+
end
|
31
|
+
|
32
|
+
if start_container
|
23
33
|
volumes_from = [base_container, gitartifact_container]
|
24
34
|
log_secondary_process(t(code: 'process.system_shellout_container_loading'), short: true) do
|
25
|
-
shellout! ['docker run --detach --privileged',
|
35
|
+
shellout! ['docker run --detach --privileged',
|
26
36
|
"--name #{system_shellout_container_name}",
|
27
37
|
*volumes_from.map { |container| "--volumes-from #{container}" },
|
28
38
|
'--volume /:/.system_shellout_root',
|
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.6.
|
4
|
+
version: 0.6.11
|
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-11-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|