Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fastlane-core] recommends to retry uploading when AltoolTransporterExecutor crashes #21536

Merged
3 changes: 3 additions & 0 deletions fastlane_core/lib/fastlane_core/itunes_transporter.rb
Expand Up @@ -215,6 +215,8 @@ class AltoolTransporterExecutor < TransporterExecutor

private_constant :ERROR_REGEX

attr_reader :errors
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems safe, it makes testing the specific error line we're adding for the -1 return more straightforward


def execute(command, hide_output)
if Helper.test?
yield(nil) if block_given?
Expand Down Expand Up @@ -244,6 +246,7 @@ def execute(command, hide_output)
end

@errors << "The call to the altool completed with a non-zero exit status: #{exit_status}. This indicates a failure." unless exit_status.zero?
TheMetalCode marked this conversation as resolved.
Show resolved Hide resolved
@errors << "-1 indicates altool exited abnormally; try retrying (see https://github.com/fastlane/fastlane/issues/21535)" if exit_status == -1

unless @errors.empty? || @all_lines.empty?
# Print the last lines that appear after the last error from the logs
Expand Down
17 changes: 17 additions & 0 deletions fastlane_core/spec/itunes_transporter_spec.rb
Expand Up @@ -1396,4 +1396,21 @@ def xcrun_download_command(provider_short_name = nil, jwt: nil)
end
end
end

describe FastlaneCore::AltoolTransporterExecutor do
let(:upload_cmd) { "xcrun altool --upload-app --apiKey #{api_key[:key_id]} --apiIssuer #{api_key[:issuer_id]} -t macos -f /tmp/my.app.id.itmsp -k 100000" }
let(:instance) { described_class.new }
describe "#execute" do
it "logs specific info about altool crash if exit code is -1" do
# remove test behavior, we actually want FastlanePty.spawn to be called here
allow(FastlaneCore::Helper).to receive(:test?).and_return(false)
# force the nil return of FastlanePty.spawn
allow(FastlaneCore::FastlanePty).to receive(:spawn).and_return(-1)
expect(instance.execute(upload_cmd, false)).to eq(false)
expect(instance.errors).to include(
"-1 indicates altool exited abnormally; try retrying (see https://github.com/fastlane/fastlane/issues/21535)"
)
end
end
end
end