diff --git a/nanolayer/cli/install.py b/nanolayer/cli/install.py index 87369b83..f5173605 100644 --- a/nanolayer/cli/install.py +++ b/nanolayer/cli/install.py @@ -126,6 +126,7 @@ def install_aptitude_packages( def install_apk_packages( packages: str = typer.Argument(None, help="comma separated list of apk packages") ) -> None: + print("hoii", flush=True) ApkInstaller.install( packages=packages.split(","), ) diff --git a/nanolayer/installers/gh_release/resolvers/release_resolver.py b/nanolayer/installers/gh_release/resolvers/release_resolver.py index ff5505a5..9e7f3c46 100644 --- a/nanolayer/installers/gh_release/resolvers/release_resolver.py +++ b/nanolayer/installers/gh_release/resolvers/release_resolver.py @@ -1,4 +1,5 @@ import json +import logging import re import urllib from typing import Any, Dict, List, Optional @@ -6,6 +7,8 @@ import invoke from natsort import natsorted +logger = logging.getLogger(__name__) + class ReleaseResolver: class ReleaseResolverError(Exception): @@ -44,13 +47,26 @@ def get_version_tags( return stringified_matches return [] + @classmethod + def valid_version(cls, value: str) -> bool: + normalized_value = value.lstrip("v") + return normalized_value[0].isalpha() or normalized_value[0].isdigit() + @classmethod def get_latest_git_version_tag( cls, repo: str, release_tag_regex: Optional[str] = None ) -> str: all_version_tags = cls.get_version_tags(repo, release_tag_regex) - return natsorted(all_version_tags)[-1] + valid_versions = list(filter(cls.valid_version, all_version_tags)) + + if len(valid_versions) != len(all_version_tags): + logger.warning( + "The following release versions were filtered out as invalid: %s", + str(set(all_version_tags) - set(valid_versions)), + ) + + return natsorted(valid_versions)[-1] @classmethod def get_latest_release_tag(