codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
265 stars 42 forks source link

Bugfix: review submission creation error handling #236

Closed priitlatt closed 2 years ago

priitlatt commented 2 years ago

Action app-store-connect builds submit-to-app-store relies on creating ReviewSubmission resource for Build on App Store Connect.

As there can only be one review submission associated with any single build, then there is a graceful error handling for review submission creation that checks whether the creation request failed with error saying there already exists review submission for this build.

The check for such error is faulty as it does not check whether such an error exists, but rather whether there are any errors at all. And then None value is possibly treated as a re.Match instance. Stacktrace:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/codemagic/tools/_app_store_connect/action_groups/builds_action_group.py" line 215 in submit_to_app_store [args] [locals]
    return self._submit_to_app_store(
File "/usr/local/lib/python3.8/site-packages/codemagic/tools/_app_store_connect/action_groups/builds_action_group.py" line 259 in _submit_to_app_store [args] [locals]
    review_submission = self._create_review_submission(app, platform)
File "/usr/local/lib/python3.8/site-packages/codemagic/tools/_app_store_connect/action_groups/builds_action_group.py" line 290 in _create_review_submission [args] [locals]
    existing_review_submission_id = ResourceId(existing_submission_matches[0].group(1))
AttributeError: 'NoneType' object has no attribute 'group'

To fix it, find first error whose message matches the predefined pattern and use that one to obtain the existing review submission, or fail the action normally with AppStoreConnectError as expected.

Updated actions