kuber_kit 0.3.9 → 0.3.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8321dfb87de00ef987aa2c826e5310fd721664135b90e194562a9c9f26ad044e
4
- data.tar.gz: dccbfdc6df8ed8bedd6e6d30ddfd576c42c1a12ec36aa465769a1fcc207d38af
3
+ metadata.gz: ed4a9c2ac89b73ddd0b9d7c0c95845318c46e6389869f4b3a876af67b2d122f6
4
+ data.tar.gz: 5fb51bb82cc685ee370e880c255ec87e957f5b75c929baf256188582e63fb13f
5
5
  SHA512:
6
- metadata.gz: cde945512a525f1ef577f540ae3919bc602d442fb44eb14505fe2a4761ad1c15061f9bab1540b9b8de2592cf4d4f4f7396bfe451499af45cd6198659ad7cfaeb
7
- data.tar.gz: cca667290f77ff94934ce302666655d1bdefc414f074915c8a6d091590786b20ff2aa26a04c02f9d07b5e3c88f2e48439c3cbe71add7d374ea255deda753e125
6
+ metadata.gz: df0ceafb8c37a8c216f08eb5c8692fcc6eb2f909bbcc929beb9725fdaea0a73976b5a462d5904361e20c01b121dd5efa16185c6e8f388fe01a9ae7b2c55531f8
7
+ data.tar.gz: 56a8bdf92b31851078a50c679fc1680adb8f598d3a33ca0010de4789e338a7047a3a34e030cbc186f6b59da7899f64291eec44c34eb18c520e1cc04019414958
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Rspec
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.7']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rspec spec/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kuber_kit (0.3.9)
4
+ kuber_kit (0.3.10)
5
5
  cli-ui
6
6
  contracts-lite
7
7
  dry-auto_inject
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # KuberKit
2
2
 
