fastlane/lib/fastlane/actions/testfairy.rb in fastlane-2.108.0 vs fastlane/lib/fastlane/actions/testfairy.rb in fastlane-2.109.0
- old
+ new
@@ -3,11 +3,11 @@
module SharedValues
TESTFAIRY_BUILD_URL = :TESTFAIRY_BUILD_URL
end
class TestfairyAction < Action
- def self.upload_build(upload_url, ipa, options)
+ def self.upload_build(upload_url, ipa, options, timeout)
require 'faraday'
require 'faraday_middleware'
UI.success("Uploading to #{upload_url}...")
@@ -27,10 +27,11 @@
options[:symbols_file] = Faraday::UploadIO.new(symbols_file, 'application/octet-stream')
end
begin
connection.post do |req|
+ req.options.timeout = timeout
req.url("/api/upload/")
req.body = options
end
rescue Faraday::Error::TimeoutError
UI.crash!("Uploading build to TestFairy timed out ⏳")
@@ -64,13 +65,13 @@
UI.user_error!("Unknown option: #{option}")
end
end
end
- # Rejecting key `upload_url` as we don't need it in options
+ # Rejecting key `upload_url` and `timeout` as we don't need it in options
client_options = Hash[params.values.reject do |key, value|
- key == :upload_url
+ [:upload_url, :timeout].include?(key)
end.map do |key, value|
case key
when :api_key
[key, value]
when :ipa
@@ -99,11 +100,11 @@
path = params[:ipa] || params[:apk]
UI.user_error!("No ipa or apk were given") unless path
return path if Helper.test?
- response = self.upload_build(params[:upload_url], path, client_options)
+ response = self.upload_build(params[:upload_url], path, client_options, params[:timeout])
if parse_response(response)
UI.success("Build URL: #{Actions.lane_context[SharedValues::TESTFAIRY_BUILD_URL]}")
UI.success("Build successfully uploaded to TestFairy.")
else
UI.user_error!("Error when trying to upload ipa to TestFairy")
@@ -219,10 +220,15 @@
FastlaneCore::ConfigItem.new(key: :options,
optional: true,
type: Array,
env_name: "FL_TESTFAIRY_OPTIONS",
description: "Array of options (shake,video_only_wifi,anonymous)",
- default_value: [])
+ default_value: []),
+ FastlaneCore::ConfigItem.new(key: :timeout,
+ env_name: "FL_TESTFAIRY_TIMEOUT",
+ description: "Request timeout in seconds",
+ type: Integer,
+ optional: true)
]
end
def self.example_code
[