Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Command line tool that allows the user to execute data operations on the platfor
| 3.19.5 | 2.15.2 | 2.15.2 |
| 3.19.6 | 2.15.2 | 2.15.2 |
| 3.19.7 | 2.15.2 | 2.15.2 |
| 3.20.0 | 2.15.2 | 2.15.2 |
<!-- COMPATIBLE_VERSIONS_END -->

## Build Instructions
Expand Down
10 changes: 8 additions & 2 deletions app/utils/aggregated.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Contact Indoc Systems for any questions regarding the use of this source code.

import os
import platform
import re
import shutil
import time
Expand Down Expand Up @@ -247,8 +248,13 @@ def get_latest_cli_version() -> Tuple[Version, str]:
headers = {'Authorization': 'Bearer'}
response = httpx_client._get('v1/download/cli/presigned', headers=headers)
result = response.json().get('result', {})
latest_version = result.get('linux', {}).get('version', '0.0.0')
download_url = result.get('linux', {}).get('download_url', '')

# extract the download URL by platform
platform_key = 'macos' if platform.system() == 'Darwin' else platform.system().lower()
download_details = result.get(platform_key, {})

latest_version = download_details.get('version', '0.0.0')
download_url = download_details.get('download_url', '')

return Version(latest_version), download_url
except (SystemExit, Exception):
Expand Down
1 change: 1 addition & 0 deletions docs/compatible_version.ndjson
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
{"Cli Version": "3.19.5", "Pilot Release Version": "2.15.2", "Compatible Version": "2.15.2"}
{"Cli Version": "3.19.6", "Pilot Release Version": "2.15.2", "Compatible Version": "2.15.2"}
{"Cli Version": "3.19.7", "Pilot Release Version": "2.15.2", "Compatible Version": "2.15.2"}
{"Cli Version": "3.20.0", "Pilot Release Version": "2.15.2", "Compatible Version": "2.15.2"}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "app"
version = "3.19.7"
version = "3.20.0"
description = "This service is designed to support pilot platform"
authors = ["Indoc Systems"]

Expand Down
32 changes: 32 additions & 0 deletions tests/app/utils/test_aggregated.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from app.configs.app_config import AppConfig
from app.models.item import ItemType
from app.utils.aggregated import check_item_duplication
from app.utils.aggregated import get_latest_cli_version
from app.utils.aggregated import get_version_compatibility
from app.utils.aggregated import identify_target_folder
from app.utils.aggregated import normalize_input_paths
Expand Down Expand Up @@ -251,3 +252,34 @@ def test_get_version_compatibility_fail_with_version_incompatible(httpx_mock, ca
f'CLI version is incompatible with server version. Please update the CLI to version {min_cli_version}'
+ f' or later, and minimum server version is {min_server_version}.'
) in out.rstrip()


@pytest.mark.parametrize('platform_name', ['Linux', 'Windows', 'Darwin'])
def test_get_download_link_by_platform(mocker, platform_name, httpx_mock):
mocker.patch('app.utils.aggregated.platform.system', return_value=platform_name)
expected_result = {
'linux': {
'version': '1.0.0',
'download_url': 'https://example.com/download/linux',
},
'windows': {
'version': '1.0.1',
'download_url': 'https://example.com/download/windows',
},
'macos': {
'version': '1.1.0',
'download_url': 'https://example.com/download/macos',
},
}
httpx_mock.add_response(
url=AppConfig.Connections.url_fileops_greenroom + '/v1/download/cli/presigned',
method='GET',
json={'result': expected_result},
status_code=200,
)

version, url = get_latest_cli_version()
if platform_name.lower() == 'darwin':
platform_name = 'macos'
assert str(version) == expected_result[platform_name.lower()]['version']
assert url == expected_result[platform_name.lower()]['download_url']
Loading