3
- [![Codeship Status for ArtStation/kuber_kit](https://app.codeship.com/projects/1286f0a6-3f90-4c1b-b426-721ed8a6571b/status?branch=master)](https://app.codeship.com/projects/417264)
3
+ [![Rspec](https://github.com/ArtStation/kuber_kit/workflows/Rspec/badge.svg)](https://github.com/ArtStation/kuber_kit/actions?query=workflow%3ARspec)
4
4
 
5
5
  Solution for building & deploying applications on Kubernetes, written in Ruby.
6
6
 
@@ -1,6 +1,4 @@
1
1
  class KuberKit::Actions::ConfigurationLoader
2
- APP_CONFIG_FILENAME = "config.rb".freeze
3
-
4
2
  include KuberKit::Import[
5
3
  "core.registry_store",
6
4
  "core.image_store",
@@ -16,13 +14,6 @@ class KuberKit::Actions::ConfigurationLoader
16
14
  Contract Hash => Any
17
15
  def call(options)
18
16
  root_path = options[:path] || File.join(Dir.pwd, configs.kuber_kit_dirname)
19
-
20
- # require config file first, in case if other dirs are overriden in config
21
- config_file_path = File.join(root_path, APP_CONFIG_FILENAME)
22
- if File.exists?(config_file_path)
23
- require config_file_path
24
- end
25
-
26
17
  images_path = options[:images_path] || File.join(root_path, configs.images_dirname)
27
18
  services_path = options[:services_path] || File.join(root_path, configs.services_dirname)
28
19
  infra_path = options[:infra_path] || File.join(root_path, configs.infra_dirname)
@@ -37,6 +28,8 @@ class KuberKit::Actions::ConfigurationLoader
37
28
  logger.info " Configurations path: #{configurations_path.to_s.yellow}"
38
29
  logger.info " Configuration name: #{configuration_name.to_s.yellow}"
39
30
 
31
+ ui.print_info("Logs", "See logs at: #{configs.log_file_path}")
32
+
40
33
  unless File.exists?(root_path)
41
34
  ui.print_warning "WARNING", "KuberKit root path #{root_path} doesn't exist. You may want to pass it --path parameter."
42
35
  end
@@ -1,6 +1,8 @@
1
1
  require 'thor'
2
2
 
3
3
  class KuberKit::CLI < Thor
4
+ APP_CONFIG_FILENAME = "config.rb".freeze
5
+
4
6
  class_option :path, :type => :string
5
7
  class_option :images_path, :type => :string
6
8
  class_option :infra_path, :type => :string
@@ -10,7 +12,7 @@ class KuberKit::CLI < Thor
10
12
 
11
13
  desc "compile IMAGE_NAMES", "Compile image with IMAGE_NAMES (comma-separated)"
12
14
  def compile(image_names_str)
13
- KuberKit.set_debug_mode(options[:debug])
15
+ setup(options)
14
16
 
15
17
  image_names = image_names_str.split(",").map(&:strip).map(&:to_sym)
16
18
 
@@ -35,7 +37,7 @@ class KuberKit::CLI < Thor
35
37
  method_option :tags, :type => :array, aliases: ["-t"]
36
38
  method_option :skip_compile, :type => :boolean, aliases: ["-B"]
37
39
  def deploy
38
- KuberKit.set_debug_mode(options[:debug])
40
+ setup(options)
39
41
 
40
42
  if KuberKit::Container['actions.configuration_loader'].call(options)
41
43
  result = KuberKit::Container['actions.service_deployer'].call(
@@ -59,7 +61,7 @@ class KuberKit::CLI < Thor
59
61
 
60
62
  desc "env ENV_FILE_NAME", "Return content of Env File ENV_FILE_NAME"
61
63
  def env(env_file_name)
62
- KuberKit.set_debug_mode(options[:debug])
64
+ setup(options)
63
65
 
64
66
  if KuberKit::Container['actions.configuration_loader'].call(options)
65
67
  KuberKit::Container['actions.env_file_reader'].call(env_file_name.to_sym, options)
@@ -68,7 +70,7 @@ class KuberKit::CLI < Thor
68
70
 
69
71
  desc "template TEMPLATE_NAME", "Return content of Template TEMPLATE_NAME"
70
72
  def template(template_name)
71
- KuberKit.set_debug_mode(options[:debug])
73
+ setup(options)
72
74
 
73
75
  if KuberKit::Container['actions.configuration_loader'].call(options)
74
76
  KuberKit::Container['actions.template_reader'].call(template_name.to_sym, options)
@@ -77,7 +79,7 @@ class KuberKit::CLI < Thor
77
79
 
78
80
  desc "service SERVICE_NAME", "Return content of Service SERVICE_NAME"
79
81
  def service(service_name)
80
- KuberKit.set_debug_mode(options[:debug])
82
+ setup(options)
81
83
 
82
84
  if KuberKit::Container['actions.configuration_loader'].call(options)
83
85
  KuberKit::Container['actions.service_reader'].call(service_name.to_sym, options)
@@ -86,7 +88,7 @@ class KuberKit::CLI < Thor
86
88
 
87
89
  desc "apply FILE_PATH", "Apply FILE_PATH with kubectl"
88
90
  def apply(file_path)
89
- KuberKit.set_debug_mode(options[:debug])
91
+ setup(options)
90
92
 
91
93
  if KuberKit::Container['actions.configuration_loader'].call(options)
92
94
  KuberKit::Container['actions.kubectl_applier'].call(File.expand_path(file_path), options)
@@ -95,26 +97,26 @@ class KuberKit::CLI < Thor
95
97
 
96
98
  desc "attach POD_NAME", "Attach to POD_NAME using kubectl"
97
99
  def attach(pod_name = nil)
98
- KuberKit.set_debug_mode(options[:debug])
100
+ setup(options)
99
101
 
100
102
  if KuberKit::Container['actions.configuration_loader'].call(options)
101
103
  KuberKit::Container['actions.kubectl_attacher'].call(pod_name, options)
102
104
  end
103
105
  end
104
106
 
105
- desc "launch console in POD_NAME", "Attach to POD_NAME using kubectl & launch bin/console"
107
+ desc "console POD_NAME", "Attach to POD_NAME using kubectl & launch bin/console"
106
108
  def console(pod_name = nil)
107
- KuberKit.set_debug_mode(options[:debug])
109
+ setup(options)
108
110
 
109
111
  if KuberKit::Container['actions.configuration_loader'].call(options)
110
112
  KuberKit::Container['actions.kubectl_console'].call(pod_name, options)
111
113
  end
112
114
  end
113
115
 
114
- desc "show logs for POD_NAME", "Show logs for POD_NAME using kubectl"
116
+ desc "logs POD_NAME", "Show logs for POD_NAME using kubectl"
115
117
  method_option :follow, :type => :boolean, aliases: ["-f"]
116
118
  def logs(pod_name = nil)
117
- KuberKit.set_debug_mode(options[:debug])
119
+ setup(options)
118
120
 
119
121
  if KuberKit::Container['actions.configuration_loader'].call(options)
120
122
  KuberKit::Container['actions.kubectl_logs'].call(pod_name, options)
@@ -129,4 +131,16 @@ class KuberKit::CLI < Thor
129
131
  def self.exit_on_failure?
130
132
  true
131
133
  end
134
+
135
+ private
136
+ def setup(options)
137
+ KuberKit.set_debug_mode(options[:debug])
138
+
139
+ # We should load config before loading any bean, to make sure that bean won't be built with default config
140
+ root_path = options[:path] || File.join(Dir.pwd, KuberKit::Container['configs'].kuber_kit_dirname)
141
+ config_file_path = File.join(root_path, APP_CONFIG_FILENAME)
142
+ if File.exists?(config_file_path)
143
+ require config_file_path
144
+ end
145
+ end
132
146
  end
@@ -37,6 +37,11 @@ class KuberKit::ServiceDeployer::Strategies::Docker < KuberKit::ServiceDeployer:
37
37
  docker_commands.delete_container(shell, container_name)
38
38
  end
39
39
 
40
+ command_args = Array(command_args)
41
+ if container_name
42
+ command_args << "-n #{container_name}"
43
+ end
44
+
40
45
  docker_commands.run(
41
46
  shell, image.remote_registry_url,
42
47
  command: command_name,
@@ -18,7 +18,7 @@ class KuberKit::Shell::Commands::DockerCommands
18
18
  command_parts = []
19
19
  command_parts << "docker run"
20
20
  command_parts << "-d" if detached
21
- command_parts << args if args
21
+ command_parts << Array(args).join(" ") if args
22
22
  command_parts << image_name
23
23
  command_parts << command if command
24
24
 
@@ -8,7 +8,7 @@ class KuberKit::Shell::Commands::DockerComposeCommands
8
8
 
9
9
 
10
10
  command_parts << "-d" if detached
11
- command_parts << args if args
11
+ command_parts << Array(args).join(" ") if args
12
12
  command_parts << service
13
13
  command_parts << command if command
14
14
 
@@ -76,7 +76,7 @@ class KuberKit::Shell::LocalShell < KuberKit::Shell::AbstractShell
76
76
 
77
77
  def recursive_list_files(path, name: nil)
78
78
  command = %Q{find -L #{path} -type f}
79
- command += " -name #{name}" if name
79
+ command += " -name '#{name}'" if name
80
80
  exec!(command).split(/[\r\n]+/)
81
81
  rescue => e
82
82
  if e.message.include?("No such file or directory")
@@ -1,3 +1,3 @@
1
1
  module KuberKit
2
- VERSION = "0.3.9"
2
+ VERSION = "0.3.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuber_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Khaziev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-08 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contracts-lite
@@ -145,6 +145,7 @@ executables:
145
145
  extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
+ - ".github/workflows/rspec.yml"
148
149
  - ".gitignore"
149
150
  - ".rspec"
150
151
  - ".ruby-gemset"
@@ -293,7 +294,7 @@ homepage: https://github.com/ArtStation/kuber_kit
293
294
  licenses:
294
295
  - MIT
295
296
  metadata: {}
296
- post_install_message:
297
+ post_install_message:
297
298
  rdoc_options: []
298
299
  require_paths:
299
300
  - lib
@@ -308,8 +309,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
309
  - !ruby/object:Gem::Version
309
310
  version: '0'
310
311
  requirements: []
311
- rubygems_version: 3.0.8
312
- signing_key:
312
+ rubygems_version: 3.0.9
313
+ signing_key:
313
314
  specification_version: 4
314
315
  summary: Docker Containers Build & Deployment
315
316
  test_files: []