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
243 stars 42 forks source link

TypeError when auto-promoting Google Play channel with release notes #360

Closed chris-wickens closed 10 months ago

chris-wickens commented 10 months ago

My codemagic pipeline is falling over after setting the new release_promotion configuration to auto-promote internal builds to the alpha channel. I reproduced this locally when running the promote-release command directly.

google-play tracks promote-release --source-track internal --target-track alpha --package-name com.placeholder.dev --release-status completed --verbose
/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
[15:29:22] DEBUG > Create an edit for the package 'com.placeholder.dev'
[15:29:23] DEBUG > Created edit {'id': '10487428624515697734', 'expiryTimeSeconds': '1697732962'} for package 'com.placeholder.dev'
[15:29:23] DEBUG > Get track 'internal' for package 'com.placeholder.dev' using edit 10487428624515697734
[15:29:23] DEBUG > Got track 'internal' for package 'com.placeholder.dev': {'track': 'internal', 'releases': [{'name': '0.1.36', 'versionCodes': ['386'], 'releaseNotes': [{'language': 'en-US', 'text': '* Release notes\n\nwith some new lines'}], 'status': 'completed'}]}
[15:29:23] DEBUG > Delete the edit '10487428624515697734' for the package 'com.placeholder.dev'
[15:29:23] DEBUG > Deleted edit 10487428624515697734 for package 'com.placeholder.dev'
[15:29:23] DEBUG > Create an edit for the package 'com.placeholder.dev'
[15:29:24] DEBUG > Created edit {'id': '13198323921870656191', 'expiryTimeSeconds': '1697732964'} for package 'com.placeholder.dev'
[15:29:24] DEBUG > Get track 'alpha' for package 'com.placeholder.dev' using edit 13198323921870656191
[15:29:24] DEBUG > Got track 'alpha' for package 'com.placeholder.dev': {'track': 'alpha', 'releases': [{'name': '0.1.36', 'versionCodes': ['359'], 'releaseNotes': [{'language': 'en-US', 'text': '* Release notes\n\nwith some new lines'}], 'status': 'completed'}]}
[15:29:24] DEBUG > Delete the edit '13198323921870656191' for the package 'com.placeholder.dev'
[15:29:25] DEBUG > Deleted edit 13198323921870656191 for package 'com.placeholder.dev'
[15:29:25] WARNING > Executing GooglePlay action tracks failed unexpectedly. Detailed logs are available at "/var/folders/cd/l74ls6v54ds9k99wjsrs6hlc0000gn/T/codemagic-19-10-23.log". To see more details about the error, add `--verbose` command line option.

The error in the logs:

[15:29:23 19-10-2023] DEBUG api_client.py:95 > Delete the edit '10487428624515697734' for the package 'com.placeholder.dev'
[15:29:23 19-10-2023] DEBUG api_client.py:102 > Deleted edit 10487428624515697734 for package 'com.placeholder.dev'
[15:29:23 19-10-2023] DEBUG api_client.py:83 > Create an edit for the package 'com.placeholder.dev'
[15:29:24 19-10-2023] DEBUG api_client.py:87 > Created edit {'id': '13198323921870656191', 'expiryTimeSeconds': '1697732964'} for package 'com.placeholder.dev'
[15:29:24 19-10-2023] DEBUG api_client.py:130 > Get track 'alpha' for package 'com.placeholder.dev' using edit 13198323921870656191
[15:29:24 19-10-2023] DEBUG api_client.py:138 > Got track 'alpha' for package 'com.placeholder.dev': {'track': 'alpha', 'releases': [{'name': '0.1.36', 'versionCodes': ['359'], 'releaseNotes': [{'language': 'en-US', 'text': '* Release notes\n\nwith some new lines'}], 'status': 'completed'}]}
[15:29:24 19-10-2023] DEBUG api_client.py:95 > Delete the edit '13198323921870656191' for the package 'com.placeholder.dev'
[15:29:25 19-10-2023] DEBUG api_client.py:102 > Deleted edit 13198323921870656191 for package 'com.placeholder.dev'
[15:29:25 19-10-2023] WARNING cli_app.py:114 > Executing GooglePlay action tracks failed unexpectedly. Detailed logs are available at "/var/folders/cd/l74ls6v54ds9k99wjsrs6hlc0000gn/T/codemagic-19-10-23.log". To see more details about the error, add `--verbose` command line option.
[15:29:25 19-10-2023] ERROR cli_app.py:116 > Exception traceback:
Traceback (most recent call last):
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/cli/cli_app.py", line 206, in invoke_cli
    CliApp._running_app._invoke_action(args)
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/cli/cli_app.py", line 163, in _invoke_action
    return cli_action(**action_args)
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/cli/cli_app.py", line 458, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/tools/google_play/action_groups/tracks_action_group.py", line 124, in promote_release
    release_to_promote = dataclasses.replace(
  File "/Applications/Xcode-15.0.1.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/dataclasses.py", line 1284, in replace
    return obj.__class__(**changes)
  File "<string>", line 10, in __init__
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/google_play/resources/track.py", line 57, in __post_init__
    self.releaseNotes = [LocalizedText(**note) for note in self.releaseNotes]
  File "/Users/chriswickens/Library/Python/3.9/lib/python/site-packages/codemagic/google_play/resources/track.py", line 57, in <listcomp>
    self.releaseNotes = [LocalizedText(**note) for note in self.releaseNotes]
TypeError: codemagic.google_play.resources.track.LocalizedText() argument after ** must be a mapping, not LocalizedText
[15:29:25 19-10-2023] DEBUG cli_app.py:248 > -------------------------------------------------------
[15:29:25 19-10-2023] DEBUG cli_app.py:249 > Completed GooglePlay tracks in 00:03 with status code 9
[15:29:25 19-10-2023] DEBUG cli_app.py:250 > -------------------------------------------------------

Not sure if there's anything unexpected about my release notes. They're pulled from release_notes.json in this format:

[
    {
        "language": "en-US",
        "text": "* Release notes\n\nwith some new lines"
    }
]
priitlatt commented 10 months ago

@chris-wickens thanks for the report. I'll look into it and let you know when the fix is live.

priitlatt commented 10 months ago

@chris-wickens, fix for this is now available in version 0.46.1.

chris-wickens commented 10 months ago

Thanks @priitlatt, that's all working now. Appreciate the quick turnaround!