dapp 0.22.7 → 0.22.8
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 +4 -4
- data/lib/dapp/dapp.rb +17 -13
- data/lib/dapp/dimg/cli/command/dimg/bp.rb +6 -0
- data/lib/dapp/dimg/cli/command/dimg/cleanup_repo.rb +3 -3
- data/lib/dapp/dimg/cli/command/dimg/flush_local.rb +1 -1
- data/lib/dapp/dimg/cli/command/dimg/flush_repo.rb +7 -1
- data/lib/dapp/dimg/dapp/command/stages/common.rb +2 -5
- data/lib/dapp/dimg/docker_registry/base.rb +1 -1
- data/lib/dapp/dimg/docker_registry/base/authorization.rb +16 -14
- data/lib/dapp/dimg/docker_registry/base/request.rb +1 -1
- data/lib/dapp/dimg/image/argument.rb +1 -1
- data/lib/dapp/kube/cli/command/kube/lint.rb +6 -0
- data/lib/dapp/kube/cli/command/kube/render.rb +6 -0
- data/lib/dapp/version.rb +2 -2
- 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: 5be296595c66f302d0e6226ba61deadbed26a924
|
4
|
+
data.tar.gz: 7ccabbde07fe12ff244351d029f14bac3d84e47d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eefcc9b0784aaf84d3132129e27cc450ee5835b3f29a9688a60fdf3dc86e4e62b6a280cf9471f77ff4cec0eabc2f47237e86551a5cddbd72ee080e3163fc906
|
7
|
+
data.tar.gz: a80bc990f70fd9fc8244c2a76a8958a94d20ba7fd5c94aa0130ef5fd0ef980c674f4bf11ab519a489e88176281ef32e319cb4af75702310f9176f8343e0a4a7a
|
data/lib/dapp/dapp.rb
CHANGED
@@ -149,24 +149,28 @@ module Dapp
|
|
149
149
|
|
150
150
|
def host_docker
|
151
151
|
@host_docker ||= begin
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
required_min_docker_version = Gem::Version.new('1.10')
|
157
|
-
|
158
|
-
if required_min_docker_version >= current_docker_version
|
159
|
-
raise Error::Dapp, code: :docker_version, data: { min_version: required_min_docker_version.to_s,
|
160
|
-
version: current_docker_version.to_s }
|
152
|
+
min_docker_minor_version = Gem::Version.new('1.10')
|
153
|
+
unless host_docker_minor_version > min_docker_minor_version
|
154
|
+
raise Error::Dapp, code: :docker_version, data: { min_version: min_docker_minor_version.to_s,
|
155
|
+
version: host_docker_minor_version.to_s }
|
161
156
|
end
|
162
157
|
|
163
158
|
[].tap do |cmd|
|
164
|
-
cmd <<
|
159
|
+
cmd << host_docker_bin
|
165
160
|
cmd << "--config #{host_docker_config_dir}"
|
166
161
|
end.join(' ')
|
167
162
|
end
|
168
163
|
end
|
169
164
|
|
165
|
+
def host_docker_bin
|
166
|
+
raise Error::Dapp, code: :docker_not_found if (res = shellout('which docker')).exitstatus.nonzero?
|
167
|
+
res.stdout.strip
|
168
|
+
end
|
169
|
+
|
170
|
+
def host_docker_minor_version
|
171
|
+
Gem::Version.new(shellout!("#{host_docker_bin} --version").stdout.strip[/\d+\.\d+/])
|
172
|
+
end
|
173
|
+
|
170
174
|
def host_docker_config_dir
|
171
175
|
if options_with_docker_credentials? && !options[:repo].nil?
|
172
176
|
host_docker_tmp_config_dir
|
@@ -178,14 +182,14 @@ module Dapp
|
|
178
182
|
end
|
179
183
|
|
180
184
|
def options_with_docker_credentials?
|
181
|
-
|
185
|
+
!docker_credentials.nil?
|
182
186
|
end
|
183
187
|
|
184
188
|
def docker_credentials
|
185
189
|
if options.key?(:registry_username) && options.key?(:registry_password)
|
186
190
|
[options[:registry_username], options[:registry_password]]
|
187
|
-
elsif ENV.key?('CI_JOB_TOKEN')
|
188
|
-
['gitlab-ci-token', ENV['CI_JOB_TOKEN']]
|
191
|
+
elsif ENV.key?('DAPP_CI_JOB_TOKEN') || ENV.key?('CI_JOB_TOKEN')
|
192
|
+
['gitlab-ci-token', ENV['DAPP_CI_JOB_TOKEN'] || ENV['CI_JOB_TOKEN']]
|
189
193
|
end
|
190
194
|
end
|
191
195
|
|
@@ -31,6 +31,12 @@ BANNER
|
|
31
31
|
'(use system ssh-agent by default)'].join,
|
32
32
|
default: nil,
|
33
33
|
proc: ->(v) { composite_options(:ssh_key) << v }
|
34
|
+
|
35
|
+
option :registry_username,
|
36
|
+
long: '--registry-username USERNAME'
|
37
|
+
|
38
|
+
option :registry_password,
|
39
|
+
long: '--registry-password PASSWORD'
|
34
40
|
end
|
35
41
|
end
|
36
42
|
end
|
@@ -24,15 +24,15 @@ BANNER
|
|
24
24
|
boolean: true
|
25
25
|
|
26
26
|
option :registry_username,
|
27
|
-
|
27
|
+
long: '--registry-username USERNAME'
|
28
28
|
|
29
29
|
option :registry_password,
|
30
|
-
|
30
|
+
long: '--registry-password PASSWORD'
|
31
31
|
|
32
32
|
def run(argv = ARGV)
|
33
33
|
self.class.parse_options(self, argv)
|
34
34
|
repo = self.class.required_argument(self, 'repo')
|
35
|
-
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments, repo: repo))
|
35
|
+
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments, repo: repo, verbose: true))
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -16,7 +16,7 @@ BANNER
|
|
16
16
|
|
17
17
|
def run(argv = ARGV)
|
18
18
|
self.class.parse_options(self, argv)
|
19
|
-
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments))
|
19
|
+
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments, verbose: true))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -19,10 +19,16 @@ BANNER
|
|
19
19
|
long: '--with-stages',
|
20
20
|
boolean: true
|
21
21
|
|
22
|
+
option :registry_username,
|
23
|
+
long: '--registry-username USERNAME'
|
24
|
+
|
25
|
+
option :registry_password,
|
26
|
+
long: '--registry-password PASSWORD'
|
27
|
+
|
22
28
|
def run(argv = ARGV)
|
23
29
|
self.class.parse_options(self, argv)
|
24
30
|
repo = self.class.required_argument(self, 'repo')
|
25
|
-
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments, repo: repo))
|
31
|
+
run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments, repo: repo, verbose: true))
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
@@ -45,11 +45,8 @@ module Dapp
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def delete_repo_image(registry, repo_image)
|
48
|
-
if dry_run?
|
49
|
-
|
50
|
-
else
|
51
|
-
registry.image_delete(repo_image[:tag], repo_image[:dimg])
|
52
|
-
end
|
48
|
+
log([repo_image[:dimg], repo_image[:tag]].compact.join(':')) if dry_run? || log_verbose?
|
49
|
+
registry.image_delete(repo_image[:tag], repo_image[:dimg]) unless dry_run?
|
53
50
|
end
|
54
51
|
|
55
52
|
def select_dapp_artifacts_ids(labels)
|
@@ -39,7 +39,7 @@ module Dapp
|
|
39
39
|
api_request(repo_suffix, "/manifests/#{image_digest(tag)}",
|
40
40
|
method: :delete,
|
41
41
|
expects: [202, 404],
|
42
|
-
headers: { Accept: '
|
42
|
+
headers: { Accept: 'application/vnd.docker.distribution.manifest.v2+json' })
|
43
43
|
end
|
44
44
|
|
45
45
|
def image_history(tag)
|
@@ -3,9 +3,9 @@ module Dapp
|
|
3
3
|
module DockerRegistry
|
4
4
|
class Base
|
5
5
|
module Authorization
|
6
|
-
def authorization_options(url)
|
7
|
-
(@authorization_options ||= {})[@repo_suffix] ||= begin
|
8
|
-
case authenticate_header = raw_request(url).headers['Www-Authenticate']
|
6
|
+
def authorization_options(url, method:)
|
7
|
+
(@authorization_options ||= {})[[@repo_suffix, method]] ||= begin
|
8
|
+
case authenticate_header = raw_request(url, method: method).headers['Www-Authenticate']
|
9
9
|
when /Bearer/ then { headers: { Authorization: "Bearer #{authorization_token(authenticate_header)}" } }
|
10
10
|
when /Basic/ then { headers: { Authorization: "Basic #{authorization_auth}" } }
|
11
11
|
when nil then {}
|
@@ -34,18 +34,20 @@ module Dapp
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def authorization_auth
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
@authorization_auth ||= begin
|
38
|
+
if ::Dapp::Dapp.options_with_docker_credentials?
|
39
|
+
Base64.strict_encode64(::Dapp::Dapp.docker_credentials.join(':'))
|
40
|
+
else
|
41
|
+
auths = auths_section_from_docker_config
|
42
|
+
r = repo
|
43
|
+
loop do
|
44
|
+
break unless r.include?('/') && !auths.keys.any? { |auth| auth.start_with?(r) }
|
45
|
+
r = chomp_name(r)
|
46
|
+
end
|
47
|
+
credential = (auths[r] || auths.find { |repo, _| repo == r })
|
48
|
+
user_not_authorized! if credential.nil?
|
49
|
+
credential['auth']
|
45
50
|
end
|
46
|
-
credential = (auths[r] || auths.find { |repo, _| repo == r })
|
47
|
-
user_not_authorized! if credential.nil?
|
48
|
-
credential['auth']
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
@@ -8,7 +8,7 @@ module Dapp
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def request(url, **options)
|
11
|
-
raw_request(url, options.in_depth_merge(authorization_options(url)))
|
11
|
+
raw_request(url, options.in_depth_merge(authorization_options(url, method: options[:method] || :get)))
|
12
12
|
end
|
13
13
|
|
14
14
|
def raw_request(url, **options)
|
@@ -66,7 +66,7 @@ module Dapp
|
|
66
66
|
options.map do |key, vals|
|
67
67
|
case key
|
68
68
|
when :cmd, :entrypoint
|
69
|
-
vals = [''] if vals == []
|
69
|
+
vals = [''] if vals == [] && ::Dapp::Dapp.host_docker_minor_version >= Gem::Version.new('17.10')
|
70
70
|
[vals]
|
71
71
|
when :env, :label then vals.map(&method(:options_to_args)).flatten
|
72
72
|
else vals
|
@@ -29,6 +29,12 @@ BANNER
|
|
29
29
|
default: [],
|
30
30
|
proc: proc { |v| composite_options(:helm_secret_values) << v }
|
31
31
|
|
32
|
+
option :registry_username,
|
33
|
+
long: '--registry-username USERNAME'
|
34
|
+
|
35
|
+
option :registry_password,
|
36
|
+
long: '--registry-password PASSWORD'
|
37
|
+
|
32
38
|
def run(argv = ARGV)
|
33
39
|
self.class.parse_options(self, argv)
|
34
40
|
|
@@ -39,6 +39,12 @@ BANNER
|
|
39
39
|
default: [],
|
40
40
|
proc: proc { |v| composite_options(:templates) << v }
|
41
41
|
|
42
|
+
option :registry_username,
|
43
|
+
long: '--registry-username USERNAME'
|
44
|
+
|
45
|
+
option :registry_password,
|
46
|
+
long: '--registry-password PASSWORD'
|
47
|
+
|
42
48
|
def run(argv = ARGV)
|
43
49
|
self.class.parse_options(self, argv)
|
44
50
|
run_dapp_command(nil, options: cli_options, log_running_time: false) do |dapp|
|
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.22.
|
4
|
+
version: 0.22.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|