From 0e70bca72fac115a063f81ec430e55f163a0222d Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Wed, 28 Aug 2024 17:47:40 +0300 Subject: [PATCH] update script arg and mapping --- apps_ci/scripts/bump_version.py | 6 +++++- apps_ci/version_bump.py | 10 +--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps_ci/scripts/bump_version.py b/apps_ci/scripts/bump_version.py index ad59757..6bd5cdd 100644 --- a/apps_ci/scripts/bump_version.py +++ b/apps_ci/scripts/bump_version.py @@ -40,7 +40,11 @@ def update_app_version(app_path: str, bump_type: str) -> None: def main(): parser = argparse.ArgumentParser() parser.add_argument('--path', help='Specify path of the app to be updated') - parser.add_argument('--bump', help='Bump type for app that the hash was updated') + parser.add_argument( + # We allow more choices here, as "Renovate" has more update types. We still map them to the ones we need. + '--bump', nargs=1, type=str, choices=('major', 'minor', 'patch', 'digest', 'pin', 'pinDigest'), + required=False, help='Version bump type for app that the hash was updated' + ) args = parser.parse_args() if not args.path or not args.bump: diff --git a/apps_ci/version_bump.py b/apps_ci/version_bump.py index 1a41b05..3c09375 100644 --- a/apps_ci/version_bump.py +++ b/apps_ci/version_bump.py @@ -3,15 +3,7 @@ def map_renovate_bump_type(bump: str) -> str: - if bump in ('patch', 'minor', 'major'): - return bump - - if bump in ('digest', 'pin', 'pinDigest'): - return 'patch' - - # There are few other types, but we should not proceed with them. - # For example: rollback, replacement - raise ValueError(f'Invalid bump type {bump!r}') + return bump if bump in ('patch', 'minor', 'major') else 'patch' def is_valid_version(version: str) -> bool: