Skip to content

Commit a570846

Browse files
salt: Get shell-ui version from package.json
1 parent 3a43d60 commit a570846

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

buildchain/buildchain/salt_tree.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def _get_parts(self) -> Iterator[str]:
377377
"ThemeConfig": textwrap.indent(
378378
UI_THEME_OPTIONS.read_text(encoding="utf-8"), 12 * " "
379379
),
380+
"ShellUIVersion": versions.SHELL_UI_VERSION,
380381
},
381382
file_dep=[UI_THEME_OPTIONS],
382383
),

buildchain/buildchain/versions.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
for use in tests and documentation as well.
88
"""
99
import operator
10+
import json
1011

1112
from collections import namedtuple
1213
from pathlib import Path
@@ -39,7 +40,8 @@ def load_version_information() -> None:
3940
globals()[var] = value.strip()
4041

4142

42-
VERSION_FILE = (Path(__file__) / "../../../VERSION").resolve()
43+
REPO_ROOT = (Path(__file__) / "../../../").resolve()
44+
VERSION_FILE = REPO_ROOT / "VERSION"
4345

4446
# Metalk8s version.
4547
# (Those declarations are not mandatory, but they help pylint and mypy).
@@ -53,6 +55,11 @@ def load_version_information() -> None:
5355
SHORT_VERSION: str = "{}.{}".format(VERSION_MAJOR, VERSION_MINOR)
5456
VERSION: str = "{}.{}{}".format(SHORT_VERSION, VERSION_PATCH, VERSION_SUFFIX)
5557

58+
# Get shell ui version from package.json
59+
shell_ui_package_contents = (REPO_ROOT / "shell-ui/package.json").read_text(
60+
encoding="utf-8"
61+
)
62+
SHELL_UI_VERSION: str = json.loads(shell_ui_package_contents)["version"]
5663

5764
# }}}
5865
# Container images {{{

salt/metalk8s/addons/ui/deployed/ui.sls.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Create metalk8s-ui ConfigMap:
4646
"url_grafana": "/grafana",
4747
"url_doc": "/docs",
4848
"url_alertmanager": "/api/alertmanager",
49-
"url_navbar": "/shell/solution-ui-navbar.1.0.0.js",
49+
"url_navbar": "/shell/solution-ui-navbar.@@ShellUIVersion.js",
5050
"url_navbar_config": "/shell/config.json"
5151
}
5252

0 commit comments

Comments
 (0)