xotahal / fastlane-plugin-semantic_release

Fully automated version management and generator of release notes
MIT License
213 stars 59 forks source link

analyze_commits throws a non-zero error code #15

Closed SpaghettiC0des closed 4 years ago

SpaghettiC0des commented 4 years ago
185 +------+------------------+-------------+
186 |           fastlane summary            |
187 +------+------------------+-------------+
188 | Step | Action           | Time (in s) |
189 +------+------------------+-------------+
190 | 1    | default_platform | 0           |
191 | 💥   | analyze_commits  | 0           |
192 +------+------------------+-------------+
193 ERROR [2019-11-25 20:53:18.97]: fastlane finished with errors
194 Looking for related GitHub issues on fastlane/fastlane...
195 Search query: Shell command exited with exit status 127 instead of 0.
xotahal commented 4 years ago

Ok mate, I probably need you to provide more information :)

kdbcinco-cs commented 4 years ago

We are running fastlane through GitLab's CI/CD. This is the stacktrace

[12:57:49]: Tag was not found for match pattern - android/alpha*
133 [12:57:49]: First commit of the branch is taken as a begining of next release
134 +------------------+---------------+
135 |           Lane Context           |
136 +------------------+---------------+
137 | DEFAULT_PLATFORM | android       |
138 | PLATFORM_NAME    | android       |
139 | LANE_NAME        | android alpha |
140 +------------------+---------------+
141 [12:57:49]: Shell command exited with exit status 127 instead of 0.
142 +------+------------------+-------------+
143 |           fastlane summary            |
144 +------+------------------+-------------+
145 | Step | Action           | Time (in s) |
146 +------+------------------+-------------+
147 | 1    | default_platform | 0           |
148 | 💥   | analyze_commits  | 0           |
149 +------+------------------+-------------+
150 [12:57:49]: fastlane finished with errors
151 Looking for related GitHub issues on fastlane/fastlane...
152 ➡️  Increment build number
153     https://github.com/fastlane/fastlane/pull/127 [closed] 2 💬
154     04 Feb 2017
155 ➡️  Instead of FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD, fastlane asks for FASTLANE_PASSWORD
156     https://github.com/fastlane/fastlane/issues/15038 [closed] 2 💬
157     21 Sep 2019
158 ➡️  Can't upload Android app to Crashlytics Beta
159     https://github.com/fastlane/fastlane/issues/9389 [closed] 25 💬
160     23 Jul 2018
161 and 7 more at: https://github.com/fastlane/fastlane/search?q=Shell%20command%20exited%20with%20exit%20status%20127%20instead%20of%200.&type=Issues&utf8=✓
162 🔗  You can ⌘ + double-click on links to open them directly in your browser.
163 +------------------+--------------+----------------+
164 |             Plugin updates available             |
165 +------------------+--------------+----------------+
166 | Plugin           | Your Version | Latest Version |
167 +------------------+--------------+----------------+
168 | semantic_release | 1.1.6        | 1.7.0          |
169 +------------------+--------------+----------------+
170 [12:57:51]: To update all plugins, just run
171 [12:57:51]: $ bundle exec fastlane update_plugins
172 bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
173 FastlaneCore::Interface::FastlaneShellError: [!] Shell command exited with exit status 127 instead of 0.
174   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!'
175   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
176   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
177   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:in `sh'
178   /Library/Ruby/Gems/2.3.0/gems/fastlane-plugin-semantic_release-1.1.6/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb:13:in `git_log'
179   /Library/Ruby/Gems/2.3.0/gems/fastlane-plugin-semantic_release-1.1.6/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb:33:in `get_commits_from_hash'
180   /Library/Ruby/Gems/2.3.0/gems/fastlane-plugin-semantic_release-1.1.6/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb:73:in `run'
181   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:256:in `block (2 levels) in execute_action'
182   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
183   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:235:in `block in execute_action'
184   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
185   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
186   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
187   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
188   Fastfile:20:in `publishTo'
189   Fastfile:65:in `block (2 levels) in parsing_binding'
190   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/lane.rb:33:in `call'
191   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
192   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
193   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
194   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
195   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
196   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
197   /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
198   /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
199   /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
200   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
201   /Library/Ruby/Gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
202   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
203   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
204   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
205   /Library/Ruby/Gems/2.3.0/gems/fastlane-2.137.0/bin/fastlane:23:in `<top (required)>'
206   /usr/local/bin/fastlane:22:in `load'
207   /usr/local/bin/fastlane:22:in `<top (required)>'
211 ERROR: Job failed: exit status 1
xotahal commented 4 years ago
  1. Update plugin to the latest version (but that probably won't help - nothing was changed in that part of the code)

  2. can you try to run this against the repo (as a start use hash of the commit you want to release) - git log --pretty='%s|%b|>' --reverse #{start}..HEAD

How many commits do you have on the repo? Seems it is a first run of the plugin against it

kdbcinco-cs commented 4 years ago

Hi there. We traced it earlier and found out that the value we get from start are multiple commit hashes, separated by newlines which we found out, is being output by git rev-list --max-parents=0 HEAD. This is somewhere on is_codepush_friendly and get_commits_from_hash. This causes the command to be run as:

git log --pretty='%s|%b|>' --reverse commithash
anothercommithash..HEAD

Resulting into 127 error code (command not found) as it tries to run anothercommithash..HEAD because of the newline.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Jiří Otáhal notifications@github.com Sent: Wednesday, November 27, 2019 6:45:12 AM To: xotahal/fastlane-plugin-semantic_release fastlane-plugin-semantic_release@noreply.github.com Cc: Dominick Cinco dominick@compassstarltd.com; Comment comment@noreply.github.com Subject: Re: [xotahal/fastlane-plugin-semantic_release] analyze_commits throws a non-zero error code (#15)

  1. Update plugin to the latest version (but that probably won't help - nothing was changed in that part of the code)

  2. can you try to run this against the repo (as a start use hash of the commit you want to release) - git log --pretty='%s|%b|>' --reverse #{start}..HEAD

How many commits do you have on the repo? Seems it is a first run of the plugin against it

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/xotahal/fastlane-plugin-semantic_release/issues/15?email_source=notifications&email_token=AK3H5ORXZV6GKAVS5UU44QTQVWRHRA5CNFSM4JRMOQK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFHV57A#issuecomment-558849788, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK3H5OWL2OHL7PHAM6TCIRTQVWRHRANCNFSM4JRMOQKQ.

SpaghettiC0des commented 4 years ago

Hi @xotahal, any updates on this? I temporarily patched it using my PR, but I don't think this is the right fix.

lucasmpaim commented 4 years ago

+1

xotahal commented 4 years ago

I'll try to have a look at this during weekend guys ...

xotahal commented 4 years ago

See - https://github.com/xotahal/fastlane-plugin-semantic_release/pull/18

It is fixed in 1.9.1

lucasmpaim commented 4 years ago

@xotahal I have updated the plugin and this error persists

+-------------------------------------------+---------+---------------------------+
|                                  Used plugins                                   |
+-------------------------------------------+---------+---------------------------+
| Plugin                                    | Version | Action                    |
+-------------------------------------------+---------+---------------------------+
| fastlane-plugin-semantic_release          | 1.9.1   | conventional_changelog    |
|                                           |         | analyze_commits           |
🔗  You can ⌘ + double-click on links to open them directly in your browser.
bundler: failed to load command: fastlane (/Users/vagrant/.rbenv/versions/2.6.5/bin/fastlane)
FastlaneCore::Interface::FastlaneShellError: [!] Shell command exited with exit status 127 instead of 0.
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/helper/sh_helper.rb:12:in `sh'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-plugin-semantic_release-1.9.1/lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb:13:in `git_log'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-plugin-semantic_release-1.9.1/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb:34:in `get_commits_from_hash'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-plugin-semantic_release-1.9.1/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb:84:in `is_releasable'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-plugin-semantic_release-1.9.1/lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb:200:in `run'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:261:in `block (2 levels) in execute_action'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:253:in `block in execute_action'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
  Fastfile:236:in `block (2 levels) in parsing_binding'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:204:in `try_switch_to_lane'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:146:in `trigger_action_by_name'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
  Fastfile:226:in `block (2 levels) in parsing_binding'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:204:in `try_switch_to_lane'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:146:in `trigger_action_by_name'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
  Fastfile:55:in `block (2 levels) in parsing_binding'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/lane.rb:33:in `call'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
  /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fastlane-2.142.0/bin/fastlane:23:in `<top (required)>'
  /Users/vagrant/.rbenv/versions/2.6.5/bin/fastlane:23:in `load'
  /Users/vagrant/.rbenv/versions/2.6.5/bin/fastlane:23:in `<top (required)>'
xotahal commented 4 years ago

@lucasmpaim Can you please send debug parameter to action and post the log over here?

lucasmpaim commented 4 years ago

Sure:

Run Fastlane
$ bundle "_1.17.2_" "exec" "fastlane" "dev_firebase"
+-------------------------------------------+---------+---------------------------+
|                                  Used plugins                                   |
+-------------------------------------------+---------+---------------------------+
| Plugin                                    | Version | Action                    |
+-------------------------------------------+---------+---------------------------+
| fastlane-plugin-semantic_release          | 1.9.1   | conventional_changelog    |
|                                           |         | analyze_commits           |
| fastlane-plugin-firebase_app_distribution | 0.1.4   | firebase_app_distribution |
+-------------------------------------------+---------+---------------------------+
....run some lanes (prepare release with pod install, and another frameworks that I use)
+-------------------------------------------+---------+---------------------------+

[10:50:41]: -----------------------------
[10:50:41]: --- Step: analyze_commits ---
[10:50:41]: -----------------------------
[10:50:41]: $ git describe --tags --match=dev*
[10:50:41]: ▸ fatal: No names found, cannot describe anything.
[10:50:41]: Tag was not found for match pattern - dev*
[10:50:41]: First commit of the branch is taken as a begining of next release
[10:50:41]: $ git rev-list --max-parents=0 HEAD
[10:50:41]: ▸ d28d63431d999a26370fecd59fbdeeff0d60065a
[10:50:41]: ▸ dabc3f27d19bd15a038f318d2b97b800538c041e
[10:50:41]: $ git log --pretty='%s|%b|>' --reverse d28d63431d999a26370fecd59fbdeeff0d60065a
dabc3f27d19bd15a038f318d2b97b800538c041e..HEAD
[10:50:41]: ▸ Add README.md||>
[10:50:41]: ▸ sh: line 1: dabc3f27d19bd15a038f318d2b97b800538c041e..HEAD: command not found
+------------------+------------------+
|            Lane Context             |
+------------------+------------------+
| DEFAULT_PLATFORM | ios              |
| PLATFORM_NAME    | ios              |
| LANE_NAME        | ios dev_firebase |
+------------------+------------------+
[10:50:41]: Exit status of command 'git log --pretty='%s|%b|>' --reverse d28d63431d999a26370fecd59fbdeeff0d60065a
dabc3f27d19bd15a038f318d2b97b800538c041e..HEAD' was 127 instead of 0.
Add README.md||>
sh: line 1: dabc3f27d19bd15a038f318d2b97b800538c041e..HEAD: command not found
lucasmpaim commented 4 years ago

I think the first problem is here:

[10:50:41]: $ git describe --tags --match=dev*
[10:50:41]: ▸ fatal: No names found, cannot describe anything.

I have a lot of tag's that match with this pattern, published by the plugin, but get some time that I not send a new release of this branch, maybe, the problem is the fetch is not deep enough to found them.

Captura de Tela 2020-03-04 às 07 59 39
lucasmpaim commented 4 years ago

Adding

git fetch --all --tags;

before execute lanes, this error not occurs anymore, this is just an fetch not deep enough

xotahal commented 4 years ago

@lucasmpaim Yes, I commented that here - https://github.com/xotahal/fastlane-plugin-semantic_release/pull/18

We very often fetch only part of history (or no tags) on our CD systems. Then it is a problem for this plugin because it analyzes history of git.