def get_version()

in wadebug/wa_actions/docker_utils.py [0:0]


def get_version(version):
    """
    It returns the version in format of v2.{major version}.{minor version}.

    All beta builds are marked 2.{even_number}.*. Expiry date for these is image create date + 45 days
    All external builds are 2.{odd_number}.*. Expiry date for all 2.{odd_number}.* is same.
    Although 2.19.* is for external users, expiry date for these builds are image_create_date + 180 days
    So, this function returns
      if version >= v2.21.1 or if it's not a internal build
          (v2.{major version}, v2.{major version}.{minor version})
         Ex : i.e for 2.21.1 it returns (v2.21,v2.21.1)
      otherwise
          (v2.{major version}.{minor version}, v2.{major version}.{minor version})
          Ex : i.e for 2.20.2 it returns (v2.20.2,v2.20.2)
    """
    arr = version.split(".")
    if is_beta_build(arr[1]) or int(arr[1]) <= 19:
        return (version, version)
    return (arr[0] + "." + arr[1], version)