fastlane-plugin-appcircle_testing_distribution 0.4.3.beta.3 → 0.5.0.beta.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83c9d8655326e41c07f7b6d927fb63441c01059e2c29c2658338931c5a2ae718
|
|
4
|
+
data.tar.gz: fc194ce33b458182af4725f5e21b525666c9cab85cc41b9c5a2d29444251488d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a0568378f254b846f291bc6dc9bb0b149b8590f8945fa521f91d670eca5bca37818af392cf9028cc3580ff6bb92ad6cb07a5c606e016b7a0da07fac215bf1a4
|
|
7
|
+
data.tar.gz: 4a64eab748b2a2163b464ac87793982687940e8c9df4cb1ca8ca7501f42e7d91472b91c66eb627b0fa07fb7bb2b8bb7f77bae07608bb6b866d04737f7defda10
|
|
@@ -8,6 +8,29 @@ BASE_URL = "https://api.appcircle.io"
|
|
|
8
8
|
module TDUploadService
|
|
9
9
|
UI = FastlaneCore::UI
|
|
10
10
|
|
|
11
|
+
def self.put_with_retry(url, body, headers, max_retries: 5)
|
|
12
|
+
attempt = 0
|
|
13
|
+
delay = 1.0
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
RestClient.put(url, body, headers)
|
|
17
|
+
rescue => e
|
|
18
|
+
status = e.respond_to?(:http_code) ? e.http_code : nil
|
|
19
|
+
retryable = status == 503 ||
|
|
20
|
+
e.is_a?(RestClient::ServerBrokeConnection) ||
|
|
21
|
+
e.is_a?(Errno::ECONNRESET) ||
|
|
22
|
+
(defined?(RestClient::Exceptions::OpenTimeout) && e.is_a?(RestClient::Exceptions::OpenTimeout)) ||
|
|
23
|
+
(defined?(RestClient::Exceptions::ReadTimeout) && e.is_a?(RestClient::Exceptions::ReadTimeout))
|
|
24
|
+
|
|
25
|
+
raise e if !retryable || attempt >= max_retries
|
|
26
|
+
|
|
27
|
+
attempt += 1
|
|
28
|
+
sleep(delay + rand(0.3))
|
|
29
|
+
delay *= 2
|
|
30
|
+
retry
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
11
34
|
def self.upload_artifact(token:, message:, app:, dist_profile_id:, api_endpoint: BASE_URL)
|
|
12
35
|
file_path = app
|
|
13
36
|
file_name = File.basename(file_path)
|
|
@@ -38,14 +61,25 @@ module TDUploadService
|
|
|
38
61
|
end
|
|
39
62
|
file_id = upload_info['fileId']
|
|
40
63
|
upload_url = upload_info['uploadUrl']
|
|
64
|
+
configuration = upload_info['configuration']
|
|
65
|
+
http_method = (configuration && configuration['httpMethod']) ? configuration['httpMethod'].to_s.upcase : 'PUT'
|
|
41
66
|
|
|
42
|
-
file_content = File.binread(file_path)
|
|
43
67
|
UI.message("Uploading file to Appcircle...")
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
68
|
+
if http_method == 'POST'
|
|
69
|
+
sign_parameters = configuration['signParameters'] || {}
|
|
70
|
+
payload = {}
|
|
71
|
+
sign_parameters.each { |key, value| payload[key] = value }
|
|
72
|
+
payload['file'] = File.new(file_path, 'rb')
|
|
73
|
+
response = RestClient.post(upload_url, payload)
|
|
74
|
+
else
|
|
75
|
+
file_content = File.binread(file_path)
|
|
76
|
+
response = put_with_retry(
|
|
77
|
+
upload_url,
|
|
78
|
+
file_content,
|
|
79
|
+
{ content_type: 'application/octet-stream' }
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
49
83
|
if response.code.between?(200, 299)
|
|
50
84
|
UI.success("File upload finished successfully with status code: #{response.code}")
|
|
51
85
|
else
|