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 @@ -243,6 +243,9 @@ def execute(command, hide_output)
@errors << ex.to_s
end

# if FastlanePty.spawn returns nil exit code for whatever reason, force it to -1
exit_status = -1 unless exit_status

@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

unless @errors.empty? || @all_lines.empty?
Expand Down
14 changes: 14 additions & 0 deletions fastlane_core/spec/itunes_transporter_spec.rb
Expand Up @@ -1396,4 +1396,18 @@ 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" }

describe "#execute" do
it "reverts to -1 exit code if altool exits early with no exit code" 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(nil)
expect(described_class.new.execute(upload_cmd, false)).to eq(false)
end
end
end
end