dapp 0.6.16 → 0.6.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e78ed224c52a413cdceeaacf7877326f47dc1dd
|
4
|
+
data.tar.gz: ec07c5e997ed182b9ccfcf1c8097823ef3294d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e3e56663b2ee9c215a284a7e59ba2ce71bf1a888c695002f123862d2c8e59676dc5a91ac74fe81082bc1ac4d14498eaab9e7d3e264501912e7f144535a0e0ed
|
7
|
+
data.tar.gz: b105a61fec8f6b30bb9d9d65ed8621bfaba027e299136fd2f739a1f650453c6af6bca4656d63adc64811ccd65a5c3c7205f578da0dbfdc6a56fa17b7c7481e32
|
@@ -19,7 +19,7 @@ module Dapp
|
|
19
19
|
|
20
20
|
def from(image, cache_version: nil)
|
21
21
|
image = image.to_s
|
22
|
-
raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless
|
22
|
+
raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless Image::Docker.image_name?(image)
|
23
23
|
raise(Error::Config, code: :docker_from_without_tag, data: { name: image }) unless image.include?(':')
|
24
24
|
@_from = image
|
25
25
|
@_from_cache_version = cache_version
|
data/lib/dapp/docker_registry.rb
CHANGED
@@ -2,7 +2,7 @@ module Dapp
|
|
2
2
|
# DockerRegistry
|
3
3
|
module DockerRegistry
|
4
4
|
def self.new(repo)
|
5
|
-
|
5
|
+
/^#{repo_name_format}$/ =~ repo
|
6
6
|
expected_hostname = Regexp.last_match(:hostname)
|
7
7
|
expected_repo_suffix = Regexp.last_match(:repo_suffix)
|
8
8
|
expected_hostname_url = expected_hostname ? "http://#{expected_hostname}" : nil
|
@@ -14,14 +14,18 @@ module Dapp
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.
|
17
|
+
def self.repo_name_format
|
18
18
|
separator = '[_.]|__|[-]*'
|
19
19
|
alpha_numeric = '[[:alnum:]]*'
|
20
20
|
component = "#{alpha_numeric}[#{separator}#{alpha_numeric}]*"
|
21
21
|
port_number = '[[:digit:]]+'
|
22
|
-
hostcomponent = '[[:alnum:]-]*[[:alnum:]]'
|
23
|
-
hostname = "#{hostcomponent}[
|
24
|
-
|
22
|
+
hostcomponent = '[[:alnum:]_-]*[[:alnum:]]'
|
23
|
+
hostname = "#{hostcomponent}[\\.#{hostcomponent}]*(?<port>:#{port_number})?"
|
24
|
+
"(?<hostname>#{hostname}/)?(?<repo_suffix>#{component}[/#{component}]*)"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.repo_name?(name)
|
28
|
+
!(/^#{repo_name_format}$/ =~ name).nil?
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.hostname_exist?(url)
|
data/lib/dapp/image/docker.rb
CHANGED
@@ -68,8 +68,14 @@ module Dapp
|
|
68
68
|
end
|
69
69
|
|
70
70
|
class << self
|
71
|
-
def
|
72
|
-
|
71
|
+
def image_name_format
|
72
|
+
separator = '[_.]|__|[-]*'
|
73
|
+
tag = "[[:alnum:]][[[:alnum:]]#{separator}]{0,127}"
|
74
|
+
"#{DockerRegistry.repo_name_format}(:(?<tag>#{tag}))?"
|
75
|
+
end
|
76
|
+
|
77
|
+
def image_name?(name)
|
78
|
+
!(/^#{image_name_format}$/ =~ name).nil?
|
73
79
|
end
|
74
80
|
|
75
81
|
def tag!(id:, tag:)
|
@@ -64,7 +64,7 @@ module Dapp
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def validate_repo_name(repo)
|
67
|
-
raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless
|
67
|
+
raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless DockerRegistry.repo_name?(repo)
|
68
68
|
end
|
69
69
|
|
70
70
|
def proper_cache_version?
|
@@ -7,7 +7,7 @@ module Dapp
|
|
7
7
|
module Tag
|
8
8
|
def tag(tag)
|
9
9
|
raise Error::Project, code: :tag_command_unexpected_apps_number unless build_configs.one?
|
10
|
-
raise Error::Project, code: :tag_command_incorrect_tag, data: { name: tag } unless
|
10
|
+
raise Error::Project, code: :tag_command_incorrect_tag, data: { name: tag } unless Image::Docker.image_name?(tag)
|
11
11
|
Application.new(config: build_configs.first, project: self, ignore_git_fetch: true, should_be_built: true).tap do |app|
|
12
12
|
app.tag!(tag)
|
13
13
|
end
|
data/lib/dapp/version.rb
CHANGED