kuby-core 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/kuby/commands.rb +8 -3
- data/lib/kuby/docker/bundler_phase.rb +9 -2
- data/lib/kuby/plugins/rails_app/assets_image.rb +4 -0
- data/lib/kuby/tasks.rb +39 -3
- data/lib/kuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bb1eba2c179a03610f3f478f595c43638e692b41ebad53c7d6292ef5699000a
|
4
|
+
data.tar.gz: b9003940ecba163e1f9c08100223d6059920f7f9a2d8ebff0c038e1fd5f335ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fad183f5c697c6f6a06da8984dff19e0feac91b1996ae79a6605cafb612c77590461f80807ac87854124a97eef31e2999b39a64f997ef4f0fc77564365d81602
|
7
|
+
data.tar.gz: 1df3f9153d1595d085511329a5c1110117fa626632438a635f162c38cbe9c48d53df3098b28300408b89021365298b9972d07bdb9abd17b01bbc236e711ed3b8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.16.0
|
2
|
+
* Allow Bundler executable to be customized.
|
3
|
+
- Main use-case is to allow adding in the Prebundler plugin, https://github.com/getkuby/kuby-prebundler.
|
4
|
+
* Print error message and exit on missing Docker build args.
|
5
|
+
- Ignore with `--ignore-missing-args`.
|
6
|
+
|
1
7
|
## 0.15.0
|
2
8
|
* Add an extra parameter to the Docker spec for specifying the URL of the Docker registry index.
|
3
9
|
- In most cases, the registry and registry index URLs will be the same. However Docker Hub, the default registry, uses index.docker.io for API requests (catalog, tags, etc) but only allows pushes to docker.io.
|
data/lib/kuby/commands.rb
CHANGED
@@ -65,6 +65,7 @@ module Kuby
|
|
65
65
|
desc 'Builds the Docker image.'
|
66
66
|
command :build do |c|
|
67
67
|
c.flag [:a, :arg], required: false, multiple: true
|
68
|
+
c.switch [:'ignore-missing-args'], required: false, default: false
|
68
69
|
c.flag [:only], required: false
|
69
70
|
c.action do |global_options, options, docker_args|
|
70
71
|
build_args = {}.tap do |build_args|
|
@@ -75,7 +76,11 @@ module Kuby
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
|
-
tasks.build(
|
79
|
+
tasks.build(
|
80
|
+
build_args, docker_args,
|
81
|
+
only: options[:only],
|
82
|
+
ignore_missing_args: options[:'ignore-missing-args']
|
83
|
+
)
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
@@ -83,7 +88,7 @@ module Kuby
|
|
83
88
|
command :push do |c|
|
84
89
|
c.flag [:only], required: false
|
85
90
|
c.action do |global_options, options, args|
|
86
|
-
tasks.push(options[:only])
|
91
|
+
tasks.push(only: options[:only])
|
87
92
|
end
|
88
93
|
end
|
89
94
|
|
@@ -98,7 +103,7 @@ module Kuby
|
|
98
103
|
command :dockerfiles do |c|
|
99
104
|
c.flag [:only], required: false
|
100
105
|
c.action do |global_options, options, args|
|
101
|
-
tasks.print_dockerfiles(options[:only])
|
106
|
+
tasks.print_dockerfiles(only: options[:only])
|
102
107
|
end
|
103
108
|
end
|
104
109
|
|
@@ -29,6 +29,12 @@ module Kuby
|
|
29
29
|
sig { params(without: T::Array[String]).void }
|
30
30
|
attr_writer :without
|
31
31
|
|
32
|
+
sig { returns(T.nilable(String)) }
|
33
|
+
attr_reader :executable
|
34
|
+
|
35
|
+
sig { params(executable: String).void }
|
36
|
+
attr_writer :executable
|
37
|
+
|
32
38
|
sig { params(environment: Environment).void }
|
33
39
|
def initialize(environment)
|
34
40
|
super
|
@@ -37,6 +43,7 @@ module Kuby
|
|
37
43
|
@gemfile = T.let(@gemfile, T.nilable(String))
|
38
44
|
@gemfiles = T.let([], T::Array[String])
|
39
45
|
@without = T.let(@without, T.nilable(T::Array[String]))
|
46
|
+
@executable = T.let(@executable, T.nilable(String))
|
40
47
|
end
|
41
48
|
|
42
49
|
sig { override.params(dockerfile: Dockerfile).void }
|
@@ -61,14 +68,14 @@ module Kuby
|
|
61
68
|
end
|
62
69
|
|
63
70
|
dockerfile.run(
|
64
|
-
'bundle', 'install',
|
71
|
+
executable || 'bundle', 'install',
|
65
72
|
'--jobs', '$(nproc)',
|
66
73
|
'--retry', '3',
|
67
74
|
'--gemfile', gf
|
68
75
|
)
|
69
76
|
|
70
77
|
# generate binstubs and add the bin directory to our path
|
71
|
-
dockerfile.run('bundle', 'binstubs', '--all')
|
78
|
+
dockerfile.run(executable || 'bundle', 'binstubs', '--all')
|
72
79
|
dockerfile.env("PATH=./bin:$PATH")
|
73
80
|
end
|
74
81
|
|
@@ -29,6 +29,10 @@ module Kuby
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def build(build_args = {}, docker_args = [])
|
32
|
+
unless ENV.fetch('RAILS_MASTER_KEY', '').empty?
|
33
|
+
build_args['RAILS_MASTER_KEY'] = ENV['RAILS_MASTER_KEY']
|
34
|
+
end
|
35
|
+
|
32
36
|
docker_cli.build(current_version, build_args: build_args, docker_args: docker_args)
|
33
37
|
end
|
34
38
|
|
data/lib/kuby/tasks.rb
CHANGED
@@ -9,7 +9,7 @@ module Kuby
|
|
9
9
|
@environment = environment
|
10
10
|
end
|
11
11
|
|
12
|
-
def print_dockerfiles(only
|
12
|
+
def print_dockerfiles(only: nil)
|
13
13
|
kubernetes.docker_images.each do |image|
|
14
14
|
next if only && image.identifier != only
|
15
15
|
|
@@ -28,8 +28,9 @@ module Kuby
|
|
28
28
|
environment.kubernetes.setup
|
29
29
|
end
|
30
30
|
|
31
|
-
def build(build_args = {}, docker_args = [], only
|
31
|
+
def build(build_args = {}, docker_args = [], only: nil, ignore_missing_args: false)
|
32
32
|
check_platform(docker_args)
|
33
|
+
check_build_args(build_args) unless ignore_missing_args
|
33
34
|
|
34
35
|
kubernetes.docker_images.each do |image|
|
35
36
|
next if only && image.identifier != only
|
@@ -42,7 +43,7 @@ module Kuby
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
def push(only
|
46
|
+
def push(only: nil)
|
46
47
|
kubernetes.docker_images.each do |image|
|
47
48
|
next if only && image.identifier != only
|
48
49
|
|
@@ -159,6 +160,41 @@ module Kuby
|
|
159
160
|
end
|
160
161
|
end
|
161
162
|
|
163
|
+
def check_build_args(build_args)
|
164
|
+
required_args = kubernetes.docker_images.flat_map do |image|
|
165
|
+
image.dockerfile.commands.flat_map do |command|
|
166
|
+
case command
|
167
|
+
when Kuby::Docker::Dockerfile::Arg
|
168
|
+
command.args
|
169
|
+
else
|
170
|
+
[]
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
required_args.uniq!
|
176
|
+
|
177
|
+
if File.exist?(File.join('config', 'master.key'))
|
178
|
+
required_args.delete('RAILS_MASTER_KEY')
|
179
|
+
end
|
180
|
+
|
181
|
+
missing_args = required_args - build_args.keys
|
182
|
+
|
183
|
+
if missing_args.any?
|
184
|
+
Kuby.logger.fatal(<<~END)
|
185
|
+
The following Docker build arguments are missing: #{missing_args.join(', ')}.
|
186
|
+
Please pass each argument to `kuby build` using the -a or --arg parameter (note
|
187
|
+
that the -a/--arg parameter can be specified multiple times). For example:
|
188
|
+
|
189
|
+
kuby build -a #{missing_args.first}=value ...
|
190
|
+
|
191
|
+
To ignore missing build args, pass the --ignore-missing-args parameter.
|
192
|
+
END
|
193
|
+
|
194
|
+
exit 1
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
162
198
|
def perform_docker_login_if_necessary(image)
|
163
199
|
auth_uris = image.docker_cli.auths.map do |url|
|
164
200
|
Kuby::Docker::DockerURI.parse_uri(url)
|
data/lib/kuby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|