Skip to content

Commit 189df7a

Browse files
GitHKAndrei Neagumergify[bot]
authored
🎨 release notes version has always patch set to 0 (#7339)
Co-authored-by: Andrei Neagu <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 2ff240c commit 189df7a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

services/web/server/src/simcore_service_webserver/statics/_events.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from aiohttp.client import ClientSession
88
from aiohttp.client_exceptions import ClientConnectionError, ClientError
99
from common_library.json_serialization import json_dumps
10+
from packaging.version import Version
1011
from servicelib.aiohttp.client_session import get_client_session
1112
from tenacity.asyncio import AsyncRetrying
1213
from tenacity.before import before_log
@@ -93,6 +94,11 @@ async def create_cached_indexes(app: web.Application) -> None:
9394
app[APP_FRONTEND_CACHED_INDEXES_KEY] = cached_indexes
9495

9596

97+
def _get_release_notes_vtag(vtag: str) -> str:
98+
version = Version(vtag)
99+
return f"v{version.major}.{version.minor}.0"
100+
101+
96102
async def create_and_cache_statics_json(app: web.Application) -> None:
97103
# NOTE: in devel model, the folder might be under construction
98104
# (qx-compile takes time), therefore we create statics.json
@@ -132,7 +138,8 @@ async def create_and_cache_statics_json(app: web.Application) -> None:
132138
):
133139
# template URL should be somethign like:
134140
# https://github.com/ITISFoundation/osparc-issues/blob/master/release-notes/osparc/{vtag}.md
135-
data["vcsReleaseUrl"] = template_url.format(vtag=vtag)
141+
release_vtag = _get_release_notes_vtag(vtag)
142+
data["vcsReleaseUrl"] = template_url.format(vtag=release_vtag)
136143

137144
data_json = json_dumps(data)
138145
_logger.debug("Front-end statics.json: %s", data_json)

services/web/server/tests/unit/with_dbs/01/test_statics.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
from simcore_service_webserver.statics._constants import (
2323
APP_FRONTEND_CACHED_STATICS_JSON_KEY,
2424
)
25-
from simcore_service_webserver.statics._events import create_and_cache_statics_json
25+
from simcore_service_webserver.statics._events import (
26+
_get_release_notes_vtag,
27+
create_and_cache_statics_json,
28+
)
2629
from simcore_service_webserver.statics.plugin import setup_statics
2730

2831

@@ -154,3 +157,15 @@ async def test_create_and_cache_statics_json_vendor_vcs_overwrite(
154157
product_dict = json.loads(product_data)
155158
assert product_dict.get("vcsReleaseTag") == vcs_release_tag
156159
assert product_dict.get("vcsReleaseUrl") == expected_vcs_url
160+
161+
162+
@pytest.mark.parametrize(
163+
"vtag, expected_vtag",
164+
[
165+
("v1.11.34", "v1.11.0"),
166+
("v1.11.8", "v1.11.0"),
167+
("v1.11.0", "v1.11.0"),
168+
],
169+
)
170+
def test__get_release_notes_vtag(vtag: str, expected_vtag: str):
171+
assert _get_release_notes_vtag(vtag) == expected_vtag

0 commit comments

Comments
 (0)