uffizzi-cli 0.3.6 → 0.4.0
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/README.md +10 -0
- data/lib/uffizzi/cli/disconnect.rb +43 -0
- data/lib/uffizzi/cli/preview/service.rb +40 -3
- data/lib/uffizzi/cli/preview.rb +0 -1
- data/lib/uffizzi/cli.rb +10 -0
- data/lib/uffizzi/clients/api/api_client.rb +14 -0
- data/lib/uffizzi/clients/api/api_routes.rb +8 -0
- data/lib/uffizzi/error.rb +5 -0
- data/lib/uffizzi/version.rb +1 -1
- data/lib/uffizzi.rb +3 -2
- metadata +32 -58
- data/.dockerignore +0 -9
- data/.rubocop.yml +0 -578
- data/CHANGELOG.md +0 -5
- data/CONTRIBUTING.md +0 -13
- data/Dockerfile +0 -46
- data/Gemfile +0 -5
- data/Gemfile.lock +0 -122
- data/Makefile +0 -31
- data/Rakefile +0 -21
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/docker-compose.yml +0 -29
- data/docker-entrypoint.sh +0 -20
- data/man/uffizzi-create +0 -50
- data/man/uffizzi-create.ronn +0 -41
- data/man/uffizzi-delete +0 -37
- data/man/uffizzi-delete.ronn +0 -28
- data/man/uffizzi-describe +0 -38
- data/man/uffizzi-describe.ronn +0 -29
- data/man/uffizzi-events +0 -30
- data/man/uffizzi-events.ronn +0 -29
- data/man/uffizzi-list +0 -33
- data/man/uffizzi-list.ronn +0 -25
- data/man/uffizzi-logout +0 -21
- data/man/uffizzi-logout.ronn +0 -19
- data/man/uffizzi-preview +0 -39
- data/man/uffizzi-preview.ronn +0 -33
- data/uffizzi.gemspec +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f517c288807e4cb2a7480303b9c04b2856fe76885c79abc3bfb39f77dee24abc
|
4
|
+
data.tar.gz: be93d597d0a6892854974706d2bd629c5b323cffc6ee682f2623884d61d013ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54df68a43dddc1827a83dfa0f172c57d68b12f6ac52064990b02cd69ccb6a27bced898db4420f146fdd55dcefc017317142b7c587213114af2135dd0a4cc2444
|
7
|
+
data.tar.gz: ff40d04955d46452f0823788c1e62b6de2267fc4623cf4cdd0448e107d78610a1d021051346cd7db55f1b5c1ff18b27da9c81328490fb98c3bb19bf4e0a406aa
|
data/README.md
CHANGED
@@ -176,6 +176,16 @@ $ uffizzi config delete OPTION
|
|
176
176
|
|
177
177
|
Deletes specified option.
|
178
178
|
|
179
|
+
### disconnect ###
|
180
|
+
|
181
|
+
```
|
182
|
+
$ uffizzi disconnect CREDENTIAL_TYPE
|
183
|
+
```
|
184
|
+
|
185
|
+
Deletes credential of specified type
|
186
|
+
|
187
|
+
Supported credential types - `docker-hub`, `acr`, `ecr`, `gcr`
|
188
|
+
|
179
189
|
## Git workflow for the app:
|
180
190
|
|
181
191
|
1. Clone the repository and checkout to `develop` branch
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uffizzi'
|
4
|
+
|
5
|
+
module Uffizzi
|
6
|
+
class CLI::Disconnect
|
7
|
+
include ApiClient
|
8
|
+
|
9
|
+
def run(credential_type)
|
10
|
+
connection_type = case credential_type
|
11
|
+
when 'docker-hub'
|
12
|
+
Uffizzi.configuration.credential_types[:dockerhub]
|
13
|
+
when 'acr'
|
14
|
+
Uffizzi.configuration.credential_types[:azure]
|
15
|
+
when 'ecr'
|
16
|
+
Uffizzi.configuration.credential_types[:amazon]
|
17
|
+
when 'gcr'
|
18
|
+
Uffizzi.configuration.credential_types[:google]
|
19
|
+
else
|
20
|
+
raise Uffizzi::Error.new('Unsupported credential type.')
|
21
|
+
end
|
22
|
+
|
23
|
+
response = delete_credential(ConfigFile.read_option(:hostname), connection_type)
|
24
|
+
|
25
|
+
if ResponseHelper.no_content?(response)
|
26
|
+
Uffizzi.ui.say("Successfully disconnected #{connection_name(credential_type)} connection")
|
27
|
+
else
|
28
|
+
ResponseHelper.handle_failed_response(response)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def connection_name(credential_type)
|
35
|
+
{
|
36
|
+
'docker-hub' => 'DockerHub',
|
37
|
+
'acr' => 'ACR',
|
38
|
+
'ecr' => 'ECR',
|
39
|
+
'gcr' => 'GCR',
|
40
|
+
}[credential_type]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -9,7 +9,23 @@ module Uffizzi
|
|
9
9
|
class CLI::Preview::Service < Thor
|
10
10
|
include ApiClient
|
11
11
|
|
12
|
-
desc '
|
12
|
+
desc 'uffizzi preview service logs [LOGS_TYPE] [DEPLOYMENT_ID] [CONTAINER_NAME]', 'logs'
|
13
|
+
def logs(logs_type, deployment_name, container_name = args)
|
14
|
+
return Uffizzi.ui.say('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
15
|
+
return Uffizzi.ui.say('This command needs project to be set in config file') unless Uffizzi::AuthHelper.project_set?
|
16
|
+
|
17
|
+
deployment_id = PreviewService.read_deployment_id(deployment_name)
|
18
|
+
response = service_logs_response(logs_type, deployment_id, container_name)
|
19
|
+
return Uffizzi.ui.say(response[:errors]) if response[:errors]
|
20
|
+
|
21
|
+
if ResponseHelper.ok?(response)
|
22
|
+
handle_succeed_logs_response(response, container_name)
|
23
|
+
else
|
24
|
+
ResponseHelper.handle_failed_response(response)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'uffizzi preview service logs [DEPLOYMENT_ID]', 'list'
|
13
29
|
def list(deployment_name)
|
14
30
|
return Uffizzi.ui.say('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
|
15
31
|
return Uffizzi.ui.say('This command needs project to be set in config file') unless Uffizzi::AuthHelper.project_set?
|
@@ -20,7 +36,7 @@ module Uffizzi
|
|
20
36
|
response = fetch_deployment_services(hostname, project_slug, deployment_id)
|
21
37
|
|
22
38
|
if ResponseHelper.ok?(response)
|
23
|
-
|
39
|
+
handle_succeed_list_response(response, deployment_name)
|
24
40
|
else
|
25
41
|
ResponseHelper.handle_failed_response(response)
|
26
42
|
end
|
@@ -28,7 +44,19 @@ module Uffizzi
|
|
28
44
|
|
29
45
|
private
|
30
46
|
|
31
|
-
def
|
47
|
+
def service_logs_response(logs_type, deployment_id, container_name)
|
48
|
+
project_slug = ConfigFile.read_option(:project)
|
49
|
+
hostname = ConfigFile.read_option(:hostname)
|
50
|
+
|
51
|
+
case logs_type
|
52
|
+
when 'container'
|
53
|
+
fetch_deployment_service_logs(hostname, project_slug, deployment_id, container_name)
|
54
|
+
else
|
55
|
+
raise Uffizzi::Error.new('Unknown log type')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def handle_succeed_list_response(response, deployment_name)
|
32
60
|
services = response[:body][:containers] || []
|
33
61
|
return Uffizzi.ui.say("There are no services associated with the preview #{deployment_name}") if services.empty?
|
34
62
|
|
@@ -36,5 +64,14 @@ module Uffizzi
|
|
36
64
|
Uffizzi.ui.say(service)
|
37
65
|
end
|
38
66
|
end
|
67
|
+
|
68
|
+
def handle_succeed_logs_response(response, container_name)
|
69
|
+
logs = response[:body][:logs] || []
|
70
|
+
return Uffizzi.ui.say("The service #{container_name} has no logs") if logs.empty?
|
71
|
+
|
72
|
+
logs.each do |log|
|
73
|
+
Uffizzi.ui.say(log)
|
74
|
+
end
|
75
|
+
end
|
39
76
|
end
|
40
77
|
end
|
data/lib/uffizzi/cli/preview.rb
CHANGED
data/lib/uffizzi/cli.rb
CHANGED
@@ -8,6 +8,10 @@ module Uffizzi
|
|
8
8
|
require_relative 'cli/common'
|
9
9
|
class_option :help, type: :boolean, aliases: ['-h', 'help']
|
10
10
|
|
11
|
+
def self.exit_on_failure?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
11
15
|
desc 'version', 'show version'
|
12
16
|
def version
|
13
17
|
require_relative 'version'
|
@@ -54,5 +58,11 @@ module Uffizzi
|
|
54
58
|
require_relative 'cli/connect'
|
55
59
|
Connect.new.run(credential_type, credential_file_path)
|
56
60
|
end
|
61
|
+
|
62
|
+
desc 'disconect CREDENTIAL_TYPE', 'Disonnect credentials from Uffizzi'
|
63
|
+
def disconnect(credential_type)
|
64
|
+
require_relative 'cli/disconnect'
|
65
|
+
Disconnect.new.run(credential_type)
|
66
|
+
end
|
57
67
|
end
|
58
68
|
end
|
@@ -41,6 +41,20 @@ module ApiClient
|
|
41
41
|
build_response(response)
|
42
42
|
end
|
43
43
|
|
44
|
+
def delete_credential(hostname, credential_type)
|
45
|
+
uri = delete_credential_uri(hostname, credential_type)
|
46
|
+
response = Uffizzi::HttpClient.make_delete_request(uri)
|
47
|
+
|
48
|
+
build_response(response)
|
49
|
+
end
|
50
|
+
|
51
|
+
def fetch_deployment_service_logs(hostname, project_slug, deployment_id, container_name)
|
52
|
+
uri = preview_service_logs_uri(hostname, project_slug, deployment_id, container_name)
|
53
|
+
response = Uffizzi::HttpClient.make_get_request(uri)
|
54
|
+
|
55
|
+
build_response(response)
|
56
|
+
end
|
57
|
+
|
44
58
|
def set_compose_file(hostname, params, project_slug)
|
45
59
|
uri = compose_file_uri(hostname, project_slug)
|
46
60
|
response = Uffizzi::HttpClient.make_post_request(uri, params)
|
@@ -55,4 +55,12 @@ module ApiRoutes
|
|
55
55
|
def preview_services_uri(hostname, project_slug, deployment_id)
|
56
56
|
"#{hostname}/api/cli/v1/projects/#{project_slug}/deployments/#{deployment_id}/containers"
|
57
57
|
end
|
58
|
+
|
59
|
+
def delete_credential_uri(hostname, credential_type)
|
60
|
+
"#{hostname}/api/cli/v1/account/credentials/#{credential_type}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def preview_service_logs_uri(hostname, project_slug, deployment_id, container_name)
|
64
|
+
"#{hostname}/api/cli/v1/projects/#{project_slug}/deployments/#{deployment_id}/containers/#{container_name}/logs"
|
65
|
+
end
|
58
66
|
end
|
data/lib/uffizzi/version.rb
CHANGED
data/lib/uffizzi.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'io/console'
|
4
|
+
require 'tty-spinner'
|
4
5
|
|
6
|
+
require 'thor'
|
7
|
+
require 'uffizzi/error'
|
5
8
|
require 'uffizzi/shell'
|
6
9
|
require 'uffizzi/version'
|
7
10
|
require 'uffizzi/clients/api/api_client'
|
@@ -10,8 +13,6 @@ require 'uffizzi/config_file'
|
|
10
13
|
require_relative '../config/uffizzi'
|
11
14
|
|
12
15
|
module Uffizzi
|
13
|
-
class Error < StandardError; end
|
14
|
-
|
15
16
|
class << self
|
16
17
|
def ui
|
17
18
|
@ui ||= Uffizzi::UI::Shell.new
|
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: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,8 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-03-
|
12
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: tty-spinner
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
14
42
|
- !ruby/object:Gem::Dependency
|
15
43
|
name: bump
|
16
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,20 +263,6 @@ dependencies:
|
|
235
263
|
- - ">="
|
236
264
|
- !ruby/object:Gem::Version
|
237
265
|
version: '0'
|
238
|
-
- !ruby/object:Gem::Dependency
|
239
|
-
name: tty-spinner
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
requirements:
|
242
|
-
- - ">="
|
243
|
-
- !ruby/object:Gem::Version
|
244
|
-
version: '0'
|
245
|
-
type: :development
|
246
|
-
prerelease: false
|
247
|
-
version_requirements: !ruby/object:Gem::Requirement
|
248
|
-
requirements:
|
249
|
-
- - ">="
|
250
|
-
- !ruby/object:Gem::Version
|
251
|
-
version: '0'
|
252
266
|
- !ruby/object:Gem::Dependency
|
253
267
|
name: webmock
|
254
268
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,20 +277,6 @@ dependencies:
|
|
263
277
|
- - ">="
|
264
278
|
- !ruby/object:Gem::Version
|
265
279
|
version: '0'
|
266
|
-
- !ruby/object:Gem::Dependency
|
267
|
-
name: thor
|
268
|
-
requirement: !ruby/object:Gem::Requirement
|
269
|
-
requirements:
|
270
|
-
- - ">="
|
271
|
-
- !ruby/object:Gem::Version
|
272
|
-
version: '0'
|
273
|
-
type: :runtime
|
274
|
-
prerelease: false
|
275
|
-
version_requirements: !ruby/object:Gem::Requirement
|
276
|
-
requirements:
|
277
|
-
- - ">="
|
278
|
-
- !ruby/object:Gem::Version
|
279
|
-
version: '0'
|
280
280
|
description: uffizzi-cli
|
281
281
|
email:
|
282
282
|
- info@uffizzi.com
|
@@ -285,22 +285,9 @@ executables:
|
|
285
285
|
extensions: []
|
286
286
|
extra_rdoc_files: []
|
287
287
|
files:
|
288
|
-
- ".dockerignore"
|
289
|
-
- ".rubocop.yml"
|
290
|
-
- CHANGELOG.md
|
291
|
-
- CONTRIBUTING.md
|
292
|
-
- Dockerfile
|
293
|
-
- Gemfile
|
294
|
-
- Gemfile.lock
|
295
288
|
- LICENSE
|
296
|
-
- Makefile
|
297
289
|
- README.md
|
298
|
-
- Rakefile
|
299
|
-
- bin/console
|
300
|
-
- bin/setup
|
301
290
|
- config/uffizzi.rb
|
302
|
-
- docker-compose.yml
|
303
|
-
- docker-entrypoint.sh
|
304
291
|
- exe/uffizzi
|
305
292
|
- lib/uffizzi.rb
|
306
293
|
- lib/uffizzi/auth_helper.rb
|
@@ -308,6 +295,7 @@ files:
|
|
308
295
|
- lib/uffizzi/cli/common.rb
|
309
296
|
- lib/uffizzi/cli/config.rb
|
310
297
|
- lib/uffizzi/cli/connect.rb
|
298
|
+
- lib/uffizzi/cli/disconnect.rb
|
311
299
|
- lib/uffizzi/cli/login.rb
|
312
300
|
- lib/uffizzi/cli/logout.rb
|
313
301
|
- lib/uffizzi/cli/preview.rb
|
@@ -319,27 +307,13 @@ files:
|
|
319
307
|
- lib/uffizzi/clients/api/api_routes.rb
|
320
308
|
- lib/uffizzi/clients/api/http_client.rb
|
321
309
|
- lib/uffizzi/config_file.rb
|
310
|
+
- lib/uffizzi/error.rb
|
322
311
|
- lib/uffizzi/response_helper.rb
|
323
312
|
- lib/uffizzi/services/compose_file_service.rb
|
324
313
|
- lib/uffizzi/services/env_variables_service.rb
|
325
314
|
- lib/uffizzi/services/preview_service.rb
|
326
315
|
- lib/uffizzi/shell.rb
|
327
316
|
- lib/uffizzi/version.rb
|
328
|
-
- man/uffizzi-create
|
329
|
-
- man/uffizzi-create.ronn
|
330
|
-
- man/uffizzi-delete
|
331
|
-
- man/uffizzi-delete.ronn
|
332
|
-
- man/uffizzi-describe
|
333
|
-
- man/uffizzi-describe.ronn
|
334
|
-
- man/uffizzi-events
|
335
|
-
- man/uffizzi-events.ronn
|
336
|
-
- man/uffizzi-list
|
337
|
-
- man/uffizzi-list.ronn
|
338
|
-
- man/uffizzi-logout
|
339
|
-
- man/uffizzi-logout.ronn
|
340
|
-
- man/uffizzi-preview
|
341
|
-
- man/uffizzi-preview.ronn
|
342
|
-
- uffizzi.gemspec
|
343
317
|
homepage: https://uffizzi.com
|
344
318
|
licenses:
|
345
319
|
- Apache-2.0
|