hippo-cli 1.2.0 → 1.2.4

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: f8b14eb5652ec29878ff1d7ccf48685ed7ea0d6c345587e16cd237ebcdf42609
4
- data.tar.gz: f180aef6e85fc1cb857dfef0578e2a3a14c3c5e6cc89b3808b07c7e150d8f35d
3
+ metadata.gz: '004641278dbfd92f58567a1f92eaa75b11c1c9eeac15665c199e3df28e22367e'
4
+ data.tar.gz: 47109ddab7e7fb850c7cc303351647246b1a8c1fffa6b950007a33f4967df810
5
5
  SHA512:
6
- metadata.gz: 26f0e6b8e35bcf6bdb751b00faff8be463d28c36dcff91640e67c90f2c99f9cafccd3c37ceb354170e8f654e1841d9915a06597abc48ad3477de83ada8453942
7
- data.tar.gz: be4e0bc1f4180726bee41aece0f947882f9c37006a776107b073dcc6bab0be9525a86c5750e92d119b48622e7a55e91c7713422c4f0def824f9dd8424396025c
6
+ metadata.gz: 16734fb7e2bfbc8757c15f6b99675506efe9f64810cfc31a676d694a6206e0ed89a4bde0dc3d8ee93417bb9bfc706225371ef2785fe4f0f25d97e4d3bf15d422
7
+ data.tar.gz: feffdb308806ec55694a0ede2ff980f674d73daa0ee9c2ebba55e87b6c2c34ff54815e82019c8defbeac15e9e4dc1ab945cb927118d6f23289e96c192db7363b
data/cli/exec.rb ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ command :exec do
4
+ desc 'Exec a command on a given pod'
5
+
6
+ action do |context|
7
+ require 'hippo/cli'
8
+ cli = Hippo::CLI.setup(context)
9
+ cli.preflight
10
+
11
+ command = context.args[2]
12
+ if command.nil?
13
+ raise Error, 'Must specify command alias as first argument after `exec`'
14
+ end
15
+
16
+ command = cli.stage.command(command)
17
+ raise Error, "Invalid command alias `#{context.args[2]}`" if command.nil?
18
+
19
+ command_to_run = ([command[:command]] + context.args[3..-1]).join(' ')
20
+
21
+ exec cli.stage.kubectl("exec -it #{command[:target]} -- #{command_to_run}").join(' ')
22
+ end
23
+ end
data/cli/run.rb CHANGED
@@ -12,7 +12,7 @@ command :run do
12
12
  cli = Hippo::CLI.setup(context)
13
13
  cli.preflight
14
14
 
15
- image = cli.stage.images.values.first
15
+ image = cli.stage.images[context.options[:image]] || cli.stage.images.values.first
16
16
  raise Error, "No image exists at #{image.image_url}" unless image.exists?
17
17
 
18
18
  command = context.options[:command] || '/bin/bash'
data/cli/setup.rb CHANGED
@@ -52,7 +52,7 @@ command :setup do
52
52
 
53
53
  require 'yaml'
54
54
  config = { 'source' => source }
55
- File.open(File.join(path, 'hippo.yaml'), 'w') { |f| f.write(config.to_yaml) }
55
+ File.open(File.join(path, 'manifest.yaml'), 'w') { |f| f.write(config.to_yaml) }
56
56
  puts "Created configuration directory at #{path}"
57
57
 
58
58
  require 'hippo/working_directory'
@@ -36,6 +36,10 @@ module Hippo
36
36
  @options['console']
37
37
  end
38
38
 
39
+ def commands
40
+ @options['commands'] || {}
41
+ end
42
+
39
43
  def config
40
44
  @options['config'] || {}
41
45
  end
data/lib/hippo/package.rb CHANGED
@@ -26,6 +26,13 @@ module Hippo
26
26
  @options['package']
27
27
  end
28
28
 
29
+ # Return the version of the chart to be used
30
+ #
31
+ # @return [String]
32
+ def chart_version
33
+ @options['chart_version']
34
+ end
35
+
29
36
  # return values defined in the package's manifest file
30
37
  #
31
38
  # @return [Hash]
@@ -89,6 +96,9 @@ module Hippo
89
96
  private
90
97
 
91
98
  def install_command(verb, *additional)
99
+ if chart_version
100
+ additional = ['--version', chart_version] + additional
101
+ end
92
102
  helm(verb, name, package, '-f', '-', *additional)
93
103
  end
94
104
 
@@ -98,6 +108,7 @@ module Hippo
98
108
  end
99
109
 
100
110
  def run(command, stdin: nil)
