Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Address issues in android-keystore tool #210

Merged
merged 3 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Version 0.22.3
-------------

This is a bugfix release from [PR #210](https://github.com/codemagic-ci-cd/cli-tools/pull/210) to fix problems with tool `android-keystore` that was first added in [version 0.21.0](https://github.com/codemagic-ci-cd/cli-tools/releases/tag/v0.21.0).

**Improvements**
- Use better error message for keystore validation in case non-keystore file is passed for validation.

**Fixes**
- Fix debug keystore creation using action `android-keystore create-debug-keysotre`. It was using invalid keyword argument to specify keystore path.
- Make keystore path argument `--keystore` required for `android-keystore create` and `android-keystore verify` actions.

Version 0.22.2
-------------

Expand Down
2 changes: 1 addition & 1 deletion src/codemagic/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'codemagic-cli-tools'
__description__ = 'CLI tools used in Codemagic builds'
__version__ = '0.22.2'
__version__ = '0.22.3'
__url__ = 'https://github.com/codemagic-ci-cd/cli-tools'
__licence__ = 'GNU General Public License v3.0'
5 changes: 3 additions & 2 deletions src/codemagic/shell_tools/keytool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shlex
import subprocess

from codemagic.models import Keystore
Expand Down Expand Up @@ -62,10 +61,12 @@ def validate_keystore(self, keystore: Keystore):
except subprocess.CalledProcessError as cpe:
stdout = self._str(cpe.stdout)
if f'<{keystore.key_alias}> does not exist' in stdout:
raise ValueError(f'Alias {shlex.quote(keystore.key_alias)} does not exist in keystore') from cpe
raise ValueError(f'Alias "{keystore.key_alias}" does not exist in keystore') from cpe
elif 'keystore password was incorrect' in stdout:
raise ValueError('Invalid keystore password') from cpe
elif 'file does not exist' in stdout:
raise ValueError('Keystore does not exist') from cpe
elif 'Unrecognized keystore format' in stdout:
raise ValueError('Unrecognized keystore format') from cpe
else:
raise ValueError(stdout.strip()) from cpe
2 changes: 1 addition & 1 deletion src/codemagic/tools/android_keystore/android_keystore.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def create_debug_keystore(
return self.create(
keystore_path=pathlib.Path('~/.android/debug.keystore').expanduser(),
key_alias='androiddebugkey',
store_password='android',
keystore_password='android',
issuer_common_name='Android Debug',
issuer_organization='Android',
issuer_country='US',
Expand Down
1 change: 1 addition & 0 deletions src/codemagic/tools/android_keystore/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AndroidKeystoreArgument(cli.Argument):
flags=('-k', '--ks', '--keystore'),
type=pathlib.Path,
description='Path where your keystore should be created or read from',
argparse_kwargs={'required': True},
)
KEYSTORE_PASSWORD = cli.ArgumentProperties(
key='keystore_password',
Expand Down