Patrick-Kladek / Callisto

Parse Clang Static Analyzer messages and pass them to Slack
MIT License
21 stars 3 forks source link

Fastlane error reporting #7

Open schwmi opened 4 years ago

schwmi commented 4 years ago

Currently Callisto is returning with error code 0 if fastlane is crashing. This leads to wrong success reporting on the CI server.

Sample output

[13:45:31]: fastlane finished with errors
--
  |  
  | Looking for related GitHub issues on fastlane/fastlane...
  |  
  | ➡️  macOS unit tests crashing - undefined method `each' for nil:NilClass (NoMethodError)
  | https://github.com/fastlane/fastlane/issues/15905 [open] 2 💬
  | 2 weeks ago
  |  
  | ➡️  [Swift] undefined method `each' for nil:NilClass - Cannot Create Group Within FastlaneSwiftRunner Project
  | https://github.com/fastlane/fastlane/issues/15184 [open] 18 💬
  | a week ago
  |  
  | ➡️  fastlane deliver download_metadata crash
  | https://github.com/fastlane/fastlane/issues/15806 [open] 8 💬
  | 5 days ago
  |  
  | and 168 more at: https://github.com/fastlane/fastlane/search?q=undefined%20method%20%60each%27%20for%20nil&type=Issues&utf8=✓
  |  
  | 🔗  You can ⌘ + double-click on links to open them directly in your browser.
  | bundler: failed to load command: fastlane (/Users/deployment/gems/ruby/2.6.0/bin/fastlane)
  | NoMethodError: [!] undefined method `each' for nil:NilClass
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/scan/lib/scan/runner.rb:35:in `test_app'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/scan/lib/scan/runner.rb:22:in `run'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/scan/lib/scan/manager.rb:23:in `work'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/actions/run_tests.rb:16:in `run'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:261:in `block (2 levels) in execute_action'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:253:in `block in execute_action'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
  | Fastfile:245:in `block (2 levels) in parsing_binding'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
  | /Users/deployment/gems/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
  | /Users/deployment/gems/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
  | /Users/deployment/gems/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
  | /Users/deployment/gems/ruby/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
  | /Users/deployment/gems/ruby/2.6.0/gems/fastlane-2.141.0/bin/fastlane:23:in `<top (required)>'
  | /Users/deployment/gems/ruby/2.6.0/bin/fastlane:23:in `load'
  | /Users/deployment/gems/ruby/2.6.0/bin/fastlane:23:in `<top (required)>'

Results in error code 0

Patrick-Kladek commented 4 years ago

Thats bad :( Unfortunately we can only parse fastlanes output. In the past I searched for something like this Fastlane exited with code: 65 to detect if fastlane stopped. Maybe adding | bundler: failed to load command: fastlane could work here as it's the first line before the stackstrace.

As I do not have access to the build pipeline anymore it will be way faster if you can try this out: FastlaneParser.swift:117 contains a function:

func parseExitedWithError(_ content: String) -> Result<Int, ParserError> {

Can you extend it to check for | bundler: failed to load command: fastlane and then replace the new binary in your repo?

schwmi commented 4 years ago

Thanks for the feedback. I'll have a look on it.