Skip to content

Commit

Permalink
update script arg and mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Aug 28, 2024
1 parent e660d97 commit 0e70bca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 5 additions & 1 deletion apps_ci/scripts/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 1 addition & 9 deletions apps_ci/version_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0e70bca

Please sign in to comment.