avm-tools 0.23.0 → 0.24.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4deaa72e5e51d1dc4db756e57ea2bd1c8c6578f531d1ef2084a330719d74fb15
|
4
|
+
data.tar.gz: 6dd2b7bf04bdaa95b24d020fa7f4947ed3197588e497fe40ce51c0a5f90a688c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85cbe7adec68930b3d499a5d9765a8d86072a32f2f41730455c7236d5ba940dcee7fe259718840146143972c90cd0b50799c059f3745801051322ad5e733b978
|
7
|
+
data.tar.gz: 8dc0bb879ed769cc3760c4cbaf02dc2b62a7d765e97eb7bf7fcfc5cfaa15e761b1b95e57504e7ec79c7519dadd19077301a2ca679deddac41789feed60640fa0
|
data/lib/avm/docker/image.rb
CHANGED
@@ -7,6 +7,16 @@ require 'avm/patches/object/template'
|
|
7
7
|
module Avm
|
8
8
|
module Docker
|
9
9
|
class Image
|
10
|
+
attr_reader :registry
|
11
|
+
attr_accessor :snapshot
|
12
|
+
attr_accessor :version
|
13
|
+
|
14
|
+
def initialize(registry)
|
15
|
+
@registry = registry
|
16
|
+
self.snapshot = true
|
17
|
+
self.version = true
|
18
|
+
end
|
19
|
+
|
10
20
|
def build(extra_args = [])
|
11
21
|
on_build_dir do
|
12
22
|
template.apply(self, build_dir)
|
@@ -14,6 +24,10 @@ module Avm
|
|
14
24
|
end
|
15
25
|
end
|
16
26
|
|
27
|
+
def generator_version
|
28
|
+
::Avm::Tools::VERSION
|
29
|
+
end
|
30
|
+
|
17
31
|
def push
|
18
32
|
::Avm::Executables.docker.command.append(['push', tag]).system!
|
19
33
|
end
|
@@ -29,6 +43,30 @@ module Avm
|
|
29
43
|
run_run(instance) if container_exist?(instance)
|
30
44
|
end
|
31
45
|
|
46
|
+
def tag
|
47
|
+
r = tag_name
|
48
|
+
r += ":#{tag_version}" if tag_version.present?
|
49
|
+
r
|
50
|
+
end
|
51
|
+
|
52
|
+
def tag_name
|
53
|
+
return registry.name if registry.name.present?
|
54
|
+
|
55
|
+
raise 'Registry name is blank'
|
56
|
+
end
|
57
|
+
|
58
|
+
def tag_version
|
59
|
+
[tag_version_version, stereotype_tag].reject(&:blank?).join('_')
|
60
|
+
end
|
61
|
+
|
62
|
+
def tag_version_version
|
63
|
+
return nil unless version
|
64
|
+
|
65
|
+
r = generator_version
|
66
|
+
r += '-snapshot' if snapshot
|
67
|
+
r
|
68
|
+
end
|
69
|
+
|
32
70
|
private
|
33
71
|
|
34
72
|
attr_reader :build_dir
|
data/lib/avm/docker/runner.rb
CHANGED
@@ -25,6 +25,8 @@ module Avm
|
|
25
25
|
-B --build-arg=<build-arg> Argument for "docker build".
|
26
26
|
-E --entrypoint-arg=<run-arg> Argument for entrypoint on "docker run"
|
27
27
|
-c --clear Remove container if exist before run.
|
28
|
+
-S --no-snapshot Does not add "-snapshot" to image tag.
|
29
|
+
-V --no-version Does not add version to image tag.
|
28
30
|
DOCOPT
|
29
31
|
|
30
32
|
def run
|
@@ -38,11 +40,17 @@ module Avm
|
|
38
40
|
private
|
39
41
|
|
40
42
|
def setup
|
41
|
-
instance.
|
43
|
+
instance.docker_image_options = {
|
44
|
+
registry: registry,
|
45
|
+
snapshot: snapshot?,
|
46
|
+
version: version?
|
47
|
+
}
|
42
48
|
end
|
43
49
|
|
44
50
|
def banner
|
45
51
|
infov 'Registry name', registry
|
52
|
+
infov 'Version?', version?
|
53
|
+
infov 'Snapshot?', snapshot?
|
46
54
|
infov 'Image name', instance.docker_image.tag
|
47
55
|
infov 'Build arguments', build_args
|
48
56
|
infov 'Entrypoint arguments', entrypoint_args
|
@@ -79,6 +87,14 @@ module Avm
|
|
79
87
|
end
|
80
88
|
end
|
81
89
|
|
90
|
+
def snapshot?
|
91
|
+
!options.fetch('--no-snapshot')
|
92
|
+
end
|
93
|
+
|
94
|
+
def version?
|
95
|
+
!options.fetch('--no-version')
|
96
|
+
end
|
97
|
+
|
82
98
|
def instance
|
83
99
|
context(:instance)
|
84
100
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
3
4
|
require 'avm/docker/container'
|
4
5
|
|
5
6
|
module Avm
|
@@ -7,10 +8,10 @@ module Avm
|
|
7
8
|
class Base
|
8
9
|
module Dockerizable
|
9
10
|
enable_simple_cache
|
10
|
-
attr_reader :
|
11
|
+
attr_reader :docker_image_options
|
11
12
|
|
12
|
-
def
|
13
|
-
@
|
13
|
+
def docker_image_options=(options)
|
14
|
+
@docker_image_options = ::ActiveSupport::HashWithIndifferentAccess.new(options)
|
14
15
|
reset_cache
|
15
16
|
end
|
16
17
|
|
@@ -31,7 +32,10 @@ module Avm
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def docker_image_uncached
|
34
|
-
docker_image_class.new(
|
35
|
+
r = docker_image_class.new(docker_image_options.fetch(:registry))
|
36
|
+
r.version = docker_image_options[:version] if docker_image_options.key?(:version)
|
37
|
+
r.snapshot = docker_image_options[:snapshot] if docker_image_options.key?(:snapshot)
|
38
|
+
r
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
@@ -7,11 +7,8 @@ module Avm
|
|
7
7
|
module Stereotypes
|
8
8
|
module EacUbuntuBase0
|
9
9
|
class DockerImage < ::Avm::Docker::Image
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def tag
|
14
|
-
"#{registry.name}:eac_ubuntu_base0"
|
10
|
+
def stereotype_tag
|
11
|
+
'eac_ubuntu_base0'
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
data/lib/avm/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|