release-toolkit icon indicating copy to clipboard operation
release-toolkit copied to clipboard

Raise error if pinned hash from `.configure` file is not found

Open mokagio opened this issue 3 years ago • 4 comments

I just run into this edge case while attempting to update a repository.

bundle exec run configure_update crashed on me because it tried to compare nil and a number with >=.

The nil value was the result of looking for the index of the pinned commit in .configure in the .mobile-secrets repository.

I believe that occurred because, when prompted

[13:24:11]: The current branch is 2 commit(s) behind. Would you like to update it? (y/n)

I selected no, resulting in my local copy of .mobile-secrets to be two commits out of date.

For the record, I selected n because I interpreted the prompt as a suggestion to update the pinned has in .configure, not the .mobile-secrets repository. The messages to STDOUT from the tool's internal made me think it already pulled the repo.

Regardless of how I ended up in that inconsistent state, I think this early failure and error message would have helped me.

For reference, below is the stacktrace:

(/path/to/repo/vendor/bundle/ruby/2.7.0/bin/fastlane) Traceback (most
recent call last):
[...]
8: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-2.210.0/fastlane/lib/fastlane/runner.rb:229:in
`execute_action'
7: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-2.210.0/fastlane/lib/fastlane/runner.rb:229:in
`chdir'
6: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-2.210.0/fastlane/lib/fastlane/runner.rb:255:in
`block in execute_action'
5: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-2.210.0/fastlane/lib/fastlane/actions/actions_helper.rb:69:in
`execute_action'
4: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-2.210.0/fastlane/lib/fastlane/runner.rb:263:in
`block (2 levels) in execute_action'
3: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-wpmreleasetoolkit-5.4.0/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb:20:in
`run'
2: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-wpmreleasetoolkit-5.4.0/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb:94:in
`configure_file_is_behind_repo'
1: from
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-wpmreleasetoolkit-5.4.0/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb:98:in
`configure_file_is_behind_local'
/path/to/repo/vendor/bundle/ruby/2.7.0/gems/fastlane-plugin-wpmreleasetoolkit-5.4.0/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb:109:in
`configure_file_commits_behind_repo': \e[31m[!] undefined method `>=' for
nil:NilClass\e[0m (NoMethodError)

mokagio avatar Sep 20 '22 03:09 mokagio

For the record, I selected n because I interpreted the prompt as a suggestion to update the pinned has in .configure, not the .mobile-secrets repository. The messages to STDOUT from the tool's internal made me think it already pulled the repo.

To be honest, the configure tool has always confused me a lot in terms of its terminology, commands and log messages / prompts. I never remember which of the subcommands do what (update, apply, etc) in which direction (encrypt secrets from mobile-secrets into .enc files in repo? Copy secrets from mobile-secrets raw for immediate local consumption? Decrypt .enc files?), nor what the prompts shown by the tool really mean ("Would you like to update [something unclear about what it will update and in which direction]?".

I'd really love if we could make some improvement in the self-documentation and log messages of this tool at some point, to avoid a lot of confusion around it 😓

AliSoftware avatar Sep 20 '22 11:09 AliSoftware

@mokagio, somehow this is still sitting on my review list?

Figured I'd bump it :)

jkmassel avatar Sep 24 '24 16:09 jkmassel