Skip to content

Commit a636302

Browse files
authored
Merge branch 'master' into lk/7.0.1
2 parents c76cfea + 8e47a43 commit a636302

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

fastlane-plugin-firebase_app_distribution.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
1818
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1919
spec.require_paths = ['lib']
2020

21-
spec.add_dependency('google-api-client', '~> 0.38')
2221
spec.add_dependency('google-apis-firebaseappdistribution_v1', '~> 0.3.0')
2322

2423
spec.add_development_dependency('pry')

lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb

+11-5
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ def self.run(params)
2828
app_id = app_id_from_params(params)
2929
app_name = app_name_from_app_id(app_id)
3030
platform = lane_platform || platform_from_app_id(app_id)
31+
timeout = get_upload_timeout(params)
3132

3233
binary_path = get_binary_path(platform, params)
3334
UI.user_error!("Couldn't find binary") if binary_path.nil?
3435
UI.user_error!("Couldn't find binary at path #{binary_path}") unless File.exist?(binary_path)
3536
binary_type = binary_type_from_path(binary_path)
3637

37-
client = init_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])
38+
# TODO(lkellogg): This sets the send timeout for all POST requests made by the client, but
39+
# ideally the timeout should only apply to the binary upload
40+
client = init_client(params[:service_credentials_file],
41+
params[:firebase_cli_token],
42+
params[:debug],
43+
timeout)
3844

39-
# If binary is an AAB, get the AAB info for this app, which includes the integration state and certificate data
45+
# If binary is an AAB, get the AAB info for this app, which includes the integration state
46+
# and certificate data
4047
if binary_type == :AAB
4148
aab_info = get_aab_info(client, app_name)
4249
validate_aab_setup!(aab_info)
4350
end
4451

4552
binary_type = binary_type_from_path(binary_path)
4653
UI.message("⌛ Uploading the #{binary_type}.")
47-
48-
timeout = get_upload_timeout(params)
4954
operation = upload_binary(app_name, binary_path, client, timeout)
5055
release = poll_upload_release_operation(client, operation, binary_type)
5156

@@ -242,12 +247,13 @@ def self.poll_upload_release_operation(client, operation, binary_type)
242247

243248
def self.upload_binary(app_name, binary_path, client, timeout)
244249
options = Google::Apis::RequestOptions.new
245-
options.max_elapsed_time = timeout
250+
options.max_elapsed_time = timeout # includes retries (default = no retries)
246251
options.header = {
247252
'Content-Type' => 'application/octet-stream',
248253
'X-Goog-Upload-File-Name' => File.basename(binary_path),
249254
'X-Goog-Upload-Protocol' => 'raw'
250255
}
256+
251257
# For some reason calling the client.upload_medium returns nil when
252258
# it should return a long running operation object, so we make a
253259
# standard http call instead and convert it to a long running object

lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,18 @@ def group_name(project_number, group_alias)
6565
"#{project_name(project_number)}/groups/#{group_alias}"
6666
end
6767

68-
def init_client(service_credentials_file, firebase_cli_token, debug = false)
68+
def init_client(service_credentials_file, firebase_cli_token, debug, timeout = nil)
6969
if debug
7070
UI.important("Warning: Debug logging enabled. Output may include sensitive information.")
7171
Google::Apis.logger.level = Logger::DEBUG
7272
end
7373

7474
Google::Apis::ClientOptions.default.application_name = "fastlane"
7575
Google::Apis::ClientOptions.default.application_version = Fastlane::FirebaseAppDistribution::VERSION
76+
unless timeout.nil?
77+
Google::Apis::ClientOptions.default.send_timeout_sec = timeout
78+
end
79+
7680
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
7781
client.authorization = get_authorization(service_credentials_file, firebase_cli_token)
7882
client

0 commit comments

Comments
 (0)