111
+ puts command
101
112
  stdout, stderr, status = Open3.capture3(*command, stdin_data: stdin)
102
113
  raise Error, "[helm] #{stderr}" unless status.success?
103
114
 
@@ -25,7 +25,7 @@ module Hippo
25
25
  def download_key
26
26
  return if @key
27
27
 
28
- Util.action 'Downloading secret encryiption key...' do |state|
28
+ Util.action 'Downloading secret encryption key...' do |state|
29
29
  begin
30
30
  value = @stage.get('secret', 'hippo-secret-key').first
31
31
 
data/lib/hippo/stage.rb CHANGED
@@ -45,6 +45,16 @@ module Hippo
45
45
  @options['config']
46
46
  end
47
47
 
48
+ def command(name)
49
+ base = manifest.commands[name]
50
+ return nil if base.nil?
51
+
52
+ {
53
+ target: base['target'],
54
+ command: decorator.call(base['command'])
55
+ }
56
+ end
57
+
48
58
  def images
49
59
  @images ||= manifest.images.deep_merge(@options['images'] || {}).each_with_object({}) do |(key, image), hash|
50
60
  hash[key] = Image.new(key, image)
@@ -238,7 +248,6 @@ module Hippo
238
248
  Util.parse_kubectl_apply_lines(stdout)
239
249
  true
240
250
  else
241
- stderr = stderr.read
242
251
  if stderr =~ /\" not found$/
243
252
  false
244
253
  else
data/lib/hippo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hippo
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.4'
5
5
  end
@@ -168,7 +168,7 @@ module Hippo
168
168
  #
169
169
  # @return [Hash<Symbol, Hippo::Stage>]
170
170
  def stages
171
- objects = Util.load_objects_from_path(File.join(@root, '**', 'config.{yml,yaml}'))
171
+ objects = Util.load_objects_from_path(File.join(@root, '*', 'config.{yml,yaml}'))
172
172
  objects.each_with_object({}) do |(path, objects), hash|
173
173
  objects.each do |obj|
174
174
  stage = Stage.new(self, File.dirname(path), obj)
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hippo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
-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lEDBuPhLrDIdDJklg9bD1E2TUvoMrg
29
- L6TIbdP1TRrxINO1D9GzboR+OuWos7qMLBEEbjat/fQchYrW1KLcHIUCyrGkZTLm
30
- 3wUJNGnT5XYq+qvTqmjkTSTfdGvZCM63C6bGdN5CAyMokGOOatGqyCMAONolWnfC
31
- gm3t2GWWrxY=
32
- -----END CERTIFICATE-----
33
- date: 2020-02-17 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2021-08-10 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: encryptor
@@ -143,9 +121,9 @@ files:
143
121
  - bin/hippo
144
122
  - cli/apply_config.rb
145
123
  - cli/apply_services.rb
146
- - cli/console.rb
147
124
  - cli/create.rb
148
125
  - cli/deploy.rb
126
+ - cli/exec.rb
149
127
  - cli/help.rb
150
128
  - cli/init.rb
151
129
  - cli/install.rb
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- F�I~|�}�����r�pc#��[ټ������s#��쒹���F�N�8��E��W$�<-���yZ����ò�}�s>"�H�V°�(R����(��� r��B{�$��:y
2
- ��b��B�?��9�W��/�;���1s���t��A���[���[��eq���N��<2�XxVP!w?0o0#K�6K�/ܾ�ڊ�E@�&�C����8� �Η�\��T��m�� �5<�&P��Ad�p
3
- t���,
data/cli/console.rb DELETED
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- command :console do
4
- desc 'Open a console based on the configuration'
5
-
6
- option '-d', '--deployment [NAME]', 'The name of the deployment to use' do |value, options|
7
- options[:deployment] = value.to_s
8
- end
9
-
10
- option '-c', '--command [NAME]', 'The command to run' do |value, options|
11
- options[:command] = value.to_s
12
- end
13
-
14
- action do |context|
15
- require 'hippo/cli'
16
- cli = Hippo::CLI.setup(context)
17
-
18
- if cli.manifest.console.nil?
19
- raise Error, 'No console configuration has been provided in Hippofile'
20
- end
21
-
22
- cli.preflight
23
-
24
- time = Time.now.to_i
25
- deployment_name = context.options[:deployment] || cli.manifest.console['deployment']
26
- command = context.options[:command] || cli.manifest.console['command'] || 'bash'
27
- exec cli.stage.kubectl("exec -it deployment/#{deployment_name} -- #{command}").join(' ')
28
- end
29
- end
metadata.gz.sig DELETED
Binary file