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

Notarization - Printing log on error #21609

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions fastlane/lib/fastlane/actions/notarize.rb
Expand Up @@ -85,9 +85,9 @@ def self.notarytool(params, package_path, bundle_id, skip_stapling, print_log, v
notarization_info = JSON.parse(submit_response)

# Staple
submission_id = notarization_info["id"]
case notarization_info['status']
when 'Accepted'
submission_id = notarization_info["id"]
UI.success("Successfully uploaded package to notarization service with request identifier #{submission_id}")

if skip_stapling
Expand All @@ -100,7 +100,22 @@ def self.notarytool(params, package_path, bundle_id, skip_stapling, print_log, v
UI.success("Successfully notarized and stapled package")
end
when 'Invalid'
UI.user_error!("Could not notarize package with message '#{notarization_info['statusSummary']}'")
if submission_id && print_log
log_request_parts = [
"xcrun notarytool log #{submission_id}"
] + auth_parts
log_request_command = log_request_parts.join(' ')
log_request_response = Actions.sh(
log_request_command,
log: verbose,
error_callback: lambda { |msg|
UI.error("Error requesting the notarization log: #{msg}")
}
)
UI.user_error!("Could not notarize package with message '#{log_request_response}'")
else
UI.user_error!("Could not notarize package. To see the error, please set 'print_log' to true.")
end
else
UI.crash!("Could not notarize package with status '#{notarization_info['status']}'")
end
Expand Down
2 changes: 1 addition & 1 deletion fastlane/spec/actions_specs/notarize_spec.rb
Expand Up @@ -108,7 +108,7 @@
asc_provider: '#{asc_provider}',
)
end").runner.execute(:test)
end.to raise_error(FastlaneCore::Interface::FastlaneError, "Could not notarize package with message 'Archive contains critical validation errors'")
end.to raise_error(FastlaneCore::Interface::FastlaneError, "Could not notarize package. To see the error, please set 'print_log' to true.")
end
end
end
Expand Down