Skip to content

Commit

Permalink
Bugfix: Address issues in android-keystore tool (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
priitlatt authored Mar 18, 2022
1 parent 4b9a716 commit cf232aa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
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

0 comments on commit cf232aa

Please sign in to comment.