fastlane-plugin-bitrise_automation 0.3.0 → 0.3.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: 995f0a752fe79b180ba1fbd4d9f74b8dba9b61946dfc4ae8f0234d5eb9dd1e87
|
4
|
+
data.tar.gz: 7637f6ad20acb0880c3f0c9e3455c86fa058a24788266b56a3c8b7c5b6cac9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06054d6a913718bc2ae33e4705d3238b573fc7a1f6fb0da068c8a41f653d7a53d07ecb4133f67bb20c3c06c4b0abfa2d22aa27a8f67b3617c30c811efdf55505
|
7
|
+
data.tar.gz: 6b68a62d4ed134d5619bdc9021c9cf516aac6d4b3079f9b767a36e3896a2e8e29273b0cec9872b7f4b4b601b897dc2ad3e15bb640e215cca703bd3757a222628
|
data/README.md
CHANGED
@@ -25,6 +25,7 @@ This plugin assumes you already have an app configured on Bitrise and uses a Per
|
|
25
25
|
- Check build success/failure (exiting with success or failure according to the status on Bitrise)
|
26
26
|
- Retrieve the list of artifacts from a build
|
27
27
|
- Download the artifacts produced by a build
|
28
|
+
- Automatic retry of requests when the connection to the Bitrise API fails or returns a 5xx error
|
28
29
|
|
29
30
|
### Known issues
|
30
31
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/bitrise_automation_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class InterruptAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
begin
|
9
|
+
UI.message("Test interrupt - sleeping")
|
10
|
+
sleep(60)
|
11
|
+
rescue Interrupt => e
|
12
|
+
UI.message("interrupted")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.description
|
17
|
+
"Trigger a Bitrise workflow with the specified parameters, synchronously or asynchronously"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.authors
|
21
|
+
["Mario Cecchi", "Henrique Alves"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.return_value
|
25
|
+
"Returns the information of the Bitrise build"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_options
|
29
|
+
[
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.is_supported?(platform)
|
34
|
+
true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -5,6 +5,7 @@ module Fastlane
|
|
5
5
|
|
6
6
|
module Helper
|
7
7
|
class BitriseRequestHelper
|
8
|
+
MAX_RETRY_ATTEMPTS = 2
|
8
9
|
class << self
|
9
10
|
def get(params, path)
|
10
11
|
request = Net::HTTP::Get.new("/v0.1/apps/#{params[:app_slug]}/#{path}", bitrise_headers(params[:access_token]))
|
@@ -14,7 +15,7 @@ module Fastlane
|
|
14
15
|
def post(params, path, body)
|
15
16
|
request = Net::HTTP::Post.new("/v0.1/apps/#{params[:app_slug]}/#{path}", bitrise_headers(params[:access_token]))
|
16
17
|
request.body = body
|
17
|
-
|
18
|
+
request_with_retries(request)
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
@@ -29,6 +30,29 @@ module Fastlane
|
|
29
30
|
def bitrise_headers(access_token)
|
30
31
|
{ 'Content-Type' => 'application/json', 'Authorization' => access_token }
|
31
32
|
end
|
33
|
+
|
34
|
+
def request_with_retries(request)
|
35
|
+
retries = 0
|
36
|
+
begin
|
37
|
+
response = bitrise_client.request(request)
|
38
|
+
if response.code.start_with?("5")
|
39
|
+
UI.error("Bitrise returned a server-side error. Status code: #{response.code}. #{response}")
|
40
|
+
raise "Bitrise API error: #{response.code}"
|
41
|
+
end
|
42
|
+
rescue StandardError => e
|
43
|
+
UI.error("There was an error making the request to Bitrise (retries: #{retries}). #{e}")
|
44
|
+
if retries < MAX_RETRY_ATTEMPTS
|
45
|
+
retries += 1
|
46
|
+
sleep(15)
|
47
|
+
UI.error("Retrying request (attempt #{retries})")
|
48
|
+
retry
|
49
|
+
else
|
50
|
+
UI.error("All retry attempts failed.")
|
51
|
+
raise e
|
52
|
+
end
|
53
|
+
end
|
54
|
+
response
|
55
|
+
end
|
32
56
|
end
|
33
57
|
end
|
34
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-bitrise_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Cecchi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/fastlane/plugin/bitrise_automation.rb
|
148
148
|
- lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_artifacts_action.rb
|
149
149
|
- lib/fastlane/plugin/bitrise_automation/actions/bitrise_build_status_action.rb
|
150
|
+
- lib/fastlane/plugin/bitrise_automation/actions/interrupt_action.rb
|
150
151
|
- lib/fastlane/plugin/bitrise_automation/actions/trigger_bitrise_workflow_action.rb
|
151
152
|
- lib/fastlane/plugin/bitrise_automation/helper/bitrise_automation_helper.rb
|
152
153
|
- lib/fastlane/plugin/bitrise_automation/version.rb
|