Skip to content

Commit

Permalink
[actions] Notarization - Printing log on error (#21609)
Browse files Browse the repository at this point in the history
* Notarization - Printing log on error

* Notarization - Printing log on error

* Notarization - Printing log on error

* Notarization - Printing log on error

* Notarization - Printing log on error

* Notarization - Printing log on error
  • Loading branch information
szigetics committed Nov 11, 2023
1 parent 30b67fe commit 5017060
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
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

0 comments on commit 5017060

Please sign in to comment.