Skip to content

Commit e2c7bd8

Browse files
authored
Merge pull request #201 from fastlane/lk/raise-on-timeout
Exit with a non-zero status code if upload does not finish
2 parents 0bfc1a2 + 739a14c commit e2c7bd8

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

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

-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ def self.run(params)
3333
app_view = binary_type == :AAB ? 'FULL' : 'BASIC'
3434
app = fad_api_client.get_app(app_id, app_view)
3535
validate_app!(app, binary_type)
36-
3736
release_id = fad_api_client.upload(app.project_number, app_id, binary_path, platform.to_s)
38-
if release_id.nil?
39-
return
40-
end
4137

4238
if binary_type == :AAB && app.aab_certificate.empty?
4339
updated_app = fad_api_client.get_app(app_id)

lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ def upload_binary(app_id, binary_path, platform)
127127
# app_id - Firebase app ID
128128
# binary_path - Absolute path to your app's aab/apk/ipa file
129129
#
130-
# Returns the release_id on a successful release, otherwise returns nil.
130+
# Returns the release_id of the uploaded release.
131131
#
132-
# Throws a UI error if the number of polling retries exceeds MAX_POLLING_RETRIES
133-
# Crashes if not able to upload the binary
132+
# Crashes if the number of polling retries exceeds MAX_POLLING_RETRIES or if the binary cannot
133+
# be uploaded.
134134
def upload(project_number, app_id, binary_path, platform)
135135
binary_type = binary_type_from_path(binary_path)
136136

@@ -159,8 +159,7 @@ def upload(project_number, app_id, binary_path, platform)
159159
end
160160
end
161161
unless upload_status_response.success?
162-
UI.error("It took longer than expected to process your #{binary_type}, please try again.")
163-
return nil
162+
UI.crash!("It took longer than expected to process your #{binary_type}, please try again.")
164163
end
165164
end
166165
upload_status_response.release_id

spec/firebase_app_distribution_api_client_spec.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
expect(release_id).to eq("release_id")
204204
end
205205

206-
it 'returns nil after polling MAX_POLLING_RETRIES times' do
206+
it 'raises an error after polling MAX_POLLING_RETRIES times' do
207207
max_polling_retries = 2
208208
stub_const("Fastlane::Client::FirebaseAppDistributionApiClient::MAX_POLLING_RETRIES", max_polling_retries)
209209

@@ -217,8 +217,9 @@
217217
.and_return(upload_status_response_in_progress)
218218
.exactly(max_polling_retries).times
219219

220-
release_id = api_client.upload("project_number", "app_id", fake_binary_path, "android")
221-
expect(release_id).to be_nil
220+
expect do
221+
api_client.upload("project_number", "app_id", fake_binary_path, "android")
222+
end.to raise_error
222223
end
223224

224225
it 'uploads the app binary once then polls until success' do

0 commit comments

Comments
 (0)