uffizzi-cli 2.1.2 → 2.1.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 +4 -4
- data/lib/uffizzi/auth_helper.rb +16 -4
- data/lib/uffizzi/cli/account.rb +1 -1
- data/lib/uffizzi/cli/cluster.rb +16 -13
- data/lib/uffizzi/cli/dev.rb +10 -11
- data/lib/uffizzi/cli/preview/service.rb +2 -5
- data/lib/uffizzi/cli/preview.rb +1 -3
- data/lib/uffizzi/cli/project/compose.rb +1 -3
- data/lib/uffizzi/cli/project.rb +1 -1
- data/lib/uffizzi/version.rb +1 -1
- data/man/uffizzi-cluster-create.ronn +10 -1
- data/man/uffizzi-dev-start.ronn +5 -4
- metadata +2 -3
- data/lib/uffizzi/services/command_service.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2cd0af3bb51a08a6c011cf4271fc886586fbb262af3419aeaa02c32aa97dc29d
|
|
4
|
+
data.tar.gz: 3f588da373233552310f0490d8e0384acdd2cce6598cb3e2dc3d8435ebda2eab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d821267fb032b76f69cf03a2d0e08318e46b87fc8ac2084550a293dbd18591b16c10a48abf5efd82ffff9288edfda9105e00f6db979eb06424c7f68a80c5b56
|
|
7
|
+
data.tar.gz: 3981689282eb4c43ce6bdd2281252cef925d609f879d73aeed3754cbf5b39c983d7927394ba81e1127db00ff372cbe6d8dec5ec2e092ccf28dfb9b4ec9e73bfd
|
data/lib/uffizzi/auth_helper.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Uffizzi
|
|
|
4
4
|
module AuthHelper
|
|
5
5
|
class << self
|
|
6
6
|
def signed_in?
|
|
7
|
-
config_data_exists?
|
|
7
|
+
config_data_exists? && authorized?
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def sign_out
|
|
@@ -16,13 +16,25 @@ module Uffizzi
|
|
|
16
16
|
Uffizzi::Token.delete if Uffizzi::Token.exists?
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def check_login(project_option)
|
|
20
|
+
raise Uffizzi::Error.new('You are not logged in. Run `uffizzi login`.') unless signed_in?
|
|
21
|
+
raise Uffizzi::Error.new('This command needs project to be set in config file') unless project_set?(project_option)
|
|
22
|
+
end
|
|
23
|
+
|
|
19
24
|
private
|
|
20
25
|
|
|
21
26
|
def config_data_exists?
|
|
22
27
|
ConfigFile.exists? &&
|
|
23
|
-
ConfigFile.option_has_value?(:
|
|
24
|
-
ConfigFile.option_has_value?(:
|
|
25
|
-
|
|
28
|
+
ConfigFile.option_has_value?(:server) &&
|
|
29
|
+
ConfigFile.option_has_value?(:account)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def authorized?
|
|
33
|
+
ConfigFile.option_has_value?(:cookie) || Uffizzi::Token.exists?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def project_set?(project_option)
|
|
37
|
+
!project_option.nil? || (Uffizzi::ConfigFile.exists? && Uffizzi::ConfigFile.option_has_value?(:project))
|
|
26
38
|
end
|
|
27
39
|
end
|
|
28
40
|
end
|
data/lib/uffizzi/cli/account.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Uffizzi
|
|
|
25
25
|
private
|
|
26
26
|
|
|
27
27
|
def run(command, account_name = nil)
|
|
28
|
-
|
|
28
|
+
raise Uffizzi::Error.new('You are not logged in. Run `uffizzi login`.') unless Uffizzi::AuthHelper.signed_in?
|
|
29
29
|
|
|
30
30
|
case command
|
|
31
31
|
when 'list'
|
data/lib/uffizzi/cli/cluster.rb
CHANGED
|
@@ -6,7 +6,6 @@ require 'uffizzi'
|
|
|
6
6
|
require 'uffizzi/auth_helper'
|
|
7
7
|
require 'uffizzi/helpers/config_helper'
|
|
8
8
|
require 'uffizzi/services/preview_service'
|
|
9
|
-
require 'uffizzi/services/command_service'
|
|
10
9
|
require 'uffizzi/services/cluster_service'
|
|
11
10
|
require 'uffizzi/services/kubeconfig_service'
|
|
12
11
|
require 'uffizzi/services/cluster/disconnect_service'
|
|
@@ -30,6 +29,7 @@ module Uffizzi
|
|
|
30
29
|
method_option :'update-current-context', type: :boolean, required: false, default: true
|
|
31
30
|
method_option :output, required: false, type: :string, aliases: '-o', enum: ['json', 'pretty-json']
|
|
32
31
|
method_option :'creation-source', required: false, type: :string
|
|
32
|
+
method_option :'k8s-version', required: false, type: :string
|
|
33
33
|
def create(name = nil)
|
|
34
34
|
run('create', { name: name })
|
|
35
35
|
end
|
|
@@ -65,9 +65,7 @@ module Uffizzi
|
|
|
65
65
|
|
|
66
66
|
def run(command, command_args = {})
|
|
67
67
|
Uffizzi.ui.output_format = options[:output]
|
|
68
|
-
|
|
69
|
-
raise Uffizzi::Error.new('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
70
|
-
|
|
68
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
71
69
|
project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
|
|
72
70
|
|
|
73
71
|
case command
|
|
@@ -114,13 +112,15 @@ module Uffizzi
|
|
|
114
112
|
|
|
115
113
|
cluster_name = command_args[:name] || options[:name] || ClusterService.generate_name
|
|
116
114
|
creation_source = options[:"creation-source"] || ClusterService::MANUAL_CREATION_SOURCE
|
|
117
|
-
|
|
118
|
-
unless ClusterService.valid_name?(cluster_name)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
k8s_version = options[:"k8s-version"]
|
|
116
|
+
Uffizzi.ui.say_error_and_exit("Cluster name: #{cluster_name} is not valid.") unless ClusterService.valid_name?(cluster_name)
|
|
117
|
+
|
|
118
|
+
params = cluster_creation_params(
|
|
119
|
+
name: cluster_name,
|
|
120
|
+
creation_source: creation_source,
|
|
121
|
+
manifest_file_path: options[:manifest],
|
|
122
|
+
k8s_version: k8s_version,
|
|
123
|
+
)
|
|
124
124
|
response = create_cluster(ConfigFile.read_option(:server), project_slug, params)
|
|
125
125
|
|
|
126
126
|
return ResponseHelper.handle_failed_response(response) unless ResponseHelper.created?(response)
|
|
@@ -239,7 +239,7 @@ module Uffizzi
|
|
|
239
239
|
end
|
|
240
240
|
end
|
|
241
241
|
|
|
242
|
-
def cluster_creation_params(name
|
|
242
|
+
def cluster_creation_params(name:, creation_source:, manifest_file_path:, k8s_version:)
|
|
243
243
|
manifest_content = load_manifest_file(manifest_file_path)
|
|
244
244
|
oidc_token = Uffizzi::ConfigFile.read_option(:oidc_token)
|
|
245
245
|
|
|
@@ -248,6 +248,7 @@ module Uffizzi
|
|
|
248
248
|
name: name,
|
|
249
249
|
manifest: manifest_content,
|
|
250
250
|
creation_source: creation_source,
|
|
251
|
+
k8s_version: k8s_version,
|
|
251
252
|
},
|
|
252
253
|
token: oidc_token,
|
|
253
254
|
}
|
|
@@ -303,6 +304,7 @@ module Uffizzi
|
|
|
303
304
|
status: cluster_data[:state],
|
|
304
305
|
created: Time.strptime(cluster_data[:created_at], '%Y-%m-%dT%H:%M:%S.%N').strftime('%a %b %d %H:%M:%S %Y'),
|
|
305
306
|
url: cluster_data[:host],
|
|
307
|
+
k8s_version: cluster_data[:k8s_version],
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
rendered_cluster_data = if Uffizzi.ui.output_format.nil?
|
|
@@ -335,7 +337,6 @@ module Uffizzi
|
|
|
335
337
|
end
|
|
336
338
|
|
|
337
339
|
def save_kubeconfig(kubeconfig, kubeconfig_path)
|
|
338
|
-
kubeconfig_path = kubeconfig_path.nil? ? KubeconfigService.default_path : kubeconfig_path
|
|
339
340
|
is_update_current_context = options[:'update-current-context']
|
|
340
341
|
|
|
341
342
|
KubeconfigService.save_to_filepath(kubeconfig_path, kubeconfig) do |kubeconfig_by_path|
|
|
@@ -354,6 +355,8 @@ module Uffizzi
|
|
|
354
355
|
merged_kubeconfig
|
|
355
356
|
end
|
|
356
357
|
end
|
|
358
|
+
|
|
359
|
+
Uffizzi.ui.say("Kubeconfig was updated by the path: #{kubeconfig_path}") if is_update_current_context
|
|
357
360
|
end
|
|
358
361
|
|
|
359
362
|
def update_clusters_config(id, params)
|
data/lib/uffizzi/cli/dev.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'uffizzi/services/command_service'
|
|
4
3
|
require 'uffizzi/services/cluster_service'
|
|
5
4
|
require 'uffizzi/services/dev_service'
|
|
6
5
|
require 'uffizzi/services/kubeconfig_service'
|
|
6
|
+
require 'uffizzi/auth_helper'
|
|
7
7
|
|
|
8
8
|
module Uffizzi
|
|
9
9
|
class Cli::Dev < Thor
|
|
@@ -13,11 +13,12 @@ module Uffizzi
|
|
|
13
13
|
method_option :quiet, type: :boolean, aliases: :q
|
|
14
14
|
method_option :'default-repo', type: :string
|
|
15
15
|
method_option :kubeconfig, type: :string
|
|
16
|
+
method_option :'k8s-version', required: false, type: :string
|
|
16
17
|
def start(config_path = 'skaffold.yaml')
|
|
18
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
17
19
|
DevService.check_skaffold_existence
|
|
18
20
|
DevService.check_running_daemon if options[:quiet]
|
|
19
21
|
DevService.check_skaffold_config_existence(config_path)
|
|
20
|
-
check_login
|
|
21
22
|
cluster_id, cluster_name = start_create_cluster
|
|
22
23
|
kubeconfig = wait_cluster_creation(cluster_name)
|
|
23
24
|
|
|
@@ -49,15 +50,12 @@ module Uffizzi
|
|
|
49
50
|
|
|
50
51
|
private
|
|
51
52
|
|
|
52
|
-
def check_login
|
|
53
|
-
raise Uffizzi::Error.new('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
|
54
|
-
raise Uffizzi::Error.new('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
53
|
def start_create_cluster
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
params = cluster_creation_params(
|
|
55
|
+
name: ClusterService.generate_name,
|
|
56
|
+
creation_source: ClusterService::MANUAL_CREATION_SOURCE,
|
|
57
|
+
k8s_version: options[:"k8s-version"],
|
|
58
|
+
)
|
|
61
59
|
Uffizzi.ui.say('Start creating a cluster')
|
|
62
60
|
response = create_cluster(ConfigFile.read_option(:server), project_slug, params)
|
|
63
61
|
return ResponseHelper.handle_failed_response(response) unless ResponseHelper.created?(response)
|
|
@@ -110,7 +108,7 @@ module Uffizzi
|
|
|
110
108
|
ConfigFile.write_option(:clusters, clusters_config)
|
|
111
109
|
end
|
|
112
110
|
|
|
113
|
-
def cluster_creation_params(name
|
|
111
|
+
def cluster_creation_params(name:, creation_source:, k8s_version:)
|
|
114
112
|
oidc_token = Uffizzi::ConfigFile.read_option(:oidc_token)
|
|
115
113
|
|
|
116
114
|
{
|
|
@@ -118,6 +116,7 @@ module Uffizzi
|
|
|
118
116
|
name: name,
|
|
119
117
|
manifest: nil,
|
|
120
118
|
creation_source: creation_source,
|
|
119
|
+
k8s_version: k8s_version,
|
|
121
120
|
},
|
|
122
121
|
token: oidc_token,
|
|
123
122
|
}
|
|
@@ -4,7 +4,6 @@ require 'uffizzi'
|
|
|
4
4
|
require 'uffizzi/auth_helper'
|
|
5
5
|
require 'uffizzi/response_helper'
|
|
6
6
|
require 'uffizzi/services/preview_service'
|
|
7
|
-
require 'uffizzi/services/command_service'
|
|
8
7
|
|
|
9
8
|
module Uffizzi
|
|
10
9
|
class Cli::Preview::Service < Thor
|
|
@@ -12,8 +11,7 @@ module Uffizzi
|
|
|
12
11
|
|
|
13
12
|
desc 'logs [LOGS_TYPE] [DEPLOYMENT_ID] [CONTAINER_NAME]', 'Show the logs for a container service of a preview'
|
|
14
13
|
def logs(logs_type, deployment_name, container_name = args)
|
|
15
|
-
|
|
16
|
-
return Uffizzi.ui.say('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
14
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
17
15
|
|
|
18
16
|
deployment_id = PreviewService.read_deployment_id(deployment_name)
|
|
19
17
|
response = service_logs_response(logs_type, deployment_id, container_name)
|
|
@@ -28,8 +26,7 @@ module Uffizzi
|
|
|
28
26
|
|
|
29
27
|
desc 'list [DEPLOYMENT_ID]', 'List the container services of a given compose environment (preview)'
|
|
30
28
|
def list(deployment_name)
|
|
31
|
-
|
|
32
|
-
return Uffizzi.ui.say('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
29
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
33
30
|
|
|
34
31
|
project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
|
|
35
32
|
server = ConfigFile.read_option(:server)
|
data/lib/uffizzi/cli/preview.rb
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require 'uffizzi'
|
|
4
4
|
require 'uffizzi/auth_helper'
|
|
5
5
|
require 'uffizzi/services/preview_service'
|
|
6
|
-
require 'uffizzi/services/command_service'
|
|
7
6
|
require 'uffizzi/services/github_service'
|
|
8
7
|
|
|
9
8
|
module Uffizzi
|
|
@@ -55,8 +54,7 @@ module Uffizzi
|
|
|
55
54
|
|
|
56
55
|
def run(command, file_path: nil, deployment_name: nil)
|
|
57
56
|
Uffizzi.ui.output_format = options[:output]
|
|
58
|
-
|
|
59
|
-
raise Uffizzi::Error.new('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
57
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
60
58
|
|
|
61
59
|
project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
|
|
62
60
|
|
|
@@ -5,7 +5,6 @@ require 'uffizzi/auth_helper'
|
|
|
5
5
|
require 'uffizzi/response_helper'
|
|
6
6
|
require 'uffizzi/services/compose_file_service'
|
|
7
7
|
require 'uffizzi/services/env_variables_service'
|
|
8
|
-
require 'uffizzi/services/command_service'
|
|
9
8
|
|
|
10
9
|
module Uffizzi
|
|
11
10
|
class Cli::Project::Compose < Thor
|
|
@@ -29,8 +28,7 @@ module Uffizzi
|
|
|
29
28
|
private
|
|
30
29
|
|
|
31
30
|
def run(command)
|
|
32
|
-
|
|
33
|
-
return Uffizzi.ui.say('This command needs project to be set in config file') unless CommandService.project_set?(options)
|
|
31
|
+
Uffizzi::AuthHelper.check_login(options[:project])
|
|
34
32
|
|
|
35
33
|
project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
|
|
36
34
|
file_path = options[:file]
|
data/lib/uffizzi/cli/project.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Uffizzi
|
|
|
55
55
|
private
|
|
56
56
|
|
|
57
57
|
def run(command, project_slug: nil)
|
|
58
|
-
|
|
58
|
+
raise Uffizzi::Error.new('You are not logged in. Run `uffizzi login`.') unless Uffizzi::AuthHelper.signed_in?
|
|
59
59
|
|
|
60
60
|
case command
|
|
61
61
|
when 'list'
|
data/lib/uffizzi/version.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
uffizzi cluster create -h
|
|
1
2
|
uffizzi-cluster-create - create a cluster
|
|
2
3
|
================================================================
|
|
3
4
|
|
|
@@ -12,9 +13,17 @@ uffizzi-cluster-create - create a cluster
|
|
|
12
13
|
https://docs.uffizzi.com/references/cli/
|
|
13
14
|
|
|
14
15
|
## FLAGS
|
|
16
|
+
|
|
15
17
|
--name
|
|
16
18
|
Option is deprecated and will be removed in the newer versions.
|
|
17
|
-
Please use a positional argument instead: uffizzi cluster create
|
|
19
|
+
Please use a positional argument instead: uffizzi cluster create
|
|
20
|
+
my-awesome-name.
|
|
21
|
+
|
|
22
|
+
--k8s-version=<api-version>
|
|
23
|
+
Specify which version of the Kubernetes API to use when creating
|
|
24
|
+
the cluster, formatted as [MAJOR].[MINOR]. Defaults to 1.27.
|
|
25
|
+
Minor versions point to the latest release of the corresponding k3s
|
|
26
|
+
minor version. See https://github.com/k3s-io/k3s/releases
|
|
18
27
|
|
|
19
28
|
--kubeconfig="/path/to/your/kubeconfig"
|
|
20
29
|
Path to kubeconfig file
|
data/man/uffizzi-dev-start.ronn
CHANGED
|
@@ -31,10 +31,11 @@ uffizzi-dev-start - start a development environment
|
|
|
31
31
|
Currently supports skaffold.yaml files.
|
|
32
32
|
|
|
33
33
|
## FLAGS
|
|
34
|
-
--
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
--k8s-version=<api-version>
|
|
35
|
+
Specify which version of the Kubernetes API to use when creating
|
|
36
|
+
the cluster, formatted as [MAJOR].[MINOR]. Defaults to 1.27.
|
|
37
|
+
Minor versions point to the latest release of the corresponding k3s
|
|
38
|
+
minor version. See https://github.com/k3s-io/k3s/releases
|
|
38
39
|
|
|
39
40
|
--default-repo="<container-registry-domain>"
|
|
40
41
|
A public or private repo used to push/pull build
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uffizzi-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josh Thurman
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2023-10-
|
|
12
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -448,7 +448,6 @@ files:
|
|
|
448
448
|
- lib/uffizzi/response_helper.rb
|
|
449
449
|
- lib/uffizzi/services/cluster/disconnect_service.rb
|
|
450
450
|
- lib/uffizzi/services/cluster_service.rb
|
|
451
|
-
- lib/uffizzi/services/command_service.rb
|
|
452
451
|
- lib/uffizzi/services/compose_file_service.rb
|
|
453
452
|
- lib/uffizzi/services/dev_service.rb
|
|
454
453
|
- lib/uffizzi/services/env_variables_service.rb
|