Skip to content

Commit

Permalink
salt: Get shell-ui version from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
JBWatenbergScality committed Feb 26, 2021
1 parent c4275a9 commit d229ab8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ def _get_parts(self) -> Iterator[str]:
"ThemeConfig": textwrap.indent(
UI_THEME_OPTIONS.read_text(encoding="utf-8"), 12 * " "
),
"ShellUIVersion": versions.SHELL_UI_VERSION,
},
file_dep=[UI_THEME_OPTIONS],
),
Expand Down
9 changes: 8 additions & 1 deletion buildchain/buildchain/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
for use in tests and documentation as well.
"""
import operator
import json

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


VERSION_FILE = (Path(__file__) / "../../../VERSION").resolve()
REPO_ROOT = (Path(__file__) / "../../../").resolve()
VERSION_FILE = REPO_ROOT / "VERSION"

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

# Get shell ui version from package.json
shell_ui_package_contents = (REPO_ROOT / "shell-ui/package.json").read_text(
encoding="utf-8"
)
SHELL_UI_VERSION: str = json.loads(shell_ui_package_contents)["version"]

# }}}
# Container images {{{
Expand Down
2 changes: 1 addition & 1 deletion salt/metalk8s/addons/ui/deployed/ui.sls.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Create metalk8s-ui ConfigMap:
"url_grafana": "/grafana",
"url_doc": "/docs",
"url_alertmanager": "/api/alertmanager",
"url_navbar": "/shell/solution-ui-navbar.1.0.0.js",
"url_navbar": "/shell/solution-ui-navbar.@@ShellUIVersion.js",
"url_navbar_config": "/shell/config.json"
}

Expand Down

0 comments on commit d229ab8

Please sign in to comment.