uffizzi-cli 0.11.0 → 0.11.3
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/cli/connect.rb +4 -2
- data/lib/uffizzi/cli/login.rb +5 -2
- data/lib/uffizzi/cli/preview/service.rb +1 -1
- data/lib/uffizzi/cli.rb +2 -2
- data/lib/uffizzi/config_file.rb +11 -6
- data/lib/uffizzi/response_helper.rb +6 -2
- data/lib/uffizzi/services/preview_service.rb +7 -3
- data/lib/uffizzi/version.rb +1 -1
- data/man/uffizzi-connect +2 -2
- data/man/uffizzi-connect-ghcr +15 -6
- data/man/uffizzi-connect-ghcr.ronn +19 -11
- data/man/uffizzi-connect.ronn +2 -2
- data/man/uffizzi-disconnect +2 -2
- data/man/uffizzi-disconnect.ronn +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 180b017f63db77067a36ac80286e244bed3c363e9c884c6c65e7f0157c5342dd
|
4
|
+
data.tar.gz: 024ad78f5e85209b2970324f68b8017f1a9fb919e3c9b7dcfbc31ef903dad548
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c0eb580b2b290b03bbbab9069020b150929cdeb3eeca9ec10bd238b9325a48c77716b19f30e638435ad00c9c406a6d0d4bfa7049aa63afc7861233700d71a3
|
7
|
+
data.tar.gz: 39bc279bb44a2ed422220d517fe104942efb17ccbcc0a7ee58bb0698b923aea2396d3cc493303cadc92cc723cba8114dde62bc3a9c4564e7e6e3b53ff17ac7d2
|
data/lib/uffizzi/cli/connect.rb
CHANGED
@@ -126,12 +126,14 @@ module Uffizzi
|
|
126
126
|
desc 'ghcr', 'Connect to GitHub Container Registry (ghcr.io)'
|
127
127
|
method_option :skip_raise_existence_error, type: :boolean, default: false,
|
128
128
|
desc: 'Skip raising an error within check the credential'
|
129
|
+
method_option :username, type: :string, aliases: :u
|
130
|
+
method_option :token, type: :string, aliases: :t
|
129
131
|
def ghcr
|
130
132
|
type = Uffizzi.configuration.credential_types[:github_registry]
|
131
133
|
check_credential_existence(type, 'ghcr')
|
132
134
|
|
133
|
-
username = ENV['GITHUB_USERNAME'] || Uffizzi.ui.ask('Github Username:
|
134
|
-
password = ENV['GITHUB_ACCESS_TOKEN'] || Uffizzi.ui.ask('Access Token:
|
135
|
+
username = options[:username] || ENV['GITHUB_USERNAME'] || Uffizzi.ui.ask('Github Username:')
|
136
|
+
password = options[:token] || ENV['GITHUB_ACCESS_TOKEN'] || Uffizzi.ui.ask('Access Token:', echo: false)
|
135
137
|
|
136
138
|
params = {
|
137
139
|
username: username,
|
data/lib/uffizzi/cli/login.rb
CHANGED
@@ -15,7 +15,7 @@ module Uffizzi
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
Uffizzi.ui.say('Login to Uffizzi
|
18
|
+
Uffizzi.ui.say('Login to Uffizzi server.')
|
19
19
|
server = set_server
|
20
20
|
|
21
21
|
username = set_username
|
@@ -34,7 +34,8 @@ module Uffizzi
|
|
34
34
|
|
35
35
|
def set_server
|
36
36
|
config_server = ConfigFile.exists? ? read_option_from_config(:server) : nil
|
37
|
-
@options[:server] || config_server || Uffizzi.ui.ask('Server: ')
|
37
|
+
server_address = @options[:server] || config_server || Uffizzi.ui.ask('Server: ')
|
38
|
+
server_address.start_with?('http:', 'https:') ? server_address : "https://#{server_address}"
|
38
39
|
end
|
39
40
|
|
40
41
|
def set_username
|
@@ -68,6 +69,8 @@ module Uffizzi
|
|
68
69
|
ConfigFile.write_option(:cookie, response[:headers])
|
69
70
|
ConfigFile.write_option(:account_id, account[:id])
|
70
71
|
|
72
|
+
Uffizzi.ui.say('Login successfull')
|
73
|
+
|
71
74
|
default_project = ConfigFile.read_option(:project)
|
72
75
|
return unless default_project
|
73
76
|
|
@@ -68,7 +68,7 @@ module Uffizzi
|
|
68
68
|
|
69
69
|
def handle_succeed_logs_response(response, container_name)
|
70
70
|
logs = response[:body][:logs] || []
|
71
|
-
return Uffizzi.ui.say("The service #{container_name} has no logs") if logs.empty?
|
71
|
+
return Uffizzi.ui.say("The service '#{container_name}' has no logs") if logs.empty?
|
72
72
|
|
73
73
|
logs.each do |log|
|
74
74
|
Uffizzi.ui.say(log)
|
data/lib/uffizzi/cli.rb
CHANGED
@@ -64,8 +64,8 @@ module Uffizzi
|
|
64
64
|
super
|
65
65
|
rescue Interrupt
|
66
66
|
raise Uffizzi::Error.new('The command was interrupted')
|
67
|
-
rescue
|
68
|
-
raise Uffizzi::Error.new(
|
67
|
+
rescue StandardError => e
|
68
|
+
raise Uffizzi::Error.new(e.message)
|
69
69
|
end
|
70
70
|
|
71
71
|
private
|
data/lib/uffizzi/config_file.rb
CHANGED
@@ -92,10 +92,9 @@ module Uffizzi
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def write(data)
|
95
|
-
file = create_file
|
96
95
|
prepared_data = prepare_data(data)
|
97
|
-
|
98
|
-
|
96
|
+
|
97
|
+
lock(config_path) { atomic_write(config_path, "#{config_path}.tmp", prepared_data) }
|
99
98
|
end
|
100
99
|
|
101
100
|
def prepare_data(data)
|
@@ -105,12 +104,18 @@ module Uffizzi
|
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
108
|
-
def
|
109
|
-
|
107
|
+
def atomic_write(path, temp_path, content)
|
108
|
+
File.open(temp_path, 'w') { |f| f.write(content) }
|
109
|
+
FileUtils.mv(temp_path, path)
|
110
|
+
end
|
110
111
|
|
112
|
+
def lock(path)
|
113
|
+
dir = File.dirname(path)
|
111
114
|
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
112
115
|
|
113
|
-
File.
|
116
|
+
File.open(path).flock(File::LOCK_EX) if File.exist?(path)
|
117
|
+
yield
|
118
|
+
File.open(path).flock(File::LOCK_UN)
|
114
119
|
end
|
115
120
|
end
|
116
121
|
end
|
@@ -42,14 +42,18 @@ module Uffizzi
|
|
42
42
|
def prepare_errors(errors)
|
43
43
|
errors.values.reduce('') do |acc, error_messages|
|
44
44
|
if error_messages.is_a?(Array)
|
45
|
-
error_messages.each { |error_message| acc = "#{acc}#{error_message}\n" }
|
45
|
+
error_messages.each { |error_message| acc = "#{acc}#{prepare_error_message(error_message)}\n" }
|
46
46
|
else
|
47
|
-
acc = "#{acc}#{
|
47
|
+
acc = "#{acc}#{prepare_error_message(error_message)}\n"
|
48
48
|
end
|
49
49
|
|
50
50
|
acc
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
def prepare_error_message(error_message)
|
55
|
+
error_message.split('::').last
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
@@ -20,7 +20,7 @@ class PreviewService
|
|
20
20
|
deployment_id = deployment[:id]
|
21
21
|
params = { id: deployment_id }
|
22
22
|
|
23
|
-
response = deploy_containers(
|
23
|
+
response = deploy_containers(server_url, project_slug, deployment_id, params)
|
24
24
|
|
25
25
|
if !Uffizzi::ResponseHelper.no_content?(response)
|
26
26
|
Uffizzi::ResponseHelper.handle_failed_response(response)
|
@@ -32,13 +32,17 @@ class PreviewService
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
+
def server_url
|
36
|
+
@server_url ||= Uffizzi::ConfigFile.read_option(:server)
|
37
|
+
end
|
38
|
+
|
35
39
|
def wait_containers_creation(deployment, project_slug)
|
36
40
|
spinner = TTY::Spinner.new('[:spinner] Creating containers...', format: :dots)
|
37
41
|
spinner.auto_spin
|
38
42
|
|
39
43
|
activity_items = []
|
40
44
|
loop do
|
41
|
-
response = get_activity_items(
|
45
|
+
response = get_activity_items(server_url, project_slug, deployment[:id])
|
42
46
|
handle_activity_items_response(response, spinner)
|
43
47
|
activity_items = response[:body][:activity_items]
|
44
48
|
break if activity_items.count == deployment[:containers].count
|
@@ -62,7 +66,7 @@ class PreviewService
|
|
62
66
|
containers_spinners = create_containers_spinners(activity_items, spinner)
|
63
67
|
|
64
68
|
loop do
|
65
|
-
response = get_activity_items(
|
69
|
+
response = get_activity_items(server_url, project_slug, deployment[:id])
|
66
70
|
handle_activity_items_response(response, spinner)
|
67
71
|
activity_items = response[:body][:activity_items]
|
68
72
|
update_containers_spinners!(activity_items, containers_spinners)
|
data/lib/uffizzi/version.rb
CHANGED
data/man/uffizzi-connect
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.\" generated with Ronn-NG/v0.9.1
|
2
2
|
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
-
.TH "UFFIZZI\-CONNECT" "" "
|
3
|
+
.TH "UFFIZZI\-CONNECT" "" "July 2022" ""
|
4
4
|
.SH "NAME"
|
5
5
|
\fBuffizzi\-connect\fR \- grant a Uffizzi user account access to external services
|
6
6
|
.SH "SYNOPSIS"
|
@@ -30,7 +30,7 @@ ecr
|
|
30
30
|
gcr
|
31
31
|
Connect to Google Container Registry (gcr\.io)\.
|
32
32
|
|
33
|
-
|
33
|
+
ghcr
|
34
34
|
Connect to GitHub Container Registry (ghcr\.io)\.
|
35
35
|
.fi
|
36
36
|
.P
|
data/man/uffizzi-connect-ghcr
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
.\" generated with Ronn-NG/v0.9.1
|
2
2
|
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
-
.TH "UFFIZZI\-CONNECT\-
|
3
|
+
.TH "UFFIZZI\-CONNECT\-GHCR" "" "July 2022" ""
|
4
4
|
.SH "NAME"
|
5
|
-
\fBuffizzi\-connect\-
|
5
|
+
\fBuffizzi\-connect\-ghcr\fR \- grant a Uffizzi user account access to a private GitHub Container Registry (GHCR)
|
6
6
|
.SH "SYNOPSIS"
|
7
7
|
.nf
|
8
|
-
uffizzi connect
|
8
|
+
uffizzi connect ghcr [OPTION]\|\.\|\.\|\.
|
9
9
|
.fi
|
10
10
|
.SH "DESCRIPTION"
|
11
11
|
.nf
|
12
12
|
Given valid credentials, grants a Uffizzi user account access
|
13
|
-
to a private GitHub Container Registry
|
13
|
+
to a private GitHub Container Registry\.
|
14
|
+
|
15
|
+
Credentials can be provided interactively or non\-interactively
|
16
|
+
via command options or environment variables:
|
17
|
+
GITHUB_USERNAME, GITHUB_ACCESS_TOKEN
|
14
18
|
|
15
19
|
This command can fail for the following reasons:
|
16
20
|
\- The active user does not have permission to connect
|
@@ -24,12 +28,17 @@ For detailed instructions on configuring webhooks to send push
|
|
24
28
|
notifications to Uffizzi, see
|
25
29
|
https://docs\.uffizzi\.com/guides/container\-registry\-integrations
|
26
30
|
.fi
|
31
|
+
.SH "OPTIONS"
|
32
|
+
.nf
|
33
|
+
\-u, \-\-username GitHub username
|
34
|
+
\-t, \-\-token Personal access token from GitHub
|
35
|
+
.fi
|
27
36
|
.SH "EXAMPLES"
|
28
37
|
.nf
|
29
38
|
The following command will prompt the user to enter GHCR
|
30
39
|
credentials, including GitHub account name and
|
31
|
-
personal access
|
40
|
+
personal access token (PAT):
|
32
41
|
|
33
|
-
|
42
|
+
uffizzi connect ghcr
|
34
43
|
.fi
|
35
44
|
|
@@ -1,15 +1,19 @@
|
|
1
|
-
uffizzi-connect-
|
1
|
+
uffizzi-connect-ghcr - grant a Uffizzi user account access to a private GitHub Container Registry (GHCR)
|
2
2
|
================================================================
|
3
3
|
|
4
4
|
## SYNOPSIS
|
5
|
-
uffizzi connect
|
5
|
+
uffizzi connect ghcr [OPTION]...
|
6
6
|
|
7
7
|
## DESCRIPTION
|
8
|
-
Given valid credentials, grants a Uffizzi user account access
|
9
|
-
to a private GitHub Container Registry
|
8
|
+
Given valid credentials, grants a Uffizzi user account access
|
9
|
+
to a private GitHub Container Registry.
|
10
|
+
|
11
|
+
Credentials can be provided interactively or non-interactively
|
12
|
+
via command options or environment variables:
|
13
|
+
GITHUB_USERNAME, GITHUB_ACCESS_TOKEN
|
10
14
|
|
11
15
|
This command can fail for the following reasons:
|
12
|
-
- The active user does not have permission to connect
|
16
|
+
- The active user does not have permission to connect
|
13
17
|
external services.
|
14
18
|
- The given credentials are invalid.
|
15
19
|
|
@@ -17,12 +21,16 @@ uffizzi-connect-ecr - grant a Uffizzi user account access to a private GitHub Co
|
|
17
21
|
https://github.com/UffizziCloud/uffizzi_cli
|
18
22
|
|
19
23
|
For detailed instructions on configuring webhooks to send push
|
20
|
-
notifications to Uffizzi, see
|
24
|
+
notifications to Uffizzi, see
|
21
25
|
https://docs.uffizzi.com/guides/container-registry-integrations
|
22
26
|
|
27
|
+
## OPTIONS
|
28
|
+
-u, --username GitHub username
|
29
|
+
-t, --token Personal access token from GitHub
|
30
|
+
|
23
31
|
## EXAMPLES
|
24
|
-
The following command will prompt the user to enter GHCR
|
25
|
-
credentials, including GitHub account name and
|
26
|
-
personal access
|
27
|
-
|
28
|
-
|
32
|
+
The following command will prompt the user to enter GHCR
|
33
|
+
credentials, including GitHub account name and
|
34
|
+
personal access token (PAT):
|
35
|
+
|
36
|
+
uffizzi connect ghcr
|
data/man/uffizzi-connect.ronn
CHANGED
@@ -24,8 +24,8 @@ uffizzi-connect - grant a Uffizzi user account access to external services
|
|
24
24
|
|
25
25
|
gcr
|
26
26
|
Connect to Google Container Registry (gcr.io).
|
27
|
-
|
28
|
-
|
27
|
+
|
28
|
+
ghcr
|
29
29
|
Connect to GitHub Container Registry (ghcr.io).
|
30
30
|
|
31
31
|
Run 'uffizzi connect COMMAND --help' for more information on a command.
|
data/man/uffizzi-disconnect
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
.\" generated with Ronn-NG/v0.9.1
|
2
2
|
.\" http://github.com/apjanke/ronn-ng/tree/0.9.1
|
3
|
-
.TH "UFFIZZI\-DISCONNECT" "" "
|
3
|
+
.TH "UFFIZZI\-DISCONNECT" "" "July 2022" ""
|
4
4
|
.SH "NAME"
|
5
5
|
\fBuffizzi\-disconnect\fR \- revoke a Uffizzi user account access to external services
|
6
6
|
.SH "SYNOPSIS"
|
@@ -30,7 +30,7 @@ ecr
|
|
30
30
|
gcr
|
31
31
|
Disonnect from Google Container Registry (gcr\.io)\.
|
32
32
|
|
33
|
-
|
33
|
+
ghcr
|
34
34
|
Disonnect from GitHub Container Registry (ghcr\.io)\.
|
35
35
|
.fi
|
36
36
|
.P
|
data/man/uffizzi-disconnect.ronn
CHANGED
@@ -24,8 +24,8 @@ uffizzi-disconnect - revoke a Uffizzi user account access to external services
|
|
24
24
|
|
25
25
|
gcr
|
26
26
|
Disonnect from Google Container Registry (gcr.io).
|
27
|
-
|
28
|
-
|
27
|
+
|
28
|
+
ghcr
|
29
29
|
Disonnect from GitHub Container Registry (ghcr.io).
|
30
30
|
|
31
31
|
Run 'uffizzi disconnect COMMAND --help' for more information on a command.
|
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.11.
|
4
|
+
version: 0.11.3
|
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: 2022-
|
12
|
+
date: 2022-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_print
|