kuby-core 0.11.14 → 0.11.15

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: bfd902325b0bf78437ea91ba6021ee0cc27f83c67d60a703508a8b0c5a84bc86
4
- data.tar.gz: 9598df94486a386235a3566c4c0422f824c30870551251ce3f4836fc94677b39
3
+ metadata.gz: '03278595cc2f5eb23fcfb47a15fd8fea9aaf06546e3c9d92a71080953c3d10db'
4
+ data.tar.gz: 893a184f166b3bb453f96ef3529fbf65f8fef171f54a7268661645aa30834e99
5
5
  SHA512:
6
- metadata.gz: 2ba1c29f18311795a39c8038940c6bc53ae6868523d520af81a52543ee6726282696f07af78b2cd8d6736ce5d0e7bc98ffd14f61693cf0b7421b7cccbbe6ea70
7
- data.tar.gz: 801f401ba743d5375e59c33e1be57b6ae7767d5580e37bef0186dd2e299e7293f1a9e2e277a10b43b94977e0f982be8908e57153fb14d136a9e54aea92031fdf
6
+ metadata.gz: 0d0868b638c06e13db7b4353af14c6fa1d82bc143239cac4322ba3be4f723eca1a3a70c8e271ec5091afea24d088acd2b744e6b7af3347ceeddfff63eabbb285
7
+ data.tar.gz: f1a859ddf32f023f9c593345a50f9d11e998287ff05030117cf599920ed2c5b53ed8b54804080f7271be7b47ef9d7cfee8cfee168bf972226ec3e889e35dde60
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.11.15
2
+ * Copy over .npmrc and .yarnrc before running yarn install.
3
+
1
4
  ## 0.11.14
2
5
  * Don't include port in image host for registry secrets (no idea why)
3
6
 
data/Gemfile CHANGED
@@ -5,7 +5,8 @@ gemspec
5
5
  group :development, :test do
6
6
  gem 'pry-byebug'
7
7
  gem 'rake'
8
- gem 'sorbet', '~> 0.5'
8
+ # lock to a specific version to prevent breaking CI when new versions come out
9
+ gem 'sorbet', '= 0.5.6397'
9
10
  end
10
11
 
11
12
  group :test do
data/bin/kuby CHANGED
@@ -1,4 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
+ $stdout.sync = true
4
+
3
5
  require 'kuby'
4
6
  exit Kuby::Commands.run(ARGV)
data/kuby-core.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), 'lib')
1
+ $:.unshift File.expand_path('lib', __dir__)
2
2
  require 'kuby/version'
3
3
 
4
4
  Gem::Specification.new do |s|
data/lib/kuby.rb CHANGED
@@ -153,6 +153,7 @@ end
153
153
 
154
154
  # providers
155
155
  Kuby.register_provider(:docker_desktop, Kuby::Kubernetes::DockerDesktopProvider)
156
+ Kuby.register_provider(:bare_metal, Kuby::Kubernetes::BareMetalProvider)
156
157
 
157
158
  # plugins
158
159
  Kuby.register_plugin(:rails_app, Kuby::Plugins::RailsApp::Plugin)
@@ -52,7 +52,7 @@ module Kuby
52
52
  block: T.nilable(T.proc.returns(T.untyped))
53
53
  ).void
54
54
  }
55
- def fatal(progname_or_msg, &block)
55
+ def fatal(progname_or_msg = nil, &block)
56
56
  if block
57
57
  super(progname_or_msg) { ColorizedString[block.call].red }
58
58
  else
data/lib/kuby/cli_base.rb CHANGED
@@ -7,21 +7,26 @@ module Kuby
7
7
  class CLIBase
8
8
  extend T::Sig
9
9
 
10
+ BeforeCallback = T.type_alias { T.proc.params(cmd: T::Array[String]).void }
11
+ AfterCallback = T.type_alias do
12
+ T.proc.params(cmd: T::Array[String], last_status: T.nilable(Process::Status)).void
13
+ end
14
+
10
15
  sig { returns(T.nilable(Process::Status)) }
11
16
  def last_status
12
17
  Thread.current[status_key]
13
18
  end
14
19
 
15
- sig { params(block: T.proc.params(cmd: String).void).void }
20
+ sig { params(block: BeforeCallback).void }
16
21
  def before_execute(&block)
17
- @before_execute = T.let(@before_execute, T.nilable(T::Array[T.proc.params(cmd: String).void]))
22
+ @before_execute = T.let(@before_execute, T.nilable(T::Array[BeforeCallback]))
18
23
  @before_execute ||= []
19
24
  @before_execute << block
20
25
  end
21
26
 
22
- sig { params(block: T.proc.params(cmd: String).void).void }
27
+ sig { params(block: AfterCallback).void }
23
28
  def after_execute(&block)
