From 896e17817b259e5a1d2acd14105e8c7c1febdc11 Mon Sep 17 00:00:00 2001 From: zhiren Date: Mon, 16 Jun 2025 15:33:24 -0400 Subject: [PATCH 1/6] fixup the download link is not compatible with platform --- .../workflows/update_compatible_version.yml | 2 +- app/utils/aggregated.py | 10 ++++-- pyproject.toml | 2 +- tests/app/utils/test_aggregated.py | 32 +++++++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_compatible_version.yml b/.github/workflows/update_compatible_version.yml index f1a35732..2f85d6e0 100644 --- a/.github/workflows/update_compatible_version.yml +++ b/.github/workflows/update_compatible_version.yml @@ -9,7 +9,7 @@ on: jobs: update-compatible-versions: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/app/utils/aggregated.py b/app/utils/aggregated.py index 5bf8fd49..ace4c541 100644 --- a/app/utils/aggregated.py +++ b/app/utils/aggregated.py @@ -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 @@ -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 + plaform = 'macos' if platform.system() == 'Darwin' else platform.system().lower() + download_details = result.get(plaform, None) + + 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): diff --git a/pyproject.toml b/pyproject.toml index 204702be..85872206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "app" -version = "3.19.6" +version = "3.19.7" description = "This service is designed to support pilot platform" authors = ["Indoc Systems"] diff --git a/tests/app/utils/test_aggregated.py b/tests/app/utils/test_aggregated.py index bca1e217..cb9524ad 100644 --- a/tests/app/utils/test_aggregated.py +++ b/tests/app/utils/test_aggregated.py @@ -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 @@ -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('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'] From 2f3fa4f2188161689cf8a4465db545363a34c98a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 16 Jun 2025 20:19:58 +0000 Subject: [PATCH 2/6] Updated docs/compatible_version.ndjson with PR #244 --- README.md | 3 +++ docs/compatible_version.ndjson | 1 + 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index b734fcf2..5762e844 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ Command line tool that allows the user to execute data operations on the platfor | 3.19.2 | 2.15.2 | 2.15.2 | | 3.19.3 | 2.15.2 | 2.15.2 | | 3.19.4 | 2.15.2 | 2.15.2 | +| 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 | ## Build Instructions diff --git a/docs/compatible_version.ndjson b/docs/compatible_version.ndjson index 127ef959..d0ef7a37 100644 --- a/docs/compatible_version.ndjson +++ b/docs/compatible_version.ndjson @@ -13,3 +13,4 @@ {"Cli Version": "3.19.4", "Pilot Release Version": "2.15.2", "Compatible Version": "2.15.2"} {"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"} From 7e8f300a9e7bd26de02d1f870b2abdbc3a7b06fa Mon Sep 17 00:00:00 2001 From: Color Zhan Date: Mon, 16 Jun 2025 16:50:58 -0400 Subject: [PATCH 3/6] Update app/utils/aggregated.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- app/utils/aggregated.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/aggregated.py b/app/utils/aggregated.py index ace4c541..d46da8ab 100644 --- a/app/utils/aggregated.py +++ b/app/utils/aggregated.py @@ -250,8 +250,8 @@ def get_latest_cli_version() -> Tuple[Version, str]: result = response.json().get('result', {}) # extract the download URL by platform - plaform = 'macos' if platform.system() == 'Darwin' else platform.system().lower() - download_details = result.get(plaform, None) + platform_key = 'macos' if platform.system() == 'Darwin' else platform.system().lower() + download_details = result.get(platform_key, None) latest_version = download_details.get('version', '0.0.0') download_url = download_details.get('download_url', '') From 943b56428cf672c7fe6f8c69d803038612b96aec Mon Sep 17 00:00:00 2001 From: Color Zhan Date: Mon, 16 Jun 2025 17:10:52 -0400 Subject: [PATCH 4/6] Update tests/app/utils/test_aggregated.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/app/utils/test_aggregated.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/utils/test_aggregated.py b/tests/app/utils/test_aggregated.py index cb9524ad..5914ce0f 100644 --- a/tests/app/utils/test_aggregated.py +++ b/tests/app/utils/test_aggregated.py @@ -256,7 +256,7 @@ def test_get_version_compatibility_fail_with_version_incompatible(httpx_mock, ca @pytest.mark.parametrize('platform_name', ['Linux', 'Windows', 'Darwin']) def test_get_download_link_by_platform(mocker, platform_name, httpx_mock): - mocker.patch('platform.system', return_value=platform_name) + mocker.patch('app.utils.aggregated.platform.system', return_value=platform_name) expected_result = { 'linux': { 'version': '1.0.0', From 50d2349f558a2a1f8306a7dfc7020874426bfec7 Mon Sep 17 00:00:00 2001 From: zhiren Date: Tue, 17 Jun 2025 13:53:09 -0400 Subject: [PATCH 5/6] update PR by suggestion --- app/utils/aggregated.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/aggregated.py b/app/utils/aggregated.py index d46da8ab..bc33680f 100644 --- a/app/utils/aggregated.py +++ b/app/utils/aggregated.py @@ -251,7 +251,7 @@ def get_latest_cli_version() -> Tuple[Version, str]: # extract the download URL by platform platform_key = 'macos' if platform.system() == 'Darwin' else platform.system().lower() - download_details = result.get(platform_key, None) + download_details = result.get(platform_key, {}) latest_version = download_details.get('version', '0.0.0') download_url = download_details.get('download_url', '') diff --git a/pyproject.toml b/pyproject.toml index 85872206..7b5a640a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] From b1c2ba849efb3f531ebd19a57db5d920aeec122a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 17 Jun 2025 17:53:48 +0000 Subject: [PATCH 6/6] Updated docs/compatible_version.ndjson with PR #244 --- README.md | 1 + docs/compatible_version.ndjson | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 5762e844..0f59bba9 100644 --- a/README.md +++ b/README.md @@ -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 | ## Build Instructions diff --git a/docs/compatible_version.ndjson b/docs/compatible_version.ndjson index d0ef7a37..9332d22e 100644 --- a/docs/compatible_version.ndjson +++ b/docs/compatible_version.ndjson @@ -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"}