jatai 1.1.0 → 1.2.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/lib/jatai/commands/up.rb +36 -7
- data/lib/jatai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85122c82b155efd22ee855b4d8e538be1013e93cccbde96c19b695bbf2fbff96
|
|
4
|
+
data.tar.gz: 0bc52ba21340fc3c77f775373397d97a7f9ff194f17559817a34fb7e14045355
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9194f0bf98aedc96cf0357260ebc531c2ba82edc2e58ef36f42888fc9e7f8b330c5f86367a48cde2408c183ea12cd751e499c8c578c0f96d48c1531b3e1ecd0
|
|
7
|
+
data.tar.gz: 07bde3b740fcb1a5fedea4c0d5f0da6122000fbbbd1cb27fe4e8b0a9543f45279410eb335bc3564b9f13ad405f406e97bc11cae83f0396d93570815bd9e5460a
|
data/lib/jatai/commands/up.rb
CHANGED
|
@@ -6,10 +6,10 @@ module Jatai
|
|
|
6
6
|
module Commands
|
|
7
7
|
class Up < Base
|
|
8
8
|
POLL_INTERVAL = 5
|
|
9
|
-
PROVISION_TIMEOUT =
|
|
10
|
-
DEPLOY_TIMEOUT =
|
|
11
|
-
PROVISION_MAX_POLLS =
|
|
12
|
-
DEPLOY_MAX_POLLS =
|
|
9
|
+
PROVISION_TIMEOUT = 180
|
|
10
|
+
DEPLOY_TIMEOUT = 900
|
|
11
|
+
PROVISION_MAX_POLLS = 36
|
|
12
|
+
DEPLOY_MAX_POLLS = 180
|
|
13
13
|
|
|
14
14
|
def execute(options = {})
|
|
15
15
|
require_auth!
|
|
@@ -34,8 +34,9 @@ module Jatai
|
|
|
34
34
|
info(" Na fila...")
|
|
35
35
|
|
|
36
36
|
if wait_for_deploy_complete(slug, deploy["id"])
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
# URL canônica vem do servidor (marca nova). Fallback só p/ servidor antigo.
|
|
38
|
+
url = @app["url"] || "https://#{@app["subdomain"] || slug}.jataiapp.com.br"
|
|
39
|
+
success("Deploy concluído! App disponível em #{url}")
|
|
39
40
|
end
|
|
40
41
|
rescue Api::Client::ValidationError => e
|
|
41
42
|
error("Erro ao criar app: #{e.message}")
|
|
@@ -94,7 +95,23 @@ module Jatai
|
|
|
94
95
|
|
|
95
96
|
def detect_git_remote
|
|
96
97
|
remote = `git remote get-url origin 2>/dev/null`.strip
|
|
97
|
-
|
|
98
|
+
return nil if remote.empty?
|
|
99
|
+
|
|
100
|
+
normalize_git_remote(remote)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# O servidor aceita repo_url só como https(s) (é metadado p/ integração GitHub;
|
|
104
|
+
# o deploy em si é por upload de source). Converte SSH → https e descarta o que
|
|
105
|
+
# não der pra normalizar (retorna nil → repo_url em branco, deploy segue normal).
|
|
106
|
+
def normalize_git_remote(url)
|
|
107
|
+
case url
|
|
108
|
+
when %r{\Agit@([^:]+):(.+?)(?:\.git)?\z} # git@github.com:user/repo.git
|
|
109
|
+
"https://#{Regexp.last_match(1)}/#{Regexp.last_match(2)}"
|
|
110
|
+
when %r{\Assh://git@([^/]+)/(.+?)(?:\.git)?\z} # ssh://git@github.com/user/repo.git
|
|
111
|
+
"https://#{Regexp.last_match(1)}/#{Regexp.last_match(2)}"
|
|
112
|
+
when %r{\Ahttps?://}
|
|
113
|
+
url.sub(/\.git\z/, "")
|
|
114
|
+
end
|
|
98
115
|
end
|
|
99
116
|
|
|
100
117
|
# ── WebSocket methods ──
|
|
@@ -172,6 +189,8 @@ module Jatai
|
|
|
172
189
|
print "."
|
|
173
190
|
show_elapsed(started) if (i % 12).zero? && i > 0
|
|
174
191
|
sleep(POLL_INTERVAL)
|
|
192
|
+
rescue Api::Client::AuthenticationError
|
|
193
|
+
return session_expired
|
|
175
194
|
rescue Faraday::Error, Errno::ECONNREFUSED, IO::TimeoutError
|
|
176
195
|
print "!"
|
|
177
196
|
sleep(POLL_INTERVAL)
|
|
@@ -197,6 +216,8 @@ module Jatai
|
|
|
197
216
|
print "."
|
|
198
217
|
show_elapsed(started) if (i % 12).zero? && i > 0
|
|
199
218
|
sleep(POLL_INTERVAL)
|
|
219
|
+
rescue Api::Client::AuthenticationError
|
|
220
|
+
return session_expired
|
|
200
221
|
rescue Faraday::Error, Errno::ECONNREFUSED, IO::TimeoutError
|
|
201
222
|
print "!"
|
|
202
223
|
sleep(POLL_INTERVAL)
|
|
@@ -205,6 +226,14 @@ module Jatai
|
|
|
205
226
|
false
|
|
206
227
|
end
|
|
207
228
|
|
|
229
|
+
# 401 no meio do acompanhamento: o token expirou, mas o deploy segue no
|
|
230
|
+
# servidor. Orienta o usuário em vez de estourar um erro seco.
|
|
231
|
+
def session_expired
|
|
232
|
+
error("\nSua sessão expirou durante o acompanhamento. O deploy continua no servidor.")
|
|
233
|
+
info("Rode `jatai login` e acompanhe com `jatai status`.")
|
|
234
|
+
false
|
|
235
|
+
end
|
|
236
|
+
|
|
208
237
|
def status_label(status)
|
|
209
238
|
{ "pending" => "Aguardando...", "provisioning" => "Provisionando...",
|
|
210
239
|
"queued" => "Na fila...", "building" => "Construindo imagem...",
|
data/lib/jatai/version.rb
CHANGED