24
- @after_execute = T.let(@after_execute, T.nilable(T::Array[T.proc.params(cmd: String).void]))
29
+ @after_execute = T.let(@after_execute, T.nilable(T::Array[AfterCallback]))
25
30
  @after_execute ||= []
26
31
  @after_execute << block
27
32
  end
@@ -51,10 +51,6 @@ module Kuby
51
51
  dockerfile.copy(gf, '.')
52
52
  dockerfile.copy(lf, '.')
53
53
 
54
- # set bundle path so docker will cache the bundle
55
- dockerfile.run('mkdir', './bundle')
56
- dockerfile.env('BUNDLE_PATH=./bundle')
57
-
58
54
  unless wo.empty?
59
55
  dockerfile.env("BUNDLE_WITHOUT='#{wo.join(' ')}'")
60
56
  end
@@ -8,7 +8,10 @@ module Kuby
8
8
  sig { params(dockerfile: Dockerfile).void }
9
9
  def apply_to(dockerfile)
10
10
  dockerfile.copy('package.json', '.')
11
- dockerfile.copy('yarn.lock*', '.')
11
+ # use character classes as a hack to only copy the files if they exist
12
+ dockerfile.copy('yarn.loc[k]', '.')
13
+ dockerfile.copy('.npmr[c]', '.')
14
+ dockerfile.copy('.yarnr[c]', '.')
12
15
  dockerfile.run('yarn', 'install')
13
16
  end
14
17
  end
@@ -3,6 +3,7 @@ require 'kuby/kubernetes/errors'
3
3
 
4
4
  module Kuby
5
5
  module Kubernetes
6
+ autoload :BareMetalProvider, 'kuby/kubernetes/bare_metal_provider'
6
7
  autoload :Deployer, 'kuby/kubernetes/deployer'
7
8
  autoload :DeployTask, 'kuby/kubernetes/deploy_task'
8
9
  autoload :DockerConfig, 'kuby/kubernetes/docker_config'
@@ -0,0 +1,41 @@
1
+ # typed: false
2
+ require 'kube-dsl'
3
+
4
+ module Kuby
5
+ module Kubernetes
6
+ class BareMetalProvider < Provider
7
+ STORAGE_CLASS_NAME = 'hostpath'.freeze
8
+
9
+ class Config
10
+ extend ::KubeDSL::ValueFields
11
+
12
+ value_fields :kubeconfig
13
+ end
14
+
15
+ attr_reader :config
16
+
17
+ def configure(&block)
18
+ config.instance_eval(&block) if block
19
+ end
20
+
21
+ def kubeconfig_path
22
+ config.kubeconfig
23
+ end
24
+
25
+ def storage_class_name
26
+ STORAGE_CLASS_NAME
27
+ end
28
+
29
+ private
30
+
31
+ def after_initialize
32
+ @config = Config.new
33
+
34
+ configure do
35
+ # default kubeconfig path
36
+ kubeconfig File.join(ENV['HOME'], '.kube', 'config')
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'fileutils'
4
4
  require 'securerandom'
5
+ require 'tmpdir'
5
6
  require 'yaml'
6
7
 
7
8
  module Kuby
@@ -380,11 +380,35 @@ module Kuby
380
380
  init_container(:create_db) do
381
381
  name "#{kube_spec.selector_app}-create-db"
382
382
  command %w(bundle exec rake kuby:rails_app:db:create_unless_exists)
383
+
384
+ env_from do
385
+ config_map_ref do
386
+ name kube_spec.config_map.metadata.name
387
+ end
388
+ end
389
+
390
+ env_from do
391
+ secret_ref do
392
+ name kube_spec.app_secrets.metadata.name
393
+ end
394
+ end
383
395
  end
384
396
 
385
397
  init_container(:migrate_db) do
386
398
  name "#{kube_spec.selector_app}-migrate-db"
387
399
  command %w(bundle exec rake db:migrate)
400
+
401
+ env_from do
402
+ config_map_ref do
403
+ name kube_spec.config_map.metadata.name
404
+ end
405
+ end
406
+
407
+ env_from do
408
+ secret_ref do
409
+ name kube_spec.app_secrets.metadata.name
410
+ end
411
+ end
388
412
  end
389
413
 
390
414
  image_pull_secret do
data/lib/kuby/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # typed: true
2
2
 
3
3
  module Kuby
4
- VERSION = '0.11.14'.freeze
4
+ VERSION = '0.11.15'.freeze
5
5
  end
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.11.14
4
+ version: 0.11.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-27 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -255,6 +255,7 @@ files:
255
255
  - lib/kuby/docker/yarn_phase.rb
256
256
  - lib/kuby/environment.rb
257
257
  - lib/kuby/kubernetes.rb
258
+ - lib/kuby/kubernetes/bare_metal_provider.rb
258
259
  - lib/kuby/kubernetes/deploy_task.rb
259
260
  - lib/kuby/kubernetes/deployer.rb
260
261
  - lib/kuby/kubernetes/docker_config.rb